Esistono diversi metodi per il calcolo di π.
Metodi standard
Cerchi
π può essere ottenuto a partire da un cerchio di raggio ed area noti, essendo l'area data dalla formula:
che permette di calcolare esplicitamente π:
Se un cerchio di raggio r viene disegnato con il suo centro nel punto (0,0), qualsiasi punto la cui distanza dall'orifine sia minore o uguale a r sarà all'interno del cerchio. Il teorema di Pitagora dà la distanza di qualsiasi punto (x,y) dall'origine:
Il "foglio da disegno" matematico * costruito pensando quadrati di lato unitario centrati attorno ad ogni punto (x,y), dove x e y sono gli interi compresi fra -r e r. I quadrati i cui centri siano dentro o sulla circonferenza possono essere contati verificando per ciascuno se
Il numero di punti che soddisfano la condizione approssima allora l'area del cerchio, che può essere usata per calcolare un approssimazione di .
La formula può essere scritta come:
In altre parole, si comincia scegliendo un valore di r; si considerano tutti i punti (x,y) per i quali sia x sia y siano interi compresi fra −r and r. Partendo da zero, si aggiunge uno per ciascun punto la cui distanza dall'origine (0,0) sia minore o uguale a r. Al termine, si divide la somma così ottenuta — rappresentante l'area del cerchio di raggio r — per l'intero r2 per trovare un'approsimazione di π. Si ottengono migliori approssimazioni per valori maggiori di r.
Per esempio, se r è 5, allora i punti considerati sono:
(−5,5) (−4,5) (−3,5) (−2,5) (−1,5) (0,5) (1,5) (2,5) (3,5) (4,5) (5,5) (−5,4) (−4,4) (−3,4) (−2,4) (−1,4) (0,4) (1,4) (2,4) (3,4) (4,4) (5,4) (−5,3) (−4,3) (−3,3) (−2,3) (−1,3) (0,3) (1,3) (2,3) (3,3) (4,3) (5,3) (−5,2) (−4,2) (−3,2) (−2,2) (−1,2) (0,2) (1,2) (2,2) (3,2) (4,2) (5,2) (−5,1) (−4,1) (−3,1) (−2,1) (−1,1) (0,1) (1,1) (2,1) (3,1) (4,1) (5,1) (−5,0) (−4,0) (−3,0) (−2,0) (−1,0) (0,0) (1,0) (2,0) (3,0) (4,0) (5,0) (−5,−1) (−4,−1) (−3,−1) (−2,−1) (−1,−1) (0,−1) (1,−1) (2,−1) (3,−1) (4,−1) (5,−1) (−5,−2) (−4,−2) (−3,−2) (−2,−2) (−1,−2) (0,−2) (1,−2) (2,−2) (3,−2) (4,−2) (5,−2) (−5,−3) (−4,−3) (−3,−3) (−2,−3) (−1,−3) (0,−3) (1,−3) (2,−3) (3,−3) (4,−3) (5,−3) (−5,−4) (−4,−4) (−3,−4) (−2,−4) (−1,−4) (0,−4) (1,−4) (2,−4) (3,−4) (4,−4) (5,−4) (−5,−5) (−4,−5) (−3,−5) (−2,−5) (−1,−5) (0,−5) (1,−5) (2,−5) (3,−5) (4,−5) (5,−5)
I 12 punti (0,±5), (±5,0), (±3,±4), (±4,±3) sono esattamente sulla circonferenza, e ci sono 69 punti completamente all'interno, così l'area approssimata vale 81, e π vale in questa approssimazione 3.24. Risultati per diversi r sono riportati nella tabella seguente:
| r | Area | Approssimazione di π |
|---|---|---|
| 2 | 13 | 3.25 |
| 3 | 29 | 3.22222 |
| 4 | 49 | 3.0625 |
| 5 | 81 | 3.24 |
| 10 | 317 | 3.17 |
| 20 | 1257 | 3.1425 |
| 100 | 31417 | 3.1417 |
| 1000 | 3141549 | 3.141549 |
In modo simile, gli algoritmi più complessi riportati di seguito coinvolgono calcoli ripetuti di qualche tipo, e portano ad approssimazioni migliori al crescere del numero di calcoli.
Continued Fractions
Besides its simple continued-fraction representation [3; 7, 15, 1, 292, 1, 1, …], which displays no discernible pattern, π has many generalized continued-fraction representations generated by a simple rule, including these two.
(Other representations are available at The Wolfram Functions Site.)
Trigonometry
is the power series for arctan(x) specialized to . It converges too slowly to be of practical interest. However, the power series converges much faster for smaller values of , which leads to formulas where arises as the sum of small angles with rational tangents, such as this one by John Machin:
Formulas for pi of this type are known as Machin-like formulae.
Observing an equilateral triangle and noting that
yields
The Salamin-Brent algorithm
The Salamin-Brent algorithm was discovered independently by Richard Brent and Eugene Salamin in 1975. This can compute pi to N digits in time proportional to N log(N) log(log(N)), much faster than the trigonometric formulae.
Digit extraction methods
BBP formula (base 16)
The BBP(Bailey-Borwein-Plouffe) Formula for calculating pi was discovered in 1995 by Simon Plouffe. The formula computes pi in base 16 without needing to compute the previous digits (digit extraction). [1]
Bellard's improvement (base 64)
An alternative formula for computing pi in base 64 was derived by Fabrice Bellard. This makes computing binary digits of pi 43% faster. [2]
Extending to arbitrary bases
In 1996, Simon Plouffe derived an algorithm to calculate successive digits of pi in an arbitrary base in O(n3log(n)3) time. [3]
Improvement using the Gosper formula
In 1997, Fabrice Bellard improved Plouffe's formula for digit-extraction in an arbitrary base to reduce the runtime to O(n2). [4]
Projects
Pi Hex
Pi Hex computed binary bits of Pi over a distributed network employing several hundred computers. They distributed computation of single hexadecimal digits in the billionth's of places. Pi Hex ended in 2000 and since then their website has faded into history.
Background pi
Inspired by Pi Hex and Project Pi, Background Pi seeks to compute decimal digits of pi sequentially. The project has computed over a hundred thousand digits using spare CPU cycles. Background Pi is oriented to be more for an average end user than for a power user offering an unobtrusive user interface. Research is underway on the efficiency of converting computed hex digits to decimal as computing hex digits is faster than computing decimal. A new version is in development that would manage multiple computation projects in a friendlier interface than BOINC.
Collegamenti esterni
- Una prova del fatto che Pi è irrazionale
- Molte formule per π, dal sito della Wolfram Mathematics
- Una raccolta di formule di tipo Machin per i calcolo del pi greco
- Il pi-hacks Yahoo! Group
- PiHex Project
- ^ MathWorld: BBP Formula http://mathworld.wolfram.com/BBPFormula.html
- ^ Bellard's Website: http://fabrice.bellard.free.fr/pi/pi_bin/pi_bin.html
- ^ Simon Plouffe, On the computation of the n'th decimal digit of various transcendental numbers, November 1996
- ^ Bellard's Website: http://fabrice.bellard.free.fr/pi/pi_n2/pi_n2.html