PUT RSUMCOM.85p A program to compare the various ways of doing Riemann sums. Accuracy is checked against the numeric integration function. ----begin documentation---- RSUMSCOM is a program to compare various ways of doing Riemann Sums. For a fixed n, The program gives the sum using the right-hand, left hand, trapezoid, and midpoint rules, Simpson's rules, and the calculator's numeric integral. The user is prompted for a function, the limits of integration, and the number of subdivisions. The 6 values are then computed and presented on a single screen where they can be compared. This allows comparison of the effectiveness of the various methods. Loops are inserted for the user to change the number of subintervals, or the limits of integration, or the function. The program uses the variables A, B, C, E, F, H, I, J, L, M, N, Q, R, S, T, U, and Z and thus changes the values of those memory locations. The function is stored in Y0. This program was written by Mike May, S.J. from the department of Mathematics and Computer Science at Saint Louis University. Send comments to: maymk@slu.edu The most current copy is kept on a web page devoted to courseware kept at http://euler.slu.edu ----end documentation---- ----begin ASCII---- \START\ \COMMENT=Program file dated 03/17/96, 21:04 \NAME=RSUMSCOM \FILE=RSUMSCOM.85p Func FnOff 1\->\Z Repeat Z==0 InpST "ENTER FUNCTION",EQ \St>Eq\(EQ,y0) 1\->\A Repeat A==0 Lbl W Disp "ENTER" Disp "LOWER LIMIT" Prompt L Disp "ENTER" Disp "UPPER LIMIT" Prompt U If L\B Repeat B==0 Disp "NUMBER OF SUB" Disp "INTERVALS" Prompt N If N\>=\1 Goto Y Disp "NEED N \>=\ 1" Goto X Lbl Y fnInt(y0,X,L,U)\->\I (U-L)/N\->\H (L+H/2)\->\C 0\->\E evalF(y0,x,C)\->\F For(J,1,N-1,1) E+evalF(y0,x,L+J*H)\->\E F+evalF(y0,x,C+J*H)\->\F End H*(E+evalF(y0,x,L))\->\R H*(E+evalF(y0,x,U))\->\Q (R+Q)/2\->\T H*F\->\M (T+2*M)/3\->\S Disp "APROXIMATION" Disp "WITH RIGHT," Disp "LEFT, TRAPAZOID," Disp "MIDPOINT," Disp "SIMPSONS RULE," Disp "AND NUMERIC INT" Pause Disp "R,L,T,M,S,INT Disp R,Q,T,M,S,I Pause Disp "A DIFFERENT" Disp "NUMBER OF" Disp "SUBDIVISIONS?" Disp "1 FOR YES" Disp "0 FOR NO" Prompt B End Disp "NEW LIMITS" Disp "FOR THE" Disp "INTEGRAL?" Disp "1 FOR YES" Disp "0 FOR NO" Prompt A End Disp "ANOTHER" Disp "FUNCTION?" Disp "1 FOR YES" Disp "0 FOR NO" Prompt Z End FnOff \STOP\ ----end ASCII---- ----begin UUE---- begin 664 RSUMSCOM.85p M*BI423@U*BH:#`!03`L>"Q#*THJ2"D<1M9%;F362"HH12ME M=F%L1BAY,"QX+$PI*1Q2UD@J*$4K979A;$8H>3`L>"Q5*2D<4=8H4BM1*2\R M'%362"I&'$W6*%0K,BI-*2\S'%/61&ES<"`B05!23UA)34%424].(M9$:7-P M(")7251((%))1TA4+"+61&ES<"`B3$5&5"P@5%)!4$%:3TE$+"+61&ES<"`B M34E$4$])3E0L(M9$:7-P(")324U04T].4R!254Q%+"+61&ES<"`B04Y$($Y5 M345224,@24Y4(M90875S92#61&ES<"`B4BQ,+%0L32Q3+$E.5-9$:7-P(%(L M42Q4+$TL4RQ)UE!A=7-E(-9$:7-P(")!($1)1D9%4D5.5"+61&ES<"`B3E5- M0D52($]&(M9$:7-P(")354)$259)4TE/3E,_(M9$:7-P("(Q($9/4B!915,B MUD1I