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 Graphing Calculator 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... Good Idea

Code:
for(I=1;I<=seg-1;I++)
{
suma+=f((h*I)+a);
}
becomes, for example,

Code:
For(I,1,S-1
T+F(A+HI-->T
End
I'm going to sleep soon, but if no one else does it, I'll translate the rest of that program tomorrow.
thanks for your time... I will appreciate if you can help me by putting the complete code... I am still learning this TI BASIC...

regards from El Salvador
Jorge Melara
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement