kb/data/en.wikipedia.org/wiki/Approximations_of_pi-8.md

1220 lines
23 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
title: "Approximations of pi"
chunk: 9/10
source: "https://en.wikipedia.org/wiki/Approximations_of_pi"
category: "reference"
tags: "science, encyclopedia"
date_saved: "2026-05-05T16:19:48.727542+00:00"
instance: "kb-cron"
---
π
2
=
n
=
0
arctan
1
F
2
n
+
1
=
arctan
1
1
+
arctan
1
2
+
arctan
1
5
+
arctan
1
13
+
{\displaystyle {\frac {\pi }{2}}=\sum _{n=0}^{\infty }\arctan {\frac {1}{F_{2n+1}}}=\arctan {\frac {1}{1}}+\arctan {\frac {1}{2}}+\arctan {\frac {1}{5}}+\arctan {\frac {1}{13}}+\cdots }
and
π
4
=
k
2
arctan
2
a
k
1
a
k
,
{\displaystyle {\frac {\pi }{4}}=\sum _{k\geq 2}\arctan {\frac {\sqrt {2-a_{k-1}}}{a_{k}}},}
where
F
n
{\displaystyle F_{n}}
is the n-th Fibonacci number. However, these two formulae for
π
{\displaystyle \pi }
are much slower in convergence because of set of arctangent functions that are involved in computation.
==== Arcsine ====
Observing an equilateral triangle and noting that
sin
(
π
6
)
=
1
2
{\displaystyle \sin \left({\frac {\pi }{6}}\right)={\frac {1}{2}}}
yields
π
=
6
sin
1
(
1
2
)
=
6
(
1
2
+
1
2
3
2
3
+
1
3
2
4
5
2
5
+
1
3
5
2
4
6
7
2
7
+
)
=
3
16
0
1
+
6
16
1
3
+
18
16
2
5
+
60
16
3
7
+
=
n
=
0
3
(
2
n
n
)
16
n
(
2
n
+
1
)
=
3
+
1
8
+
9
640
+
15
7168
+
35
98304
+
189
2883584
+
693
54525952
+
429
167772160
+
{\displaystyle {\begin{aligned}\pi &=6\sin ^{-1}\left({\frac {1}{2}}\right)=6\left({\frac {1}{2}}+{\frac {1}{2\cdot 3\cdot 2^{3}}}+{\frac {1\cdot 3}{2\cdot 4\cdot 5\cdot 2^{5}}}+{\frac {1\cdot 3\cdot 5}{2\cdot 4\cdot 6\cdot 7\cdot 2^{7}}}+\cdots \!\right)\\&={\frac {3}{16^{0}\cdot 1}}+{\frac {6}{16^{1}\cdot 3}}+{\frac {18}{16^{2}\cdot 5}}+{\frac {60}{16^{3}\cdot 7}}+\cdots \!=\sum _{n=0}^{\infty }{\frac {3\cdot {\binom {2n}{n}}}{16^{n}(2n+1)}}\\&=3+{\frac {1}{8}}+{\frac {9}{640}}+{\frac {15}{7168}}+{\frac {35}{98304}}+{\frac {189}{2883584}}+{\frac {693}{54525952}}+{\frac {429}{167772160}}+\cdots \end{aligned}}}
with a convergence such that each additional five terms yields at least three more digits.
== Digit extraction methods ==
The BaileyBorweinPlouffe formula (BBP) for calculating π was discovered in 1995 by Simon Plouffe. Using a spigot algorithm, the formula can compute any particular base 16 digit of π—returning the hexadecimal value of the digit—without computing the intervening digits.
π
=
n
=
0
(
4
8
n
+
1
2
8
n
+
4
1
8
n
+
5
1
8
n
+
6
)
(
1
16
)
n
{\displaystyle \pi =\sum _{n=0}^{\infty }\left({\frac {4}{8n+1}}-{\frac {2}{8n+4}}-{\frac {1}{8n+5}}-{\frac {1}{8n+6}}\right)\left({\frac {1}{16}}\right)^{n}}
In 1996, Plouffe derived an algorithm to extract the nth decimal digit of π (using base 10 math to extract a base 10 digit), and which can do so with an improved speed of O(n3(log n)3) time. The algorithm does not require memory for storage of a full n-digit result, so the one-millionth digit of π could in principle be computed using a pocket calculator. (However, it would be quite tedious and impractical to do so.)
π
+
3
=
n
=
1
n
2
n
n
!
2
(
2
n
)
!
{\displaystyle \pi +3=\sum _{n=1}^{\infty }{\frac {n2^{n}n!^{2}}{(2n)!}}}
The calculation speed of Plouffe's formula was improved to O(n2) by Fabrice Bellard, who derived an alternative formula (albeit only in base 2 math) for computing π.
π
=
1
2
6
n
=
0
(
1
)
n
2
10
n
(
2
5
4
n
+
1
1
4
n
+
3
+
2
8
10
n
+
1
2
6
10
n
+
3
2
2
10
n
+
5
2
2
10
n
+
7
+
1
10
n
+
9
)
{\displaystyle \pi ={\frac {1}{2^{6}}}\sum _{n=0}^{\infty }{\frac {(-1)^{n}}{2^{10n}}}\left(-{\frac {2^{5}}{4n+1}}-{\frac {1}{4n+3}}+{\frac {2^{8}}{10n+1}}-{\frac {2^{6}}{10n+3}}-{\frac {2^{2}}{10n+5}}-{\frac {2^{2}}{10n+7}}+{\frac {1}{10n+9}}\right)}
== Efficient methods ==
Many other expressions for π were developed and published by Indian mathematician Srinivasa Ramanujan. He worked with mathematician Godfrey Harold Hardy in England for a number of years.
Extremely long decimal expansions of π are typically computed with the GaussLegendre algorithm and Borwein's algorithm; the SalaminBrent algorithm, which was invented in 1976, has also been used.
In 1997, David H. Bailey, Peter Borwein and Simon Plouffe published a paper (Bailey, 1997) on a new formula for π as an infinite series:
π
=
k
=
0
1
16
k
(
4
8
k
+
1
2
8
k
+
4
1
8
k
+
5
1
8
k
+
6
)
.
{\displaystyle \pi =\sum _{k=0}^{\infty }{\frac {1}{16^{k}}}\left({\frac {4}{8k+1}}-{\frac {2}{8k+4}}-{\frac {1}{8k+5}}-{\frac {1}{8k+6}}\right).}
This formula permits one to fairly readily compute the kth binary or hexadecimal digit of π, without having to compute the preceding k 1 digits. Bailey's website contains the derivation as well as implementations in various programming languages. The PiHex project computed 64 bits around the quadrillionth bit of π (which turns out to be 0).
Fabrice Bellard further improved on BBP with his formula:
π
=
1
2
6
n
=
0
(
1
)
n
2
10
n
(
2
5
4
n
+
1
1
4
n
+
3
+
2
8
10
n
+
1
2
6
10
n
+
3
2
2
10
n
+
5
2
2
10
n
+
7
+
1
10
n
+
9
)
{\displaystyle \pi ={\frac {1}{2^{6}}}\sum _{n=0}^{\infty }{\frac {{(-1)}^{n}}{2^{10n}}}\left(-{\frac {2^{5}}{4n+1}}-{\frac {1}{4n+3}}+{\frac {2^{8}}{10n+1}}-{\frac {2^{6}}{10n+3}}-{\frac {2^{2}}{10n+5}}-{\frac {2^{2}}{10n+7}}+{\frac {1}{10n+9}}\right)}
Other formulae that have been used to compute estimates of π include:
π
2
=
k
=
0
k
!
(
2
k
+
1
)
!
!
=
k
=
0
2
k
k
!
2
(
2
k
+
1
)
!
=
1
+
1
3
(
1
+
2
5
(
1
+
3
7
(
1
+
)
)
)
{\displaystyle {\frac {\pi }{2}}=\sum _{k=0}^{\infty }{\frac {k!}{(2k+1)!!}}=\sum _{k=0}^{\infty }{\frac {2^{k}k!^{2}}{(2k+1)!}}=1+{\frac {1}{3}}\left(1+{\frac {2}{5}}\left(1+{\frac {3}{7}}\left(1+\cdots \right)\right)\right)}
Newton.