An Iterative Method for Computing π by Argument Reduction of the Tangent Function
Abstract
:1. Introduction
2. Preliminaries
2.1. Machin-Like Formulas
- (* Define long string *)
- longStr = StringJoin["11757386816817535293027775284419412676",
- "7991915008537018836932014293678271636885792397"];
- coeff = (10 + I)^8*(84 + I)^-1*(21342 + I)^-1*
- (991268848 + I)^-1*(193018008592515208050 + I)^-1*
- (197967899896401851763240424238758988350338 + I)^-1*
- (FromDigits[longStr] + I)^-1;
- Re[coeff] == Im[coeff]
2.2. Tangent Function
2.3. Arctangent Function
3. Results and Discussion
3.1. Modified Iteration
3.2. Methodology
4. Mathematica Codes and Description
- atanF := {(* ARCTANGENT FUNCTION APPROXIMATION *)Clear[atan,g,h];(* Expansion coefficients *)g[1,x_] := g[1,x] = 2/x;h[1,x_] := h[1,x] = 1;g[m_,x_] := g[m,x] = g[m - 1,x]*(1 - 4/x^2) + 4*(h[m - 1,x]/x);h[m_,x_] := h[m,x] = h[m - 1,x]*(1 - 4/x^2) - 4*(g[m - 1,x]/x);(* Arctangent approximation *)atan[x_,n_] := atan[x,n] = 2*Sum[(1/(2*m - 1))*(g[m,x]/(g[m,x]^2 + h[m,x]^2)),{m,1,n}]};
- tanF:= {(*TANGENT FUNCTION APPROXIMATION*)Clear[p,q,r,t];(* Computing coefficients *)r[n_,x_] := r[n,x] = (-1)^n*(x^(2*n + 1)/(2*n + 1)!);p[0,x_] := p[0,x] = 0;q[0, x_] := q[0,x] = 0;p[n_,x_] := p[n,x] = p[n - 1,x] + r[n - 1,x];q[n_,x_] := q[n,x] = q[n - 1,x] + 2^(2*n - 1)*r[n - 1,x];(* Tangent approximation *)t[x_,n_] := t[x,n] = 2*(p[n,x]^2/q[n,x])};
- heading := {Print[Abs[MantissaExponent[Pi - 2^(k + 1)*\[Sigma][1]][[2]]],″ digits of \[Pi] before iteration″];Print[″-------------------------------″];Print[″Number of terms n″,″ | ″,″Digits of \[Pi]″];Print[″-------------------------------″]};ending:={Print[″-------------------------------″];Print[Abs[MantissaExponent[Pi - 2^(k + 1)*\[Sigma][2]][[2]]],″ digits of \[Pi] after iteration″]};
- Clear[k,f,\[Alpha],c,\[Sigma],\[Delta],\[Tau],n];(* Computing coefficient alpha *)k=4; f[x_,n_] = (2*I*(1 - I*x)^n)/((1 - I*x)^n + (1 + I*x)^n) - I;\[Alpha] = f[1/10,2^(k - 1)];(* Computing coefficient c *)atanF; c = atan[1/10,500];(* Iteration *)\[Sigma][1] = SetPrecision[Floor[Pi*10^100]/10^100,250]/2^(k + 1);\[Delta] = c - \[Sigma][1];n = 1;heading;While[n <= 42,tanF; \[Tau] = t[2^(k - 1)*\[Delta],n]; \[Sigma][2] =SetPrecision[\[Sigma][1] + (1 - (\[Alpha] - \[Tau])/(1 + \[Alpha]*\[Tau]))/2^k,5 + 5*n];piApp1 = 2^(k + 1)*\[Sigma][2];str=If[n < 10,″ | ″,″ | ″];If[n <= 5 || n >= 33,Print[n,str,Abs[MantissaExponent[Pi - piApp1][[2]]]]];If[n==6,Print[″... COMPUTING ...″]]; n++];ending;
- 100 digits of π before iteration--------------------------------------Number of terms n | Digits of π--------------------------------------1 | 52 | 93 | 144 | 195 | 25... COMPUTING ...33 | 16934 | 17435 | 17936 | 18437 | 18938 | 19439 | 19940 | 20041 | 20042 | 200--------------------------------------200 digits of π after iteration
- Clear[k,f,\[Alpha],c,\[Sigma],\[Delta],\[Tau],n];(* Computing coefficient alpha *)k=4; f[x_,n_] = (2*I*(1 - I*x)^n)/((1 - I*x)^n + (1 + I*x)^n) - I;(* Computing coefficient c *)\[Alpha] = f[1/10,2^(k - 1)]; \[Alpha] = (\[Alpha] - 1/84)/(1 + \[Alpha]/84);atanF; c = atan[1/10,500] - (1/2^(k - 1))*atan[1/84,500];(* Iteration *)\[Sigma][1] = SetPrecision[piApp1/2^(k + 1),500];\[Delta] = c-\[Sigma][1];n = 1;heading;While[n <= 42,tanF; \[Tau] = t[2^(k - 1)*\[Delta],n]; \[Sigma][2] =SetPrecision[\[Sigma][1] + (1 - (\[Alpha] - \[Tau])/(1 + \[Alpha]*\[Tau]))/2^k,12 + 10*n];piApp2 = 2^(k + 1)*\[Sigma][2];str=If[n < 10,″ | ″,″ | ″];If[n <=5 || n >= 33,Print[n,str,Abs[MantissaExponent[Pi - piApp2][[2]]]]];If[n == 6,Print[″... COMPUTING ...″]]; n++];ending;
- 200 digits of π before iteration--------------------------------------Number of terms n | Digits of π--------------------------------------1 | 122 | 213 | 314 | 415 | 51... COMPUTING ...33 | 34134 | 35135 | 36136 | 37137 | 38138 | 39139 | 40140 | 40241 | 40242 | 402--------------------------------------402 digits of π after iteration
- Clear[k,\[Alpha],c,\[Sigma],\[Delta],\[Tau],n];(* Computing coefficient alpha *)k = 27; \[Sigma][1] = SetPrecision[piApp2/2^(k + 1),1000];(* Computing coefficient c *)c = SetPrecision[atan[1/85445659,500],1000];(* Iteration *)\[Alpha] = t[2^(k - 1)*c,500];\[Delta] = c - \[Sigma][1];n = 1;heading;While[n <= 46,tanF; \[Tau] = t[2^(k - 1)*\[Delta],n]; \[Sigma][2] =SetPrecision[\[Sigma][1] + (1 - (\[Alpha] - \[Tau])/(1 + \[Alpha]*\[Tau]))/2^k,25 + 18*n]; piApp3 = 2^(k + 1)*\[Sigma][2];str=If[n < 10,″ | ″,″ | ″];If[n <=5 || n >= 37,Print[n,str,Abs[MantissaExponent[Pi - piApp3][[2]]]]];If[n == 6,Print[″... COMPUTING ...″]]; n++];ending;
- 402 digits of π before iteration--------------------------------------Number of terms n | Digits of π--------------------------------------1 | 252 | 423 | 604 | 785 | 96... COMPUTING ...37 | 69038 | 70839 | 72640 | 74441 | 76242 | 78043 | 79844 | 80445 | 80446 | 804--------------------------------------804 digits of π after iteration
- Clear[arg,n](* Argument of arctangent *)arg=SetPrecision[1/85445659,500];Print[″Increment of n″,″ | ″,″Correct digits″];Print[″---------------------------------″];n = 1;(* Convergence of arctangent *)While[n <= 15,str=If[n < 10,″ | ″,″ | ″];Print[n,str,Abs[MantissaExponent[ArcTan[arg] - atan[arg,n]][[2]]]]; n++];
- Increment of n | Correct digits------------------------------------1 | 242 | 413 | 584 | 745 | 916 | 1077 | 1248 | 1409 | 15710 | 17311 | 19012 | 20613 | 22314 | 23915 | 256
5. Rational Numbers
- (* Iterative formula (45) *)\[Lambda][x_,1] := \[Lambda][x,1] = (2*x)/(1 - x^2);\[Lambda][x_,n_] := \[Lambda][x,n] = (2\[Lambda][x,n - 1])/(1 - \[Lambda][x,n - 1]^2);(* Integer k *)k = 4;(* Computation of rational number *)rNum = \[Lambda][1/10,k - 1];rNum = (rNum - 1/84)/(1 + rNum*1/84);rNum = (rNum - 1/21342)/(1 + rNum*1/21342);rNum = (rNum - 1/991268848)/(1 + rNum*1/991268848);(* Before iteration *)\[Sigma][1] = N[ArcTan[1/10] - 1/2^(k - 1)*(ArcTan[1/84] + ArcTan[1/21342] + ArcTan[1/991268848]),100];(* After iteration *)\[Sigma][2]=\[Sigma][1] + 1/2^k*(1 - rNum);Print[MantissaExponent[Pi - 2^(k + 1)*\[Sigma][1]][[2]]//Abs,″ digits of \[Pi] before iteration″];Print[MantissaExponent[Pi - 2^(k + 1)*\[Sigma][2]][[2]]//Abs,″ digits of \[Pi] after iteration″];
- 19 digits of π before iteration39 digits of π after iteration
6. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Beckmann, P. A History of Pi; Golem Press: New York, NY, USA, 1971. [Google Scholar]
- Berggren, L.; Borwein, J.; Borwein, P. Pi: A Source Book, 3rd ed.; Springer: New York, NY, USA, 2004. [Google Scholar]
- Borwein, J.; Bailey, D. Mathematics by Experiment—Plausible Reasoning in the 21st Century, 2nd ed.; Taylor & Francis Group: Abingdon, UK, 2008. [Google Scholar]
- Agarwal, R.P.; Agarwal, H.; Sen, S.K. Birth, growth and computation of pi to ten trillion digits. Adv. Differ. Equ. 2013, 2023, 100. [Google Scholar] [CrossRef]
- Lehmer, D.H. On arccotangent relations for π. Am. Math. Mon. 1938, 45, 657–664. [Google Scholar] [CrossRef]
- Castellanos, D. The ubiquitous π. Math. Mag. 1998, 61, 67–98. [Google Scholar] [CrossRef]
- Abeles, F.F.; Charles, L. Dodgson’s geometric approach to arctangent relations for Pi. Hist. Math. 1993, 20, 151–159. [Google Scholar] [CrossRef]
- Tweddle, I. John Machin and Robert Simson on inverse-tangent series for π. Arch. Hist. Exact Sci. 1991, 42, 1–14. Available online: http://www.jstor.org/stable/41133896 (accessed on 13 February 2024). [CrossRef]
- Wetherfield, M. The enhancement of Machin’s formula by Todd’s process. Math. Gaz. 1996, 80, 333–344. [Google Scholar] [CrossRef]
- Gasull, A.; Luca, F.; Varona, J.L. Three essays on Machin’s type formulas. Indag. Math. 2023, 34, 1373–1396. [Google Scholar] [CrossRef]
- Guillera, J. History of the formulas and algorithms for pi. arXiv 2009, arXiv:0807.0872. [Google Scholar]
- Borwein, J.M.; Borwein, P.B. Cubic and higher order algorithms for π. Can. Math. Bull. 1984, 27, 436–443. [Google Scholar] [CrossRef]
- Borwein, J.M.; Borwein, P.B. More quadratically converging algorithms for π. Math. Comput. 1986, 46, 247–253. [Google Scholar] [CrossRef]
- Borwein, J.M.; Borwein, P.B. An explicit cubic iteration for π. BIT Numer. Math. 1986, 26, 123–126. [Google Scholar] [CrossRef]
- Borwein, J.M.; Borwein, P.B. Pi and the AGM—A Study in Analytic Number Theory and Computational Complexity; Wiley & Sons Inc.: Hoboken, NJ, USA, 1987. [Google Scholar]
- Bailey, D.H.; Borwein, J.M.; Borwein, P.B.; Plouffe, S. The quest for pi. Math. Intell. 1997, 19, 50–57. [Google Scholar] [CrossRef]
- Calcut, J.S. Gaussian integers and arctangent identities for π. Am. Math. Mon. 2009, 116, 515–530. Available online: www.jstor.org/stable/40391144 (accessed on 13 February 2024). [CrossRef]
- Chien-Lih, H. More Machin-type identities. Math. Gaz. 1997, 81, 120–121. [Google Scholar] [CrossRef]
- Nimbran, A.S. On the derivation of Machin-like arctangent identities for computing pi (π). Math. Stud. 2010, 79, 171–186. [Google Scholar]
- Wetherfield, M.R.; Chien-Lih, H. Computing Pi: Lists of Machin-Type (Inverse Cotangent) Identities for Pi/4. Available online: http://www.machination.eclipse.co.uk (accessed on 2 December 2023).
- Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. A new form of the Machin-like formula for π by iteration with increasing integers. J. Integer Seq. 2022, 25, 22.4.5. [Google Scholar]
- Abrarov, S.M.; Quine, B.M. An iteration procedure for a two-term Machin-like formula for pi with small Lehmer’s measure. arXiv 2017, arXiv:1706.08835. [Google Scholar]
- Wolfram Cloud. A Wolfram Notebook Playing with Machin-like Formulas. Available online: https://www.wolframcloud.com/obj/exploration/MachinLike.nb (accessed on 2 December 2023).
- Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. Algorithmic determination of a large integer in the two-term Machin-like formula for pi. Mathematics 2021, 9, 2162. [Google Scholar] [CrossRef]
- Campbell, J. Nested radicals obtained via the Wilf–Zeilberger method and related results. Maple Trans. 2023, 3, 16011. [Google Scholar] [CrossRef]
- Maritz, M.F. Extracting Pi from Chaos. Coll. Math. J. 2023. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Jagpal, R.K.; Siddiqui, R.; Quine, B.M. Unconditional applicability of Lehmer’s measure to the two-term Machin-like formula for π. Math. J. 2021, 23, 1–23. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Quine, B.M. A formula for pi involving nested radicals. Ramanujan J. 2018, 46, 657–665. [Google Scholar] [CrossRef]
- Knuth, D.E.; Buckholtz, T.J. Computation of tangent, Euler, and Bernoulli numbers. Math. Comp. 1967, 21, 663–688. [Google Scholar] [CrossRef]
- Harvey, D. A multimodular algorithm for computing Bernoulli numbers. Math. Comput. 2010, 79, 2361–2370. Available online: https://www.jstor.org/stable/20779149 (accessed on 13 February 2024). [CrossRef]
- Bailey, D.H.; Bauschke, H.H.; Borwein, P.; Garvan, F.; Vanderwerff, M.T.J.D.; Wolkowicz, H. Computational and Analytical Mathematics; Springer: New York, NY, USA, 2013. [Google Scholar]
- Beebe, N.H.F. The Mathematical Function Computation Handbook; Springer International Publishing AG: New York, NY, USA, 2017. [Google Scholar]
- Havil, J. The Irrationals: A Story of the Numbers You Can’t Count On; Princeton University Press: Princeton, NJ, USA, 2012. [Google Scholar]
- Chien-Lih, H. An elementary derivation of Euler’s series for the arctangent function. Math. Gaz. 2005, 89, 469–470. [Google Scholar] [CrossRef]
- Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. A generalized series expansion of the arctangent function based on the enhanced midpoint integration. AppliedMath 2023, 3, 395–405. [Google Scholar] [CrossRef]
- Oliver, K.; Prodinger, H. The continued fraction expansion of Gauss’ hypergeometric function and a new application to the tangent function. Trans. R. Soc. S. Afr. 2012, 67, 151–154. [Google Scholar] [CrossRef]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2024 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Abrarov, S.M.; Siddiqui, R.; Jagpal, R.K.; Quine, B.M. An Iterative Method for Computing π by Argument Reduction of the Tangent Function. Math. Comput. Appl. 2024, 29, 17. https://doi.org/10.3390/mca29020017
Abrarov SM, Siddiqui R, Jagpal RK, Quine BM. An Iterative Method for Computing π by Argument Reduction of the Tangent Function. Mathematical and Computational Applications. 2024; 29(2):17. https://doi.org/10.3390/mca29020017
Chicago/Turabian StyleAbrarov, Sanjar M., Rehan Siddiqui, Rajinder Kumar Jagpal, and Brendan M. Quine. 2024. "An Iterative Method for Computing π by Argument Reduction of the Tangent Function" Mathematical and Computational Applications 29, no. 2: 17. https://doi.org/10.3390/mca29020017
APA StyleAbrarov, S. M., Siddiqui, R., Jagpal, R. K., & Quine, B. M. (2024). An Iterative Method for Computing π by Argument Reduction of the Tangent Function. Mathematical and Computational Applications, 29(2), 17. https://doi.org/10.3390/mca29020017