Posts Tagged ‘pi approximations’

Shanks’ approximation to pi

In “Pi Approximations“, line 58, Weisstein mentions one by Shanks (1982) that differs by a mere 10^{-82} as,

\pi \approx \frac{6}{\sqrt{3502}}\, \ln(2u)

where u is “…a product of four simple quartic units”. Frustratingly, he doesn’t give u but I eventually found the primary source online. Hence,

u = \big(a+\sqrt{a^2-1}\big)^2 \big(b+\sqrt{b^2-1}\big)^2 (c+\sqrt{c^2-1}) (d+\sqrt{d^2-1})


\begin{aligned}a &= \tfrac{1}{2}\, (23+4\sqrt{34}\,)\\ b &= \tfrac{1}{2}\, (19\sqrt{2}+7\sqrt{17}\,)\\ c &= 429+304\sqrt{2}\\ d &= \tfrac{1}{2}\,(627+442\sqrt{2}\,) \end{aligned}

with a slight modification by this author since Shanks didn’t realize the first two quartic factors were in fact squares.  (The product of the last two factors is also a square.)

A cute thing about these numbers is that their defining polynomials are palindromic, the same read forward or backward.  For example, the first factor (unsquared) is the root of,

x^4-46x^3-13x^2-46x+1 = 0

Author’s note:  Daniel Shanks (1917-96) was a mathematician best known as the first to calculate pi up to 100,000 decimal places, as well as for his book, Solved and Unsolved Problems in Number Theory.

In general, Shanks’ approximation belongs to the family,

\begin{aligned} e^{\pi\sqrt{2m}} &\approx \left(\tfrac{\eta(\frac{1}{2}\sqrt{-2m})}{\eta(\sqrt{-2m})}\right)^{24}\\ &\approx 2^6 x^{k}\end{aligned}

where \eta is the Dedekind eta function and, for m a positive odd integer, then x is an algebraic integer that is the root of an equation P(x) with palindromic (if unsigned) coefficients.  For appropriate k, then P(x) has degree equal to the class number h(-2m).  Furthermore, it is solvable in radicals.  

For example, given prime m, with 2m = {10, 14, 26} which has class number 2, 4, 6, respectively, then k = 12 and,

\begin{aligned} x_{10}&\; \text{is a root of}\, x^2-x-1 =0\\ x_{14}&\;\text{is a root of}\, x^4-2x^3+x^2-2x+1 = 0\\ x_{26}&\;\text{is a root of}\, x^6-2x^5-2x^4+2x^2-2x-1 = 0 \end{aligned}

and so on.  It then is a simple matter to take the natural logarithm of both sides to bring down pi and have a relation of form,

\pi \approx \frac{1}{\sqrt{2m}} \ln(2^6 x^{k})

Shanks chose 2m = 3502 since d = 4(2m) is the largest fundamental discriminant d divisible by 4 with class number h(-d) = 16.  Here is a list of of d with small class number.  You can calculate it (among many other things) in simply as,


Ramanujan’s pi approximations and Pell equations

Ramanujan gave many fascinating formulas and approximations to pi. Using one of his examples, we can give its family. First, define the fundamental units,

U_{2} = 1+\sqrt{2}

U_{29} = \frac{5+\sqrt{29}}{2}

U_{58} = 99+13\sqrt{58}

U_{174} = 1451+110\sqrt{174}

These are involved in fundamental solutions to Pell equations.  For example, for x^2-58y^2 = -1, it is {x, y} = {99, 13}, (see the values above), while for x^2-174y^2 = 1 it is {x, y} = {1451, 110}. Using these solutions to Pell equations, then,

\pi \approx \frac{1}{\sqrt{58}} \ln \Big[ 2^6 (U_{29})^{12} \Big]

\pi \approx \frac{1}{2\sqrt{58}} \ln \left[ 2^9 \left((U_2)^3 U_{29} \sqrt{U_{58}} \,\right)^6 \right]

\pi \approx \frac{1}{3\sqrt{58}} \ln \left[ 2^6 (U_{29})^{12} (U_{174})^2 \left( \sqrt{\frac{9+3\sqrt{6}}{4} } + \sqrt{\frac{5+3\sqrt{6}}{4}}\right)^{24}\right]

\pi \approx \frac{1}{4\sqrt{58}} \ln \Big[ 2^9 \left((U_2)^3 U_{29} \sqrt{2U_{58}} \,\right)^3 \left(\sqrt{v+1} +\sqrt{v}\right)^{12}\Big]


v = 2^{-1/2}(U_2)^6(U_{29})^3

Nice, isn’t it?  The second to the last approximation is by Ramanujan which is accurate to 31 digits, while the last is by this author and is accurate to 42 digits.  (Can anyone find a nice expression for the next step? )  The expression inside the log function is the exact value of,


where \eta(\tau) is the Dedekind eta function, and \tau = \frac{\sqrt{-58}}{2}, \tau = \frac{2\sqrt{-58}}{2}\tau = \frac{3\sqrt{-58}}{2}\tau = \frac{4\sqrt{-58}}{2}, respectively.

The fundamental discriminant d = -4∙58 has class number h(d) = 2.  Another one with the same class number is d = -4∙37.  Hence, given,

U_{37} = 6+\sqrt{37}

U_{111} = 295+28\sqrt{111}


\pi \approx \frac{1}{\sqrt{37}} \ln \Big[ 2^6 (U_{37})^{6} \Big]

\pi \approx \frac{1}{3\sqrt{37}} \ln \left[ 2^6 (U_{37})^{6} (U_{111})^2 \left( \sqrt{\frac{37+20\sqrt{3}}{4} } + \sqrt{\frac{33+20\sqrt{3}}{4}}\right)^{12}\right]

where the expression inside the log function is now the absolute value of the eta quotient at \tau = \frac{1+\sqrt{-37}}{2} and \tau = \frac{1+3\sqrt{-37}}{2}.