Introduction
This program plots the graph of a function f(x), draws
left or right hand rectangles, and computes the corresponding approximation
for .
If you have not used one of the programs posted on this website before,
you should read through
the information in the Intro to Programming
section first.
The Program
'RECTANGLES' | {' is in ALPHA} {This is the name of the program} |
Lbl 1 | {Lbl is in PRGM under JMP} |
"A"?A | {" is in ALPHA} {? is in PRGM} { is on the , button} |
"B"?B | |
"N"?N | |
"T"?T | |
Cls | {Cls is in SHIFT } |
Graph Y=Y1 | {Graph Y= is in GRAPH} {Y1 is in VAR under GPH, then followed by a 1} |
(B-A) N H | |
0S | {The 0 is a zero} |
1J | {The 1 is a one} |
Lbl 2 | |
A+(J-1) H U | {The is the times sign} |
U+TH X | |
Y1W | |
Plot U,0 | {Plot is in SHIFT } {The 0 is a zero} |
Plot U,W | |
Line | {Line is in SHIFT } |
Plot U+H,W | |
Line | |
Plot U+H,0 | {The 0 is a zero} |
Line | |
S+HY1 S | |
J+1J | |
JN Goto 2 | {, Goto are in PRGM under JMP} { is in PRGM under REL} |
"SUM" | |
S | { is in PRGM} |
Goto 1 |
Running the Program
You will need to enter a function f(x) into
Y1 before running
the program. Change the graphing RANGE so that the desired portion of
the function fills the screen. The program will first ask for values of A, B,
and N (number of subdivisions). The value of T determines the type of rectangle
to be viewed. T=0 corresponds to left hand rectangles, T=1 corresponds to
right hand rectangles. Any value between 0 and 1 can also be used.
After plotting the graph, the program will display the value of the
estimate. Hit GT to view the graph again.
To test the program try the following:
f(x) = x2+ 3, RANGE:
0< x <5,
0< y <25, A=1, B=4, N=6, T=1.
You should see a portion of a parabola and 6 right hand rectangles.
The numerical answer will be 33.875