Program: CALCULUS Author: Dave Gaebler February 19, 1999 This is a combination of programs INTEGRAL, NEWTON, QUADAPP, and DIFFEQ. In case you don't have these individually, I will reproduce their descriptions here: INTEGRAL Variables used:A,B,C,D,H,L,N,L1 This programs approximates definite integrals with five different numerical techniques: Simpson's Rule, the Trapezoid Rule, the Midpoint Rule, and the Left and Right Hand Rules. Enter the subinterval length (delta x) when asked for h. Then enter a list of y-values. If you know what the function is, you can use the seq( command; it's number 5 on the LIST OPS menu. Be careful with the seq( if your increments are irrational, though; it may not do what you expect! I entered seq(sin(x),x,0,pi,pi/4) and it gave me a list with four entries instead of five. This is because it has to round off things like pi/4 and it may think 4*(pi/4) is more than pi. Try coming up with a clever substitute like seq(sin(pi*x),x,0,1,1/4). You may be wondering why I don't just ask you for the function like some numerical integration programs do. The reason is that one of the great strengths of numerical integration is the ability to approximate an integral if YOU DON'T KNOW WHAT THE FUNCTION IS! For example, if you ran a physical experiment and collected some data in a table, you could still integrate things if you didn't even know what they were. You might approximate area by measuring height at regular intervals and then integrating. You don't need a function for numerical integration; you just need some points. You can either get a midpoint approximation, or all four of the others. To get a midpoint approximation, enter a list of the y-values at the midpoints. If you do this, the other four will give you bogus answers; if you enter a list of the y-values at the enpoints of the subintervals, the midpoint approximation will be bogus and the others will be correct. NEWTON Variables used:A,B,C,X,Y,Str1 This program uses Newton's Method to approximate a real zero of Y1. Enter Y1 WITHOUT QUOTES! Then enter your "guess" or "seed" value, A. The tolerance is how close to zero y-values have to be. If you enter 1E-4, anything with an absolute value less than 1E-4 will be considered a zero. The current y value is displayed at the bottom of the screen; if it's not getting close to zero, Newton's Method might not be a good idea, or your function might not have any real zeros. QUADAPP Variables used:Y1,Y2,Str1,A,B,C,D,X This program finds the quadratic approximation to a function f(x) at a point a. The quadratic approximation at a is f(a)+f'(a)(x-a)+f''(a)(x-a)^2/2. It is the parabola whose value, first derivative, and second derivative at a are all the same as f(x). Enter Y1 WITHOUT QUOTES! Then enter the point a. After a brief think, the graph will be displayed. You can change the window as much as you like; Y2 is the parabola that approximates Y1. The coefficients of this parabola are c/2, b-ac, and d-ab+1/2a^2. DIFFEQ Variables used:A,B,C,D,E,F,G,H,N,X,Y,,Str1,n,u(n) This program approximates solutions to the differential equation dy/dx=f(x,y). You enter dy/dx, x1, and y1. Then you can do two things: (1) Graph the approximation. The graph is a bunch of points which will be erased if you change the window. This option uses the Runge- Kutta method. (2) Find the approximate y-value at a given x-value. This is done with the Euler method. When you enter dy/dx, you must use certain expressions instead of x and y. Sorry, it's the only way I could get it to work. For example, if dy/dx=x/y, enter dy/dx=(H(n-1)+A)/u(n-1). Be sure not to use quotes, as dy/dx is stored in a string. Also, if you want to find the y-value at x=c, make sure c-x1 is an integer multiple of h. I know, it's quite limited, but it's the best I could do. Oh yeah, there is an endless loop asking you to input the x-value. Don't panic; you can escape by pressing ON.