Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
10-27-2021, 05:12 PM (This post was last modified: 11-02-2021 10:49 PM by Albert Chan.)
Post: #11
 Albert Chan Senior Member Posts: 2,516 Joined: Jul 2018
RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
(10-25-2021 01:29 PM)Albert Chan Wrote:  Convergence speed very impressive, n=8 converged to float(pi^2/6)

2nd version, by putting some reasonable number to b, before loop start (*)
Now, n=6 already converged to float(pi^2/6)

Code:
function zeta2(n)     local N, c, t = n+0.5, (n%2)*6+2     local N2 = N*N     local a, b = 0, (N2+N) * 0.93/(10-c)     for i = n, 2, -1 do         t = i*i         a = a + 1/t         b = t*t/(b + c*N2)         c, N2 = 10-c, N2-N     end     return 1/(N+1/(b+c*N2)) + a + 1 end

lua> for n=0,8 do print(n, zeta2(n)) end
0﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.4539195555018722
1﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6448912932530366
2﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340922532778
3﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340670471453
4﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668467034
5﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482317
6﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482264
7﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482264
8﻿ ﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482264

(*) this is how initial b is estimated, by looking ahead.

XCAS> b2 := (N+3/2)^4 / (c*N*(N+2))
XCAS> b1 := (N+1/2)^4 / ((10-c)*N*(N+1) + b2)

XCAS> simplify(partfrac(b1(c=8))[1]) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → (2312*N^2+1904*N+480)/4913
XCAS> simplify(partfrac(b1(c=2))[1]) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ → (578*N^2+476*N+120)/4913

2312/4913*2 ≈ 0.9412
If N is large, this should be the constant to use instead of 0.93

Update: Looking ahead a few more, 0.944 is about optimum
 « Next Oldest | Next Newest »

 Messages In This Thread Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 10-23-2021, 02:49 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-25-2021, 01:29 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 10-26-2021, 02:12 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-26-2021, 09:47 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-26-2021, 08:28 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-29-2021, 02:16 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-01-2021, 10:42 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 11-02-2021, 12:28 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-27-2021 05:12 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-04-2021, 08:35 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Ren - 10-26-2021, 02:13 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - floppy - 10-26-2021, 03:04 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-26-2021, 03:24 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 10-26-2021, 03:58 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Ren - 10-27-2021, 01:32 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 10-31-2021, 03:40 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-05-2021, 03:55 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-01-2021, 12:56 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Gerson W. Barbosa - 11-01-2021, 05:04 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-03-2021, 12:38 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-03-2021, 01:14 AM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-03-2021, 11:28 PM RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-04-2021, 10:42 PM

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