Approx

Announcements of available shared folders

Approx

Postby stevey93 » Sat Aug 04, 2012 7:52 pm

I've just added the approx folder, which contains a number of common approximation methods including: Euler's method, left, middle, and right approximation methods, trapezoid and Simpson methods, double sided numerical derivation, and Newton's method. In order to get a quick graphical view of the differences in each method, I've added RPL programs which will use the corresponding method on the function 'f' and over the array 'Interval' and graphs each function with their intermediate steps (credit goes to Oliver for this suggestion). I've preset 'f' to return sin(x) and have set 'Interval' to a good range for demonstrating the differences of each approximation method.

So to get a quick idea of what each of these do, tap through each of the programs with the names 'RunNameOfMethod' (It may show as something like Ru...AM simply because it runs out of room to display the full name.). To change the function that it operates on to something other than sin(x), or have them operate on a different interval, or change the initial value, just edit the values of the variables 'f', 'Interval', and 'InitVal' respectively. If you want to a little more serious math than just seeing pretty graphs, you can always do that too. Say you would like to find an approximation to the integral of sin(x) over the interval [-2pi, -pi, 0, pi, 2pi] using the trapezoid method, starting with an initial value of 1. First make sure 'f' is set to sin(x) (I realize this can be annoying if you're outside of the approx folder and will change each method to accept functions as parameters shortly), then push the array onto the stack, then the initial value (optional, will default to 0 if there is no value) of 1 onto the stack, then run the program called 'Trapezoid'. This will give you an array of the approximate values to the integral of sin(x) over the given array obtained from the Trapezoid approximation. Each of these programs work very similarly with the exceptions of NDeriv and Newton. For NDeriv, just pass an array, and for Newton, just pass an initial guess to one of the function's roots.

Here is a list of brief descriptions for each approximation method:
-Euler: Uses Euler's method, taking 'f' as the derivative of the function you are trying to find. This is the only one that allows 'f' to have two parameters.
-LRAM, MRAM, RRAM: These use the left, middle, and right Riemann sums to approximate the integral of 'f'.
-Trapezoid: This uses the Trapezoidal method for finding integrals by integrating a piecewise linear approximation of 'f'.
-Simpson: This uses the Simpson method for finding integrals by integrating a piecewise quadratic approximation of 'f'.
-NDeriv: This uses a double sided numerical derivative to approximate the derivative of 'f'.
-Newton: This uses Newton's method for finding an approximate root of 'f' given an initial guess for it.

Anyway, I hope you can find these programs useful (especially if you are taking a Calculus course) and feel free to add anything you think would be useful, perhaps you may wish to add recursive versions of these programs which will call themselves on subintervals which have error above a certain tolerance, or maybe you'd like to add a program for the Runge-Kutta method. I very much look forward to seeing what sort of additions you might make to the folder, just be sure to post descriptions in this thread once you do.
stevey93
 
Posts: 6
Joined: Sun Jul 08, 2012 1:47 pm

Return to Downloadable Folders / Shared Data

Who is online

Users browsing this forum: No registered users and 1 guest

cron