(34C) (11C) Summation of Infinite Alternating Series

02102021, 06:04 PM
(This post was last modified: 02132021 05:22 PM by Valentin Albillo.)
Post: #1




(34C) (11C) Summation of Infinite Alternating Series
Extracts from HP Program VA342  HP34C Summation of Alternating Series
Keywords: sum, infinite alternating series, Euler Transformation, Euler sum, differences, programmable calculator, RPN, HP34C Introduction
Link to PDF: HP Program VA342  HP34C Summation of Alternating Series.pdf V. All My Articles & other Materials here: Valentin Albillo's HP Collection 

02122021, 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[in] = 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.1446886446884671e005 5 1.4308608058594997e006 6 2.1042070674336805e007 7 3.50701177901638e008 8 6.4602848558431396e009 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 

02132021, 05:51 PM
Post: #3




RE: (34C) (11C) Summation of Infinite Alternating Series
Hi, Albert Chan: (02122021 03:04 PM)Albert Chan Wrote: Thank you for your kind words, much appreciated. Quote:I did spot a few typos in the pdf, however. Nah, not exactly typos as in "I typed something incorrectly" but simply that I was being somewhat informal (originally it was a "Long Live"Series article, not a formal math paper), not counting term 0 or caring to specify the precise alternating sign for the correction terms. However, rest assured that the RPN program code of course does take these details into account and is perfectly correct, as you may check if you run the examples featured or any others of your own. Thanks again and keep your eyes peeled for my next post tomorrow 14th, to commemorate my worldwideknown saint patron's festivity. I'll welcome any inputs from you but please, no Lua, no Xcas, I know you'll be itching to use them but please refrain from doing so. If you want to contribute something, I'd appreciate it if you would please post code or results for some HP calc using some HPcalc language and we'll remain in good terms, Ok ? Regards V. All My Articles & other Materials here: Valentin Albillo's HP Collection 

02132021, 06:15 PM
Post: #4




RE: (34C) (11C) Summation of Infinite Alternating Series
(02132021 05:51 PM)Valentin Albillo Wrote: Thanks again and keep your eyes peeled for my next post tomorrow 14th, to commemorate my worldwideknown saint patron's festivity. Looking forward to it Quote: I'll welcome any inputs from you but please, no Lua, no Xcas ... Noted. I just wanted to show how Euler transformation converted slowly convering sum, into a fast one. I should have just post the Euler transformed partial sum table ... 

02132021, 10:34 PM
Post: #5




RE: (34C) (11C) Summation of Infinite Alternating Series
I have worked through this nice paper and algorithm too, many thanks Valentin!
(02122021 03:04 PM)Albert Chan Wrote: We may apply Aitken Extrapolation, to slight improve estimate of s2 Very clever to think of that. I have one question. I would think that t[d+1]^2/(t[d+1]  t[d]) and (x[n+1]x[n])^2/((x[n+1]x[n])(x[n]x[n1])) are related if terms x[] are extrapolated, but that is not the case? Shouldn't the formula be (t[d]+t[d+1])^2/(t[d+1]) since when d=2 for example t[2]=x[n+2]x[n+1] and t[3]=x[n+3]2x[n+2]+x[n+1]? How did you derive your formula?  Rob "I count on old friends to remain rational" 

02132021, 11:30 PM
Post: #6




RE: (34C) (11C) Summation of Infinite Alternating Series
Hi, robve
Let the last 3 cumulative sum of s2 be a, b, c a + t[d] = b b + t[d+1] = c = s2 Aitken(a,b,c) = c  (cb)^2/((cb)(ba)) = s2  t[d+1]^2 / (t[d+1]  t[d]) Or, Secant's method, from 2 points: (x1, y1) = (b, t[d]), (x2, y2) = (c, t[d+1]) Extrapolate for (x, t[∞] = 0). Both methods are equivalent. x = x2  y2 * (x2x1)/(y2y1) = s2  t[d+1]^2 / (t[d+1]  t[d]) 

02142021, 11:30 AM
Post: #7




RE: (34C) (11C) Summation of Infinite Alternating Series
(02132021 11:30 PM)Albert Chan Wrote: Or, Secant's method, from 2 points: (x1, y1) = (b, t[d]), (x2, y2) = (c, t[d+1]) Selection of points is arbitrary, as long as it is consistent. Example, we can use mean of 2 cumulative sum for x's, estimated error gap for y's (x1, y1) = ((b+a)/2, (ba)/2) (x2, y2) = ((c+b)/2, (cb)/2) Again, Secant's method, extrapolate for (x, 0) x = (c+b)/2  (cb)/2 * ((c+b)/2  (b+a)/2) / ((cb)/2  (ba)/2) = c  (cb)/2  (cb)/2 * (ca) / (c2b+a) = c  (cb)/2 * ((c2b+a) + (ca)) / (c2b+a) = c  (cb)^2 / (c2b+a) = Aitken(a, b, c) 

02162021, 01:57 AM
Post: #8




RE: (34C) (11C) Summation of Infinite Alternating Series
(02142021 11:30 AM)Albert Chan Wrote: Again, Secant's method, extrapolate for (x, 0) Thanks, that explains it. I misunderstood the extrapolation was for S2, not the infinite alternating series (which couldn't be much of an improvement). Note that in general one should run the summation loop for S2 in Euler_transform backwards to accumulate fewer roundoff errors because the summand terms t[i] diminish quickly. Though I can't see how it really improves the final S that is already an approximation.  Rob "I count on old friends to remain rational" 

03022022, 03:17 PM
Post: #9




RE: (34C) (11C) Summation of Infinite Alternating Series
This has been here for a while: (11C) Summation of infinite, alternating series


« Next Oldest  Next Newest »

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