(34C) (11C) Summation of Infinite Alternating Series
|
02-12-2021, 03:04 PM
Post: #2
|
|||
|
|||
RE: (34C) Summation of Infinite Alternating Series
The code is amazing !
I did spot a few typos in the pdf, however. S = Σ((-1)^i * y(i), i = 0 .. inf) = y(0)/2 - Δ(y(0))/4 + Δ²(y(0))/8 - ... S is splitted to 2 parts: S = S' + S'' S' = Σ((-1)^i * y(i), i = 0 .. n) S'' = y(n+1)/2 - Δ(y(n+1))/4 + Δ²(y(n+1))/8 - ... There are 2 issues with this. 1. S' actually summed n+1 terms, not n terms, as stated in the pdf 2. if n is even, S = S' - S'', not S' + S'' With these corrections, I was able to confirm example 1, S = 1 - 1/2 + 1/3 - 1/4 + ... Code: function euler_transform(t) -- S = t[1] - t[2] + t[3] - t[4] + ... lua> n, d, t = 10, 7, {} lua> for i=n+1,n+d+1 do t[i-n] = 1/(i+1) end -- terms to estimate s2 lua> euler_transform(t) lua> table.foreachi(t, print) 1 0.041666666666666664 2 0.0016025641025641003 3 0.00011446886446886233 4 1.1446886446884671e-005 5 1.4308608058594997e-006 6 2.1042070674336805e-007 7 3.50701177901638e-008 8 6.4602848558431396e-009 lua> s1, s2 = 0, 0 lua> for i=0,n do s1 = s1 + (-1)^i/(i+1) end -- n+1 terms lua> for i=1,d+1 do s2 = s2 + t[i] end -- d+1 terms lua> s1, s2 0.7365440115440116 0.043396829332061765 lua> s1 - s2 -- n is even, thus the minus sign 0.6931471822119498 We may apply Aitken Extrapolation, to slight improve estimate of s2 lua> s1 - (s2 - t[d+1]^2/(t[d+1] - t[d])) 0.6931471807531758 lua> log(2) 0.6931471805599453 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
(34C) (11C) Summation of Infinite Alternating Series - Valentin Albillo - 02-10-2021, 06:04 PM
RE: (34C) Summation of Infinite Alternating Series - Albert Chan - 02-12-2021 03:04 PM
RE: (34C) (11C) Summation of Infinite Alternating Series - Valentin Albillo - 02-13-2021, 05:51 PM
RE: (34C) (11C) Summation of Infinite Alternating Series - Albert Chan - 02-13-2021, 06:15 PM
RE: (34C) (11C) Summation of Infinite Alternating Series - robve - 02-13-2021, 10:34 PM
RE: (34C) (11C) Summation of Infinite Alternating Series - Albert Chan - 02-13-2021, 11:30 PM
RE: (34C) (11C) Summation of Infinite Alternating Series - Albert Chan - 02-14-2021, 11:30 AM
RE: (34C) (11C) Summation of Infinite Alternating Series - robve - 02-16-2021, 01:57 AM
RE: (34C) (11C) Summation of Infinite Alternating Series - Thomas Klemm - 03-02-2022, 03:17 PM
|
User(s) browsing this thread: 1 Guest(s)