Simpson revival
07-31-2018, 02:57 PM (This post was last modified: 07-31-2018 06:42 PM by Albert Chan.)
Post: #14
 Albert Chan Senior Member Posts: 1,800 Joined: Jul 2018
RE: Simpson revival
(09-28-2016 03:50 PM)Namir Wrote:  Version 1 gave better results. These results seem counter intuitive, since I expected version 2 to give a better final result.

Any or all improvements and corrections are welcome.

Hi, Namir

From the book SICP, I think I know why your version 2 does not give expected better estimate.
The trick is not just apply correction based on 2 iterations, but from all previous iterations.

(09-28-2016 10:00 PM)Dieter Wrote:  Let f(x) = 1/x and integrate it from 1 to 2.
The exact result, rounded to 12 digits, is ln(2)=0,693147180560.

Code:
   n      Standard Simpson    Error        Improved            Error  ----------------------------------------------------------------------    2      0,694444444444      1,3 E-03       4      0,693253968254      1,1 E-04     0,693174603175      2,7 E-05    8      0,693154530655      7,4 E-06     0,693147901481      7,2 E-07   16      0,693147652819      4,7 E-07     0,693147194297      1,4 E-08   32      0,693147210290      3,0 E-08     0,693147180788      2,3 E-10   64      0,693147182421      1,9 E-09     0,693147180564      3,6 E-12  128      0,693147180676      1,2 E-10     0,693147180560      5,6 E-14

The "improved" column holds the extrapolated results, i.e. [16*Simpson(a, b, n) – Simpson(a, b, n/2)] / 15.

The first estimate is correct: T1 + (T1-T0)/(16-1) = 0.693174603175

However, second estimate should apply correction again, from previous estimate.

T1 + (T1-T0)/(64-1) = 0.693147901481 + (-2.67017e-05)/63 = 0.693147477645

Third estimate need 3 corrections (/15, /63, /255), ... This is the revised table.

Code:
   n      Standard Simpson    Error        Improved            Error  ----------------------------------------------------------------------    2      0,694444444444      1,3 E-03       4      0,693253968254      1,1 E-04     0,693174603175      2,7 E-05    8      0,693154530655      7,4 E-06     0,693147477645      3,0 E-07   16      0,693147652819      4,7 E-07     0,693147181917      1,4 E-09   32      0,693147210290      3,0 E-08     0,693147180562      2,4 E-12   64      0,693147182421      1,9 E-09     0,693147180560      1,6 E-15

Edit:
After reading the whole thread, it seems the code is not trying to use Romberg's method.
All it wanted was the first approximation of Romberg's extrapolation.
Sorry for the noise.

Anyway, this is what Romberg's method would look like ...
 « Next Oldest | Next Newest »

 Messages In This Thread Simpson revival - Pekis - 09-28-2016, 08:04 AM RE: Simpson revival - Namir - 09-28-2016, 10:40 AM RE: Simpson revival - Dieter - 09-28-2016, 12:25 PM RE: Simpson revival - Namir - 09-28-2016, 02:00 PM RE: Simpson revival - Namir - 09-28-2016, 03:50 PM RE: Simpson revival - Dieter - 09-28-2016, 10:00 PM RE: Simpson revival - Albert Chan - 07-31-2018 02:57 PM RE: Simpson revival - Namir - 09-29-2016, 04:44 PM RE: Simpson revival - Dieter - 09-29-2016, 06:23 PM RE: Simpson revival - Namir - 09-29-2016, 10:27 PM RE: Simpson revival - Dieter - 09-30-2016, 06:00 AM RE: Simpson revival - Dieter - 10-02-2016, 03:29 PM RE: Simpson revival - Namir - 10-02-2016, 04:48 PM RE: Simpson revival - Namir - 10-09-2016, 03:14 AM RE: Simpson revival - Albert Chan - 08-04-2018, 05:29 PM

User(s) browsing this thread: 1 Guest(s)