TI-84/nspire BASIC Programs

Newton's Method

    newtonsmethod
  1. Define newtonsmethod()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "x0: ",a
  5. Request "n: ",n
  6. Local i
  7. For i,1,n
  8. a-f(a)/
    d
    dx
    (f(x))|x=a→a
  9. Disp "x",i,"=",a
  10. EndFor
  11. EndPrgm

Average Value

    averagevalue
  1. Define averagevalue()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Local y
  7. 1/(b-a)⋅
    b
    a
    f(x)dx→y
  8. Disp "y=",y
  9. Disp "x=",nSolve(f(x)=y,x=(b-a)/2,a,b)
  10. EndPrgm

Slope of a Polar Function

    polarslope
  1. Define polarslope()=
  2. Prgm
  3. Request "r(θ): ",r(θ)
  4. Request "θ: ",a
  5. Local s:
    d
    dx
    (r(θ))|θ=a→s
  6. Disp (s⋅sin(a)+r(a)⋅cos(a))/(s⋅cos(a)-r(a)⋅sin(a))
  7. EndPrgm

Left Riemann Sum

    lram
  1. Define lram()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Request "n: ",n
  7. Local w,i,s:0→s
  8. b-a
    n
    →w
  9. For i,0,n-1
  10. s+w⋅f(a+i⋅w)→s
  11. EndFor
  12. Disp "Area≈",s
  13. EndPrgm

Right Riemann Sum

    rram
  1. Define rram()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Request "n: ",n
  7. Local w,i,s:0→s
  8. b-a
    n
    →w
  9. For i,1,n
  10. s+w⋅f(a+i⋅w)→s
  11. EndFor
  12. Disp "Area≈",s
  13. EndPrgm

Middle Riemann Sum

    mram
  1. Define mram()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Request "n: ",n
  7. Local w,i,s:0→s
  8. b-a
    n
    →w
  9. For i,0.5,n
  10. s+w⋅f(a+i⋅w)→s
  11. EndFor
  12. Disp "Area≈",s
  13. EndPrgm

Trapezoidal Sum

    trapsum
  1. Define trapsum()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Request "n: ",n
  7. Local w,i,s:0→s
  8. b-a
    n
    →w
  9. For i,0.5,n
  10. s+0.5⋅w⋅(f(a+i⋅w)+f(a+i⋅w+w))→s
  11. EndFor
  12. Disp "Area≈",s
  13. EndPrgm

Simpson's Rule Sum

    simpsum
  1. Define simpsum()=
  2. Prgm
  3. Request "f(x): ",f(x)
  4. Request "a: ",a
  5. Request "b: ",b
  6. Request "n: ",n
  7. Local w,i,s:0→s
  8. b-a
    n
    →w
  9. For i,0,n-1
  10. s+w/3⋅(f(a+i⋅w)+f(a+i⋅w+w))→s
  11. EndFor
  12. For i,1,n-1,2
  13. s+2⋅w/3⋅f(a+i⋅w)→s
  14. EndFor
  15. Disp "Area≈",s
  16. EndPrgm