New Directions For π

.  The Classical Theory of π

PiInscribed[n_]:=(1/2) n Sin[((2 π)/n)]
PiCircumscribed[n_]:=n Tan[(π/n)]
ErrorArch[n_]:=Abs[π-((PiInscribed[n]+PiCircumscribed[n])/2.)]

sizes=3 (2^(Range[5]));
Grid[Prepend[Transpose[{sizes,N[PiInscribed[sizes]],N[PiCircumscribed[sizes]],ErrorArch[sizes]}],{Sides,Inscribed,Circumscribed,Error}],Dividers->All]

HuygensIn[n_]:=(1/3) (4 PiInscribed[n]-PiInscribed[(n/2)])
HuygensOut[n_]:=(1/3) (4 PiCircumscribed[n]-PiCircumscribed[(n/2)])
ErrorHuygens[n_]:=Abs[π-((HuygensIn[n]+HuygensOut[n])/2.)]

sizes=3 (2^(Range[5]));
Grid[Prepend[Transpose[{sizes,N[HuygensIn[sizes]],N[HuygensOut[sizes]],ErrorHuygens[sizes]}],{Sides,Inscribed,Circumscribed,Error}],Dividers->All]

RombergArray[data_]:=(power=1;NestList[(power*=4;((power Rest[#]-Drop[#,-1])/(power-1)))&,data,Length[data]-1])
Grid[N[RombergArray[PiInscribed[{6,12,24,48,96}]],12], BaseStyle->FontFamily->"Times", Dividers->{{Thick,1,1,1,1,Thick},{Thick,1,1,1,1,Thick}}, Background->GrayLevel[0.9]]

Grid[N[RombergArray[PiCircumscribed[{6,12,24,48,96}]],12], BaseStyle->FontFamily->"Times", Dividers->{{Thick,1,1,1,1,Thick},{Thick,1,1,1,1,Thick}}, Background->GrayLevel[0.9]]

Grid[Transpose[
Prepend[Transpose[Prepend[(PadRight[#1,5]&)/@Round[Log[10,Abs[π-RombergArray[PiInscribed[{6,12,24,48,96}]]]]],3 (2^(Range[5]))]],Prepend[Range[5],""]]],Dividers->All]

(∑_(n=0)^∞)((((-1))^n)/(2 n+1))

(∑_(n=0)^∞)((((-1))^n)/(2 n+1))(x^(2n+1))

Arg[(((5+I))^4)(((239+I))^(-1))]

ArcTan[1]+ArcTan[2]+ArcTan[3]//FullSimplify

FullSimplify[4 ArcTan[(1/5)]-ArcTan[(1/239)]]

FullSimplify[48 ArcTan[(1/18)]+32 ArcTan[(1/57)]-20 ArcTan[(1/239)]]

N[ArithmeticGeometricMean[1,2]]

a[0]=N[1,500];
b[0]=N[(1/(Sqrt[2])),500];
b[0]=(1/(Sqrt[2]));
a[n_]:=Mean[{a[n-1],b[n-1]}];
b[n_]:=GeometricMean[{a[n-1],b[n-1]}]
 πApprox[n_]:=((4 ((a[n+1])^2))/(1-(∑_(j=1)^n)((2^(j+1)) (((a[j])^2)-((b[j])^2)))))
LogError[n_] := Round[-Log[10,Abs[π-πApprox[n]]]]

Table[LogError[n],{n,6}]

ListPlot[Table[{n,LogError[n]},{n,7}],PlotStyle->{Black,PointSize[0.02]},Frame->True,FrameLabel->{Terms,"Number of Digits"},FrameTicks->{Range[7],Range[0,500,100],None,None}]

.  The Postmodern Theory of π

d=20;
BaseForm[N[FractionalPart[N[π (16^(d-1)),3 d]]],16]

Take[First[RealDigits[N[π,50],16]],{d+1,d+6}]

DigitExtractor::"usage"="DigitExtractor[d, b, coeffs] gives five digits starting with the dth of the real number given by a series of Bailey-Borwein-Plouffe type: Let m be the length of coeffs; then the series is: (∑_1^∞)(1/(b^k))(coeffs · (1/((m^k) + Range[m])) . The first digit beyond the \"decimal\" point is considered to be the first digit.";

DigitExtractor[d_,b_,coeffs_List]:=Module[{mainSum=0,
			n=d-1,s=Sign[b],base=Abs[b],nc=N[coeffs],rd,m=Length[coeffs]},
		mainSum=Sum[FractionalPart[mainSum+(s^k) nc.Table[
				If[coeffs[[i]]==0,0,((N[PowerMod[base,n-k,k m+i]])/(k m+i))],{i,m}]],{k,0,n}];rd=RealDigits[FractionalPart[mainSum+(∑_(k=n+1)^(n+15))(s^k) nc . ((base^(n-k))/(k m+Range[m]))],base];
Take[Join[Array[0 &,-rd[[2]]],rd[[1]]],5]]

DigitExtractor[0,16,{4,0,0,-2,-1,-1,0,0}]

BaseForm[N[π],16]

DigitExtractor[1000,16,{4,0,0,-2,-1,-1,0,0}]

RealDigits[N[π,1300],16][[1,Range[1001,1005]]]

DigitExtractor[(10^6),16,{4,0,0,-2,-1,-1,0,0}]

.  A Most Depressing Proof

PiBBP=Expand[(∑_(k=0)^∞)(1/(16^k))((4/(8 k+1))-(2/(8 k+4))-(1/(8 k+5))-(1/(8 k+6)))]

FullSimplify[PiBBP]

g[i_,n_,s_:1]:=(2^(i/2)) (∫_0^(1/(Sqrt[2])))((∑_(k=0)^∞)(s^k) (z^(2 n k+i-1)))\[DifferentialD]z;

Simplify[(2^(i/2)) ∫(s^k) (z^(2 n k+i-1))\[DifferentialD]z/.z->(1/(Sqrt[2]))]/.(2^(-k n))->((((2^n)))^(-k))

N[4 g[1,4]-2 g[4,4]-g[5,4]-g[6,4]]

g[2,4]

BBP=4 g[1,4]-2 g[4,4]-g[5,4]-g[6,4]

BBP=Expand[BBP]

BBP//FullSimplify

Clear[a];A= Table[(Subscript[a, i]),{i,8}];
rawBBP = Simplify[A . Table[g[i,4],{i,8}]]

simplerBBP=PowerExpand[rawBBP]/.ArcCot[(1/2)]->ArcTan[2]

GetTranscendentals[expr_]:=Union[Cases[expr,π|_ArcTan|_Log|_ArcCot | _ArcCoth,∞]]
transcs=GetTranscendentals[simplerBBP]

collectedBBP=Collect[simplerBBP,transcs,Factor]

coeffs=Table[Coefficient[collectedBBP,t],{t, transcs}]

solution=Sort[ToRules[Reduce[coeffs=={1,0,0,0,0,0,0}]]]

aVals=A/.solution/.(Subscript[a, 7])->r

aVals/.r->0

aVals/.r->-(1/2)

A/.ToRules[Reduce[coeffs=={0,0,0,0,0,0,0}]]/.(Subscript[a, 7])->r

.  Variations on the Theme

n=2;
A=Table[(Subscript[a, i]),{i,2 n}];
rawCase2=A . Array[g[#,n,-1]&,2 n]

rawCase2=rawCase2/.ArcTan[(1/2)]->(π/2)-ArcTan[2]

simplerCase2=PowerExpand[rawCase2]

transcs = GetTranscendentals[simplerCase2]

collected = Collect[simplerCase2, transcs]

coeffs=Table[Coefficient[collected,t], {t, transcs}]

(coeffMatrix=Normal[CoefficientArrays[coeffs,A]][[2]])//MatrixForm

Inverse[coeffMatrix]//MatrixForm

N[Log[5] - (∑_(k=0)^30)((((-1))^k)/(4^k))((2/(4 k+1))-(1/(4 k+3)))]

(∑_(k=0)^∞)((((-1))^k)/(4^k))((2/(4 k+1))-(1/(4 k+3))) //FullSimplify