Estimated area under a curve program

Click For Summary
A user developed a TI-86 program to estimate the area under a curve using the Right Rectangular Approximation Method (RRAM), Left Rectangular Approximation Method (LRAM), and the Trapezoid method, but is experiencing inconsistent results. The program sometimes produces answers that are significantly incorrect, including one instance where the output was three times the expected value. The user seeks assistance in troubleshooting the program's functionality and is also interested in potential ways to streamline the code for better performance. The use of the arrow symbol in the code has caused confusion, resembling a minus greater than sign. The discussion focuses on debugging and optimizing the area estimation program.
Jeremy
Messages
28
Reaction score
0
I wrote a TI-86 program for estimating the area under a curve using "Right Rectangular Approximation Method" (RRAM), "Left..." (LRAM), and "Trapezoid" method.

However, it refuses to work. Sometimes it works, but I have gotten answers that are way off. Once i got something that was 3x the correct answer.

InpSt "Function;",EQ
St>Eq(EQ,y9)
Input "Min=",EN
Input "Max=",EX
Input "# of intervals:",EI
(EX-EN)/EI -> LI
EN -> NN
EN -> NP
0 -> AA
For (NN,EN,EX-LI,LI)
AA+y9(EN) -> AA
End
AA(LI) -> AA
0 -> AB
For (NP,EN+LI,EX,LI)
AB+y9(NP) -> AB
End
AB(LI) -> AB
(AA+AB)/2 -> AC
Disp "LRAM",AA
Disp "RRAM",AB
Disp "Trap",AC

why doesn't this work? also, could it be streamlined?
 
Physics news on Phys.org
for simplicities sake i used -> as an arrow. i see now that it looks like a minus greater than sign.
 

Similar threads

Replies
6
Views
4K
  • · Replies 5 ·
Replies
5
Views
12K
  • · Replies 5 ·
Replies
5
Views
3K
Replies
2
Views
2K
  • · Replies 6 ·
Replies
6
Views
5K
Replies
7
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
4
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K