Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Estimated area under a curve program

  1. Nov 18, 2005 #1
    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 doesnt this work? also, could it be streamlined?
     
  2. jcsd
  3. Nov 19, 2005 #2
    for simplicities sake i used -> as an arrow. i see now that it looks like a minus greater than sign.
     
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook