This is not directly a math question but rather a question on computing error.
I am looking for ways to perform calculation involving 100s of decimal places (especially for, but not limited to, this problem statement)
One well known library for high precision calculation in Python is mpmath which is used for floating-point arithmetic with arbitrary precision. So to test its accuracy I calculated the value of $\zeta(2)$ to 200 decimal places using mpmath and compared the result with that from wolframalpha.com as shown in the code below. They agreed only to 16 decimal places. Comparing against the known value of $\pi$ to 200 decimal places, I found that wolframalpha.com was accurate to 200 decimal places whereas mpmath stops being accurate after the 16th decimal place. So clearly the arbitrary precision of mpmath is not at reliable. So mpmath is not as accurate as it is said to be.
Question: How do we calculate decimals to 100s decimal places accurately in pure Python (not SageMath?
Python Code:
%%time
import mpmath
mp.dps = 200; mp.pretty = True
Value from mpmath
z1 = zeta(2)
Value from wolframalpha.com
z2 = 1.64493406684822643647241516664602518921894990120679843773555822937000747040320087383362890061975870530400431896233719067962872468700500778793510294633086627683173330936776260509525100687214005479681155879489036082327776191984075645587696323563670971009694890
Error
z1 - z2
z1 = zeta(2)possibly forcing to a double. What do you get with justzeta(2)? https://mpmath.org/doc/current/functions/zeta.html suggests it would start1.6449340668482264364724151666460251892189499012067like your Wolfram Alpha value – Henry Mar 27 '23 at 08:59