RAND
Output: Simulates flipping a fair coin. Graphs the rel-
ative frequencies for every P “flips.”
Input: P. Set the dimensions of the screen to [0, 94] by
[0.4, 0.6]. Set MODE to Dot and Seq.
:ClrDraw
:Disp “P =”
:Input P
:5 → U
:0 → H
:0 → M
:0 → N
:Lbl 1
:rand→ A
:If A ≥ .5
:H + 1 → H
:M + 1 → M
:If M < P
:Goto 1
:N + P → N
:H/N → F
:Pt-On(U, F )
:U + 1 → U
:0 → M
:Goto 1
RAND2
Output: Simulates flipping a fair coin. Graphs the rel-
ative frequencies for every P “flips.” There is a pause
after each relative frequency is given. Press the key
ENTER to continue.
Input: P. Set the dimensions of the screen to [0, 94] by
0.4, 0.6]. Set MODE to Dot and Seq.
:ClrDraw
:Disp “P =”
:Input P
:5 → U
:0 → H
:0 → M
:0 → N
:Lbl 1
:rand→ A
:If A ≥ .5
:H + 1 → H
:M + 1 → M
:If M < P
:Goto 1
:N + P → N
:H/N → F
:Disp F
:Pause
:Pt-On(U, F )
:U + 1 → U
:0 → M
:Goto 1
Program RECT
Output: A graph of the function y = f (x) and the rect-
angles associated with the left- and right-hand sums,
and also gives these sums. Press the ENTER key to
obtain the next item.
Input: f(x) as Y
1
, N. Set the range variables so that
xmin=a, xmax=b, and ymin and ymax as desired.
:Disp “N”
:Input N
:(Xmax−Xmin)/N → H
:0→S
:ClrDraw
:DispGraph
:0→J
:Xmin+H → X
:Lbl 1
:Y
1
+ S → S
:Line(X − H, 0, X − H, Y
1
)
:Line(X − H, Y
1
, X, Y
1
)
:Line(X, 0, X, Y
1
)
:X + H → X
:J + 1 → J
:If J < N
:Goto 1
:Pause
:HS → S
:ClrHome
:ClrDraw
:Disp “RIGHT SUM”
:Disp S
:Pause
:ClrHome
:DispGraph
:0 → J
:0 → T
:Xmin→ X
:Lbl 2
:Y
1
+ T → T
:Line(X, 0, X, Y
1
)
:Line(X, Y
1
, X + H, Y
1
)
:Line(X + H, 0, X + H, Y
1
)
:X + H → X
:J + 1 → J
:If J < N
:Goto 2
:Pause
55