Print["__________________________________________________"] Print["PART 1: Generating Fig. 1."] (* Define the function f(z) by right side of equation (15). *) f[z_]:=ArcTan[1/Floor[z]]+ArcTan[(Floor[z]-z)/(1+z*Floor[z])]; (* Generate the plot. *) p1=Plot[{ArcTan[1/z],f[z]}, {z,-2*Pi,2*Pi},AxesLabel->{"z","f(z)"}, PlotStyle->{{Black,Dashed,Thin},Blue}]//Quiet; p2=ListPlot[{{{0, -Pi/2}},{{1, Pi/4}}}, PlotMarkers->{"OpenMarkers","\[FilledCircle]"}, PlotStyle->{Blue,Blue}]; Labeled[Show[p1,p2], "Fig. 1. Function f(z) undefined at 0\[LessEqual]z<1."] Print["__________________________________________________"] Print["PART 2: Equation (16)."] Pi/4==32*ArcTan[1/40]+ ArcTan[-38035138859000075702655846657186322249216830232319/ 2634699316100146880926635665506082395762836079845121] Print["__________________________________________________"] Print["PART 3: Equations (17), (18) and (19)."] trueList1={ (* Equation (17) *) Pi/4==32*ArcTan[1/40]-ArcTan[1/70]+ ArcTan[-27760404029858418259273600496960161682342036417209/ 184466987265869281740567152432082954025647742419390789], (* Equation (18) *) Pi/4==32*ArcTan[1/40]-ArcTan[1/70]-ArcTan[1/6645]+ ArcTan[-448756269953796152961435108660176757544786481508/ 612891579071052703512243493592395863230295465359444105057], (* Equation (19) *) Pi/4==32*ArcTan[1/40]-ArcTan[1/70]-ArcTan[1/6645]-ArcTan[1/1365756025]+ ArcTan[-374870864016658098706770220951460879098657980643/ 837060366788054133363141482594659697353287103005016334677117199933] }; Print[trueList1] Print["__________________________________________________"] Print["PART 4: Equations (22), (23) and (24)."] trueList2={ (* Equation 22 *) Pi/4==8*ArcTan[1/10]-ArcTan[1758719/147153121], (* Equation 23 *) Pi/4==8*ArcTan[1/10]-ArcTan[1/84]-ArcTan[1/21342]- ArcTan[266167/263843055464261], (* Equation 24 *) Pi/4==8*ArcTan[1/10]-ArcTan[1/84]-ArcTan[1/21342]- ArcTan[1/991268848]-ArcTan[1/193018008592515208050]- ArcTan[1/197967899896401851763240424238758988350338]- ArcTan[1/11757386816817535293027775284419412676799191500\ 8537018836932014293678271636885792397] }; Print[trueList2] Print["__________________________________________________"] Print["PART 5: Generating Table 1."] (* Nested radicals *) a[0]:=a[0]=0; a[k_]:=a[k]=Sqrt[2+a[k-1]]; (* Computing integer A_k *) A[k_]:=A[k]=Floor[a[k]/Sqrt[2-a[k-1]]]; (* Two-step iteration *) p[1,k_]:=p[1,k]=(A[k]^2-1)/(A[k]^2+1); q[1,k_]:=q[1,k]=(2*A[k])/(A[k]^2+1); p[n_,k_]:=p[n,k]=p[n-1,k]^2-q[n-1,k]^2; q[n_,k_]:=q[n,k]=2*q[n-1,k]*p[n-1,k]; (* Initial number for iteration *) B[1,k_]:=B[1,k]=p[k,k]/(1-q[k,k]); (* Main iteration formula *) B[n_,k_]:=B[n,k]=(1+Floor[B[n-1,k]]*B[n-1,k])/(Floor[B[n-1,k]]-B[n-1,k]); (* Approximation (27) *) eq27[M_,k_]:=eq27[M, k]=2^(k - 1)* ArcTan[1/A[k]]+Sum[ArcTan[1/Floor[B[m, k]]],{m,1,M}]+1/B[M+1,k]; k := 6; (* integer k *) M := 0; (* initial value for iteration *) maxM := 12; str = {{"Integer M", " | ","Correct digits of pi"}}; While[M<=maxM, AppendTo[str,{M," | ", Abs[MantissaExponent[ SetPrecision[Pi-4*eq27[M,k], If[M<5,100,2^(M+3)]]][[2]]]}];M++]; Print[TableForm[str]]; Print["__________________________________________________"] Print["PART 6: Equations (33), (34) and (35)."] trueList3={ (* Equation (33) *) Pi/4==8*ArcTan[20/203]-ArcTan[1033248635280959/4239006656613482881], (* Equation (34) *) Pi/4==8*(ArcTan[1/10]-ArcTan[1/684]-ArcTan[2/1402203])- ArcTan[1033248635280959/4239006656613482881], (* Equation (35) *) Pi/4==8*(ArcTan[1/10]-ArcTan[1/684]-ArcTan[1/701102]- ArcTan[1/983087327708])-ArcTan[1033248635280959/4239006656613482881] }; Print[trueList3];