:ClrHome
:HT → T
:Disp “LEFT SUM”
:Disp T
:Disp “RIGHT SUM”
:Disp S
Program SEC See page 53.
Program SIMP
Output: Simpson’s rule approximation to
Z
b
a
f(x) dx.
Input: f(x) as Y
1
, A as a, B as b, N as n.
:Disp “A”
:Input A
:Disp “B”
:Input B
:Disp “N”
:Input N
:0→S
:(B-A)/N→H
:0→J
:Lbl 1
:A+JH→L
:L+H→M
:M+H→R
:L→X
:Y
1
→L
:M→X
:Y
1
→M
:R→X
:Y
1
→R
:H(L+4M+R)/3+S→S
:J + 2 → J
:If J < N
:Goto 1
:Disp “S=”
:Disp S
Program SOLVE
Output: Solution to f (x) = 0 using Newton’s method.
The solution is displayed when two successive iterations
are within 10 decimals of each other and the number
of iterations is not greater than 500. If the number of
iterations is greater than 500, the program stops and
says “NO CONV.”
Input: f(x) as Y
1
, the initial guess x
1
.
:Disp “X1”
:Input X
:1 → I
:Lbl 1
:X − Y
1
/nDeriv(Y
1
, X, X) → R
:If I > 500
:Goto 3
:If abs (X − R) ≤ abs(X/10
10
)
:Goto 2
:R → X
:I + 1 → I
:Goto 1
:Lbl 2
:Disp “SOLUTION”
:Disp R
:Stop
Lbl 3
:Disp “NO CONV”
Program SUM
Output: The left-hand sum
n−1
X
k=0
f(x
k
)h and right-hand
sum
n
X
k=1
f(x
k
)h where x
k
= a + kh, h = (b −a)/n.
Input: f(x) as Y
1
, A as a, B as b, N as n
:Disp “A”
:Input A
:Disp “B”
:Input B
:Disp “N”
:Input N
:0→S
:(B − A)/N → H
:A → X
:Y
1
→ U
:B → X
:Y
1
→ V
:A + H → X
:Lbl 1
:S + Y
1
→ S
:X + H → X
:If X < B − .5H
:Goto 1
:S + U → L
:LH → L
:S + V → R
:RH → R
:Disp “LEFT SUM”
:Disp L
:Disp “RIGHT SUM”
:Disp R
:Stop
56