Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
10-25-2021, 01:29 PM (This post was last modified: 10-25-2021 07:16 PM by Albert Chan.)
Post: #2
 Albert Chan Senior Member Posts: 2,516 Joined: Jul 2018
RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
Code:
function zeta2(n)     local a, b, c, N, t = 0, 0, (n%2)*6+2, n+0.5     local N2 = N*N     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

This lua code loop from n down to 2 instead of n to 1.
Note: for n = 0, this return 1.4 instead of 2.

lua> for n=0,8 do print(n, zeta2(n)) end
0﻿ ﻿ ﻿ ﻿ ﻿ 1.4
1﻿ ﻿ ﻿ ﻿ ﻿ 1.6428571428571428
2﻿ ﻿ ﻿ ﻿ ﻿ 1.644949494949495
3﻿ ﻿ ﻿ ﻿ ﻿ 1.644933946685539
4﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340678010402
5﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668406054
6﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482877
7﻿ ﻿ ﻿ ﻿ ﻿ 1.644934066848226
8﻿ ﻿ ﻿ ﻿ ﻿ 1.6449340668482264

Convergence speed very impressive, n=8 converged to float(pi^2/6)
How did you derive the continued fraction form ?

I was reading Why pi^2 so close to 10 ? With pi^2 ≈ 10, pi^2/6 ≈ 5/3

5/3 = 1 + sum(4/(4*k^2-1), k=2..inf) ﻿ ﻿ ﻿ ﻿ ﻿ ﻿ // terms telescopically cancel, leaving only 5/3

ζ(2) = 1 + sum(1/k^2, k=2..inf)
5/3 - ζ(2) = sum(4/(4*k^2-1) - 1/k^2, k=2..inf)
ζ(2) = 5/3 - sum(1/(k^2*(4*k^2-1)), k=2..inf)

We might as well pull 1 term out. (pi^2/6 ≈ 9.9/6 = 1.65)

ζ(2) = 1.65 - sum(1/(k^2*(4*k^2-1)), k=3..inf)

With denominator of O(k^4), this converge much faster than ζ(2) "definition"
How can we accelerate this with continued fraction ?

---

This converge even faster, A cute sum of Ramanujan

zeta2(n) := (10 - sum(1/(k*(k+1))^3, k=1..n)) / 6
 « 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)