Plane Geometry - Bruce E. Shapiro

Plane Geometry - Bruce E. Shapiro Plane Geometry - Bruce E. Shapiro

bruce.shapiro.com
from bruce.shapiro.com More from this publisher
10.07.2015 Views

246 SECTION 44. ESTIMATING πTable 44.1: Error in π k,j+1 using Van Wijngaarden’s method. The numbersgive the base-ten logarithm of the relative error.0 1 2 3 4 5 6 7 8 9 100 0.6 0.8 1. 1.1 1.2 1.3 1.3 1.4 1.5 1.5 1.51 1.2 1.6 1.9 2.1 2.3 2.4 2.6 2.7 2.8 2.8 2.92 1.7 2.2 2.6 2.9 3.1 3.3 3.5 3.7 3.8 3.9 4.03 2.2 2.8 3.2 3.6 3.9 4.1 4.3 4.5 4.7 4.9 5.04 2.6 3.3 3.8 4.2 4.5 4.8 5.1 5.3 5.5 5.7 5.95 3.0 3.8 4.3 4.8 5.1 5.5 5.8 6.0 6.3 6.5 6.76 3.4 4.2 4.8 5.3 5.7 6.1 6.4 6.7 7.0 7.2 7.57 3.8 4.6 5.3 5.8 6.3 6.7 7.0 7.3 7.6 7.9 8.28 4.2 5.0 5.7 6.3 6.8 7.2 7.6 8.0 8.3 8.6 8.89 4.5 5.4 6.2 6.8 7.3 7.7 8.2 8.5 8.9 9.2 9.510 4.9 5.8 6.6 7.2 7.8 8.3 8.7 9.1 9.5 9.8 10.1BBP FormulasThe BBP formula, discovered in 1995, allows the computation of the n thdigit of π without knowing any of the first n − 1 digits. 5 The formula is:π =∞∑n=0Å 48n + 1 − 28n + 4 −18n + 5 − 1 ã Å ã 1 n8n + 6 16The algorithm is implemented as follows. LetThenS n =∞∑k=0116 k (8k + j)π = 4S 1 − 2S 4 − S 5 − S 65 Bailey, D. H.; Borwein, P. B.; and Plouffe, S. ”On the Rapid Computation of VariousPolylogarithmic Constants.” Math. Comput. 66, 903-913, 1997, which is availableat http://crd.lbl.gov/~dhbailey/dhbpapers/digits.pdf. For details on the numericalimplementation on computing π, see http://crd.lbl.gov/~dhbailey/dhbpapers/bbp-alg.pdf« CC BY-NC-ND 3.0. Revised: 18 Nov 2012

SECTION 44. ESTIMATING π 247Define the notation{x} = x mod 1, the fractional part of x. Then{ n}∑{16 n 16 n−k ∞S p } =8k + p +∑ 16 n−k8k + pk=0k=n+1{ n{∑ 16 n−k , 8k + p }=8k + pk=0}∞∑ 16 n−k+8k + pDefines p (n) =k=n+1{ n∑ 16 n−k , 8k + p }k=0Then the n th hex-digit of π is given by8k + pd n = ⌊16 {4{s 1 (n)}2{s 4 (n)} − {s 5 (n)}−{s 6 (n)}}⌋where ⌊x⌋ denotes the greatest integer less than or equal to x. The followinggives a Mathematica implementation:s[p_, n_]:= Sum[Mod[16^(n-k), 8k+p]/(8k+p),{k,0,n}];r[p_, n_]:= Mod[s[p,n],1];hexit[n_]:= Floor[16.0*Mod[4r[1,n]-2r[4,n]-r[5,n]-r[6,n], 1]];Thenhexit/@Range[0,11]gives the first 12 hex figures to the right hand side of the radix point:{2, 4, 3, 15, 6, 10, 8, 8, 8, 5, 10, 3}which corresponds toπ − 3 ≈ .243F 6A88 85A3 16The correct value of in hex to 16 figures isπ ≈ 3.243F 6A88 85A3 08D3 16To convert the number back to decimal, divide each integer by its correspondingpower of 16.Revised: 18 Nov 2012 « CC BY-NC-ND 3.0.

246 SECTION 44. ESTIMATING πTable 44.1: Error in π k,j+1 using Van Wijngaarden’s method. The numbersgive the base-ten logarithm of the relative error.0 1 2 3 4 5 6 7 8 9 100 0.6 0.8 1. 1.1 1.2 1.3 1.3 1.4 1.5 1.5 1.51 1.2 1.6 1.9 2.1 2.3 2.4 2.6 2.7 2.8 2.8 2.92 1.7 2.2 2.6 2.9 3.1 3.3 3.5 3.7 3.8 3.9 4.03 2.2 2.8 3.2 3.6 3.9 4.1 4.3 4.5 4.7 4.9 5.04 2.6 3.3 3.8 4.2 4.5 4.8 5.1 5.3 5.5 5.7 5.95 3.0 3.8 4.3 4.8 5.1 5.5 5.8 6.0 6.3 6.5 6.76 3.4 4.2 4.8 5.3 5.7 6.1 6.4 6.7 7.0 7.2 7.57 3.8 4.6 5.3 5.8 6.3 6.7 7.0 7.3 7.6 7.9 8.28 4.2 5.0 5.7 6.3 6.8 7.2 7.6 8.0 8.3 8.6 8.89 4.5 5.4 6.2 6.8 7.3 7.7 8.2 8.5 8.9 9.2 9.510 4.9 5.8 6.6 7.2 7.8 8.3 8.7 9.1 9.5 9.8 10.1BBP FormulasThe BBP formula, discovered in 1995, allows the computation of the n thdigit of π without knowing any of the first n − 1 digits. 5 The formula is:π =∞∑n=0Å 48n + 1 − 28n + 4 −18n + 5 − 1 ã Å ã 1 n8n + 6 16The algorithm is implemented as follows. LetThenS n =∞∑k=0116 k (8k + j)π = 4S 1 − 2S 4 − S 5 − S 65 Bailey, D. H.; Borwein, P. B.; and Plouffe, S. ”On the Rapid Computation of VariousPolylogarithmic Constants.” Math. Comput. 66, 903-913, 1997, which is availableat http://crd.lbl.gov/~dhbailey/dhbpapers/digits.pdf. For details on the numericalimplementation on computing π, see http://crd.lbl.gov/~dhbailey/dhbpapers/bbp-alg.pdf« CC BY-NC-ND 3.0. Revised: 18 Nov 2012

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!