Post Reply 
Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
11-04-2021, 08:35 PM (This post was last modified: 11-05-2021 05:01 PM by Albert Chan.)
Post: #21
RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B]
(10-27-2021 05:12 PM)Albert Chan Wrote:  (*) 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

Let's get generalized CF convergents from the top down, instead of bottom up.

I set c=8.0, to reduce expensive symbolic calculations (setting c=2.0 will get ¼th as big)
Also, I use x = n+0.5 instead of N = n+0.5, to match Decimal Basic code.
Warning: Decimal Basic is case-insensitive, N and n are the same variable.

XCas> nextv(v, cf) := [v[1], normal(cf*v)] // 2nd row = next convergent

XCas> v := identity(2)          // initial b convergents, start with 1/0, b0/1 = 0/1
XCas> c, n, x2 := 8.0, x-0.5, x*x

XCas> v := nextv(v, [(n+=1)^4, (c:=10-c)*(x2+=x)]):; e2r(quo(v[1]))

[0.5, 0.5, 0.25]                    // b = horner([0.5, 0.5, 0.25], n+0.5)

Repeat the last command, we have:

[0.470588235294, 0.387543252595, 0.0976999796458]
[0.472222222222, 0.401234567901, 0.141117969822]
[0.472131147541, 0.399892502016, 0.133170617805]
...
[0.472135955, 0.4, 0.13416407865] // converged 12 digits

Guessing that coefficients are somehow related to ϕ, above is likely this:

lua> r = sqrt(5) -- = 2*phi - 1
lua> 2*(r-2), 0.4, 0.06*r
0.4721359549995796       0.4       0.1341640786499874

Let's test this, for Decimal Basic version of zeta2(n)
Code:
OPTION ARITHMETIC DECIMAL_HIGH
10 INPUT  PROMPT "n = ":n
   LET c = MOD(n,2)*6+2   
   LET x = n+0.5
   LET x2 = x*x
   LET a = 0
   LET b = SQR(5)
   LET b = (4*(b-2)*x2+0.8*x+0.12*b)/(10-c)
   FOR i = n TO 2 STEP -1
      LET t = i*i
      LET a = 1/t + a
      LET b = t*t / (c*x2+b)
      LET c = 10-c
      LET x2 = x2-x
   NEXT i   
   LET z2 = 1/(x+1/(c*x2+b)) + a + 1
   PRINT "Accurate digits ="; 1-LOG10(ABS(PI*PI/6-z2))
   GOTO 10
END

n = 100
Accurate digits = 217.89547073326986
n = 101
Accurate digits = 219.99818460987848
n = 102
Accurate digits = 222.10077322982628
n = 400
Accurate digits = 846.6549411985644
n = 401
Accurate digits = 848.74806270861004
n = 402
Accurate digits = 850.84117615610204

For n=474, it reached 1000 digits full precision.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Evaluation of ζ(2) by the definition (sort of) [HP-42S & HP-71B] - Albert Chan - 11-04-2021 08:35 PM



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