Hi there, thanks for replying my other topic, I have been off internet for a while, I still try to learn more and more TIBASIC
I don't want to be unpolite, but I believe that the best way to learn is to practice and practice... and see how the master make the programs... and then.. review the work they've done...., learn the tips:
My problem with the next programm is that, I cannot (I don't know how)... can I tell my is that the formula is based on how many segments will be included to the operation, but as you may see there is this code:
for(i=1;i<=seg-1;i++)
{
suma+=f((h*i)+a);
}
this is basicly my problem...., here is the full programm written in C++ I would apprecciate quite a lot if you can tell me how to compile this in TI BASIC....
Since I am sure the upper and lower limits would be input correctly, there is no point of asking if the entered values are ok, so if you wish... lets not ask if the values are ok...
#include <iostream.h>
#include <conio.h>
#include <math.h>
double f(double x);
void main()
{
double a,b,I,i,resp,suma=0,h;
int seg;
cout << "Program for integrate the function\n";
cout << "0.2 + 25x - 200x^2 + 675x^3 - 900x^4 + 400x^5, \n";
cout << "Using Multiple Trapecious method\n" << endl;
do
{
cout << "\nInput the limits\n";
cout << "lower Limit: ";
cin >> a;
cout << "Upper Limit: ";
cin >> b;
cout << "Number of segments: "; cin >> seg;
cout<<"are the values ok (0=yes,1=no)?";//lets not ask if the entered values are ok, so can make a simpler program
cin>>resp;
}while(resp==1);
h=(b-a)/seg;
for(i=1;i<=seg-1;i++) // here is my confusion..
{
suma+=f((h*i)+a);
}
I= (b-a)*(((f(a)+2*suma)+f(b))/(2*seg));
cout << "\The value of the integral is:: " << I << endl;
getch();
}
double f(double x)
{
return (0.2+25*x-200*pow(x,2)+675*pow(x,3)-900*pow(x,4)+400*pow(x,5));
}
THANKS... Thanks a lot...you guys are my gurus and mentors for TI BASIC...
I don't want to be unpolite, but I believe that the best way to learn is to practice and practice... and see how the master make the programs... and then.. review the work they've done...., learn the tips:
My problem with the next programm is that, I cannot (I don't know how)... can I tell my is that the formula is based on how many segments will be included to the operation, but as you may see there is this code:
for(i=1;i<=seg-1;i++)
{
suma+=f((h*i)+a);
}
this is basicly my problem...., here is the full programm written in C++ I would apprecciate quite a lot if you can tell me how to compile this in TI BASIC....
Since I am sure the upper and lower limits would be input correctly, there is no point of asking if the entered values are ok, so if you wish... lets not ask if the values are ok...
#include <iostream.h>
#include <conio.h>
#include <math.h>
double f(double x);
void main()
{
double a,b,I,i,resp,suma=0,h;
int seg;
cout << "Program for integrate the function\n";
cout << "0.2 + 25x - 200x^2 + 675x^3 - 900x^4 + 400x^5, \n";
cout << "Using Multiple Trapecious method\n" << endl;
do
{
cout << "\nInput the limits\n";
cout << "lower Limit: ";
cin >> a;
cout << "Upper Limit: ";
cin >> b;
cout << "Number of segments: "; cin >> seg;
cout<<"are the values ok (0=yes,1=no)?";//lets not ask if the entered values are ok, so can make a simpler program
cin>>resp;
}while(resp==1);
h=(b-a)/seg;
for(i=1;i<=seg-1;i++) // here is my confusion..
{
suma+=f((h*i)+a);
}
I= (b-a)*(((f(a)+2*suma)+f(b))/(2*seg));
cout << "\The value of the integral is:: " << I << endl;
getch();
}
double f(double x)
{
return (0.2+25*x-200*pow(x,2)+675*pow(x,3)-900*pow(x,4)+400*pow(x,5));
}
THANKS... Thanks a lot...you guys are my gurus and mentors for TI BASIC...