TOPIC: fnInt function PRODUCT: TI-85 DATE: May 6, 1993 Recent postings have touched on the operation of fnInt and the possibility that the response might be slow enough to suggest that the function is not working. The main thing to check for is the value of "tol" under the TOLER menu. This is an absolute error limit that the algorithm is asked to meet. For instance, a value of 1E-9 would be trying to achieve 9 accurate digits after the decimal point in the result, which takes quite a lot more work than, say, 2 or 3 total accurate digits. It may be helpful to realize that a graph does not need to be more acccurate than one pixel to "look" right. Obviously, this depends on the Y-range, but for "typical" plots a "tol" of .01 is conservative. In fact, because the integration for "smooth" functions usually turns out to be more accurate than the requested tolerance by a few orders of magnitude, you can usually get visually correct plots with "tol" as large as 1. A large "tol" like 1 does increase graph speed noticeably for y= functions using fnInt. However, be aware that under some conditions, the integrator can simply "lose it" with a very large tolerance, so be alert if you do this! The method posted by Bert Waits (using parametric mode) is quite effective because the selection of the tstep size allows you to control a certain amount of straight line interpolation, which reduces the number of full integrations on the screen. You can trace this result easily, but the integrand is recomputed (once) each time you trace to a new t. Another approach may be helpful if you do this type of operation frequently, using the following program. To plot an equation and the integral, enter the equation as one of your "y=" equations, then run the program and enter the number of the equation at the prompt "Equ?". For instance, if your equation is y7, enter 7. You are prompted for the number twice because the TI-85 has no number to string conversion. Then the program will plot the equation and compute the integral "point by point" across the screen. The integral is computed between pixels and added to the integral at the previous pixel, rather than computing the integral from xMin to the pixel to be plotted each time, thereby saving time. More importantly, the results are put into a list (named Lst), and a new equation (y99) is created to plot this list. Finally, the selected equation and y99 are plotted. You can change the Y-range and also trace the integral easily. If you change the X-range, however, you will need to run the program again, because you have changed the limits of integration. Note that the program does not set the value of "tol", so make sure that tol is appropriate. To set "tol" from the program, a value of (abs(yMin - yMax) / 100) would be appropriate if you don't plan to change the Y-range too much while viewing the plot. \START\ \COMMENT=Program file dated 05/11/92, 08:58 \NAME=PLTINT \FILE=PLTINT.85P ClLCD {0}\->\Lst Input "Equ?",No InpST "Equ?",NoSt "y"+NoSt\->\NoSt \St>Eq\(NoSt,Ieqn) FnOff FnOn No 0\->\IGL For(Ndex,1,127) (xMin+Ndex*\Delta-x\)\->\x (IGL+fnInt(Ieqn,x,x,x+\Delta-x\)\->\IGL IGL\->\Lst(round((x-xMin)/\Delta-x\,0)+1) PtOn(x,IGL) End xMin\->\xmin y99=Lst(round((x-xmin)/\Delta-x\,0)+1) \STOP\ --------------------------------------------------------------------------- TI GRAPHIC PRODUCTS TEAM Texas Instruments (Consumer Products) P.O. Box 650311 M/S 3908 Internet: ti-cares@lobby.ti.com Dallas, Texas 75265 Fax: 214-917-7103 ---------------------------------------------------------------------------