Post Reply 
Adaptive Simpson and Romberg integration methods
03-25-2021, 08:43 PM
Post: #12
RE: Adaptive Simpson and Romberg integration methods
(03-25-2021 04:48 PM)robve Wrote:  Edit 2: I briefly read your post in the other thread on trapezoidal and midpoint. I could be mistaken, but I don't think this is correct to do to get (extended) midpoints:
for i = 1, n, 2 do m = m + f(a + i*h) end
m = m*h -- midpoint area / 2
t = t*0.5 + m -- trapezoid area

As you had mentioned, with bisecting intervals, you cannot reuse previous points.
As a compromise, I reuse the sum for generating next trapezoids.

m = f1 + f3 + f5 + ... + fn-1

Each point have weight of 2h, thus m*h only get half the midpoint area, using n/2 points.
Again, m was produced only because it was free, a by-products of getting next t.

---

Instead of theory, try ∫(f(x), x=0 .. 1), mid-point rule, from 1 to 3 intervals.

m1 = f(1/2)
m3 = (f(1/6) + f(1/2) + f(5/6)) / 3

Note that previous point, f(1/2), is reused.
Romberg's extrapolation, from 1 to 3 points:

M3 = m3 + (m3-m1)/(3²-1) = (3*f(1/6) + 2*f(1/2) + 3*f(5/6)) / 8

Numerically confirm 3:2:3 gives good results:

∫(1/x, x=1 .. e) ≈ (3/(1+(e-1)/6) + 2/(1+(e-1)/2) + 3/(1+(e-1)*5/6))/8 * (e-1) ≈ 0.9969 ≈ 1

Yes, Wes had suggested trisecting intervals, for mid-point rule.
https://www.hpmuseum.org/forum/thread-14...#pid127797
https://www.hpmuseum.org/forum/thread-15...#pid134284
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Adaptive Simpson and Romberg integration methods - Albert Chan - 03-25-2021 08:43 PM



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