Estimated area under a curve program

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 5K views
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.