Definite Integrals Using Simpson's Rule
Original program: the Radio Shack EC-4033 Owner's Manual, pages 142-3
Converted to ECS BASIC by mjhayes@cse.buffalo.edu
December 21, 1998
This program does not use graphics, so you can use any cartridge you want.
I know that final exams are nearly over for the Fall 1998 semester, but for
those of you taking make-up Calculus II exams and are able to sneak that
Intellivision, ECS, and television set into the exam room, this little program
may prove useful. It helped me (the original program on my calculator in
Summer 1995, that is) during a Calculus II exam. Hopefully you won't have to
show your work. If you do, simply show the BASIC program and watch the
expression on your professor as he/she grades your exam.
Simply input the values for A, B, and 2M, and it will compute the result
with prescision 10^-7 after about six seconds. The mathematical description is
long and unwieldy, and I will therefore display the LaTeX fragment when I get
around to it, namely after my exams are over. Enjoy.
10 FM(1)=7 ; One number will be displayed on one line, in
regular notation, with seven places to
the right of the decimal point.
20 CLR
30 INPU"INPUT A.",A
40 INPU"INPUT B.",B
50 INPU"INPUT 2M.",M ; Get values for A, B, and 2M
60 G=A
70 P=1/(G*G+1)
80 I=P
90 D=(B-A)/M
100 O=M/2
110 G=G+D
120 P=1/(G*G+1)
130 I=I+P*4
140 G=G+D
150 P=1/(G*G+1)
160 I=I+P*2
170 O=O-1
180 IF(O>0)GOTO 110
190 G=B
200 P=1/(G*G+1)
210 I=I-P
220 PRIN D*I/3 ; Display the result
230 INPU A ; Wait for the user to press RTN
240 GOTO 10 ; Do it again