Improved Simpson's rule
|
12-16-2015, 07:12 PM
(This post was last modified: 01-12-2018 11:03 AM by Dieter.)
Post: #1
|
|||
|
|||
Improved Simpson's rule
Recently there were some discussions regarding a compact implementation of Simpson's rule. I would like to add an improved version that calculates a new, usually more exact approximation from two Simpson approximations with n and 2n intervals. This way the user also gets an estimate for the approximation error.
The following code has not seen much testing. In fact I wrote it this morning during breakfast. ;-) So take care and please report all errors you find. Code: 01 LBL"SIMP" Insert your function at LBL 99 and start "SIMP". The program returns a sequence of approximations, with the latest one in X and the previous in Y. So pressing [x<>y] switches between the current and previous approximation. Example: Integrate f(x) = 1/x from a=1 to b=2. Code: [PRGM] In a way this method is similar to the Romberg scheme in that it calculates an improved approximation from a quite good estimate of the error associated with Simpson's rule. On the other hand no matrix has to be stored and the program requires only ten data registers (R00...R09): Code: Used registers: As usual, all comments and corrections are welcome. Dieter Edit: more than two years after posting this I realized that the example does not integrate ln(x) but 1/x. #-) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Improved Simpson's rule - Dieter - 12-16-2015 07:12 PM
RE: Improved Simpson's rule - rprosperi - 12-17-2015, 12:52 AM
|
User(s) browsing this thread: 1 Guest(s)