Abstract
In this work, we develop a new iterative method for computing the digits of by argument reduction of the tangent function. This method combines a modified version of the iterative formula for with squared convergence that we proposed in a previous work and a leading arctangent term from the Machin-like formula. The computational test we performed shows that algorithmic implementation can provide more than 17 digits of per increment. Mathematica codes, showing the convergence rate for computing the digits of , are presented.
1. Introduction
In 1706, English astronomer and mathematician John Machin discovered a formula for , expressed in terms of two arctangents:
By using this formula, he was the first to compute 100 digits of [1,2,3,4]. Nowadays, identities of the kind
where the coefficients and are either integers or rational numbers, are named after him as the Machin-like formulas for .
The Maclaurin series expansion of the arctangent function is given by
from which it follows that
Consequently, we can conclude that the convergence of the Machin-like Formula (2) for is better when the coefficients are larger by their absolute values.
In order to estimate the efficiency of a given Machin-like formula, Lehmer introduced the measure [5,6,7,8,9]:
A smaller value of indicates a higher efficiency of a given Machin-like formula. According to this formula, the measure is smaller when the total number of the terms J is lower and the coefficients are higher by their absolute values. A more detailed description and the significance of the measure (5) can be found in the literature [6,9].
Although Lehmer’s paper [5] assumes that , it seems that the measure (5) is applicable only when all values of are integers. Otherwise, even if a single value from the set represents a quotient, its presence causes complexities in the computation [10], which appear due to the rapidly increasing number of digits in the numerators in summation terms when a series expansion of the arctangent function, like Equations (3), (30) or (31), is used in the computation. That is why it is very desirable to generate the Machin-like formulas for where .
The following Machin-like formula [5]
discovered by Gauss, has Lehmer’s measure . This signifies that this equation is more efficient in computing digits of since its measure is smaller than the original Machin-like Formula (1) with measure .
All coefficients in any Machin-like formula for satisfy the relation
implying that the real and imaginary parts of this product must be equal to each other. This relation can be used for validation. For example, there is a simple and elegant proof of the original Machin Formula (1) for [11]
Although several iterative formulas with quadratic, cubic, quartic, quintic and nonic convergences have been discovered [12,13,14,15,16], they require undesirable surd numbers that appear over and over again at each consecutive step of the iteration.
Historically, algorithms based on the Chudnovsky and Machin-like formulas successively broke records in computing the digits of [4]. Currently, the Chudnovsky formula, providing linear convergence with 14 to 16 digits of per increment of the summation terms [1,2,4], appears to be the most efficient.
In 2002, Kanada broke a record by computing more than one trillion decimal digits of for the first time by using the following self-checking pair (also known as the Störmer–Takano pair) of Machin-like formulas [4,17]
and
with Lehmer’s measures of and , respectively. Although the current record, achieved by using the Chudnovsky formula, exceeds one hundred trillion digits of [10], application of the Machin-like formulas may be promising to calculate a comparable number of digits due to availability of more advanced and powerful supercomputers then those used by Kanada more than 20 years ago. Furthermore, more Machin-like formulas with smaller Lehmer’s measures have been discovered [18,19,20]. For example, the following two equations
and
may be more efficiently used as a self-checking pair since their Lehmer’s measures of and , respectively, are considerably smaller. Therefore, application of Machin-like formulas with small Lehmer’s measure have colossal potential and can be competitive for computing the digits of the constant .
Equation (7) was reported by Wetherfield [20]. Equation (8) was obtained from another Wetherfield identity [20]
by using the identity [21]
In our earlier publication [22], we derived the following two-term Machin-like formula
where the constant may be conveniently chosen according to a relation [23]
The complete proof of the identity (9) is quite lengthy and, therefore, beyond the scope of the present work. However, the detailed derivation of identity (9), which is available in [22], can be briefly outlined as a determination of the value at a given k and in the two-term Machin-like formula of kind
and a subsequent reformulation of Equation (11) into Equation (9) with the help of de Moivre’s formula
It is not difficult to prove that if the first constant of Equation (11) is an integer or a rational number, then the second constant must also be a rational number. Specifically, when is either an integer or a rational number, then from the relation [22]
it follows that both the real and the imaginary parts of must be rational numbers. However, from the identity
it follows that since . Consequently, we prove that is a rational number at .
It should be noted that the two-term Machin-like formula of kind (11) that we considered in our paper [22] represents a practical interest. Recently, a group of independent researchers has developed a different method for determination of the value of at given values of k and (see Table 2 in [10]). Unlike our iterative method described in [22], their algorithm is built on the basis of the rational functions with a remarkable property (see [10] a for detailed description).
Following the same procedure that is described in our work [22], one can also obtain a generalization of identity (9) in the form
Consequently, the two-term Machin-like Formula (11) can be generalized as
where (compared with Equation (12) above)
Both constants and in Equation (13) may be chosen conveniently. For example, consider a ratio of , representing a rough approximation of . Therefore, we can write
Thus, by choosing and , we can show that the ratio
since
Consequently, we obtain the identity that corresponds to the first row of Table 1 in [10]
We can see now that Equation (9) is just a specific case of more general form of the two-term Machin-like Formula (13) for . Therefore, the method described in our paper [22] can also be generalized to generate all two-term Machin-like formulas of kind (14), shown in Table 1 from the work [10] (see first row showing ).
In our recent publication [24], using the two-term Machin-like Formula (9) for , we found the following iterative formula
where , such that
This equation can be employed to compute digits of the constant with quadratic convergence (see Mathematica code provided in [24]).
Motivated by recent publications [10,23,25,26] in connection to our works [21,22,24,27,28], we developed a new algorithm based on a modified version of the iterative Formula (15).
Although Equation (15) provides squared convergence in computing digits of , its direct application results in a slow convergence rate in the intermediate steps of the calculations of the tangent function. This occurs because the argument of the tangent function in this equation tends to the relatively large value of as n increases. In this work, we propose a new method that resolves this problem. In particular, we show how Equation (15) can be rearranged and used in combination with arctangent terms of the Machin-like formula for . Such an approach may be promising for efficient computation of with more than 17 digits per increment of n in Equation (29) that will be discussed below. To the best of our knowledge, algorithmic implementation based on the combination of iterative and Machin-like formulas for computing digits of has never been reported.
2. Preliminaries
2.1. Machin-Like Formulas
In our recent work, we derived the following identity [21]
where
such that and are nested radicals of 2 and
with an initial value that can be computed by substituting into Equation (12)
Equation (17) implies two important rules. First, since the integer is not defined, it follows that at , the sum of arctangent functions
Second, if , then no further iteration is required, as the fractional part of the number does not exist.
We may compute the coefficient by using Equation (20) at smaller values of the integer k. However, the computation slows down as k increases. To resolve this problem, we proposed a more efficient method of computation based on a two-step iterative formula [22]
with initial values
and
leading to
Equation (22), based on the two-step iteration (21), is more efficient for computation of the constant than Equation (20), since at larger values of the integer k, the rapidly growing exponent in Equation (20) drastically decelerates the computation.
Consider a few examples. At , we can find that
and at , the constant according to Equation (22). Since , the constants at do not exist. Consequently, we get the identity
that is commonly known as Hermann’s formula [15].
At , we obtain
and at , the coefficient according to Equation (22). Since , the constants at do not exist. Consequently, we end up with the following identity
representing the original Machin-like Formula (1) for .
The case requires more computations. In particular, we can see that
and at , we have
Consequently, we can write
Since , the constant exists and can be computed according to Equation (19).
Thus, at , this leads to
where
and
Again, since , the constant can be computed, and at , we can derive the following identity
where
and
Repeating the same procedure over and over again up to , we can finally obtain the following seven-term Machin-like formula
where
is also an integer. Therefore, all iterations are completed.
From these examples, we can see that Hermann’s (23), Machin’s (1) and the derived (24) formulas for belong to the same generic group, since all of them can be constructed from their generalized form (17) at different integers k, equal to 2, 3 and 4, respectively. Further, we will use Equation (24) as an example for computing digits of .
The following Mathematica code:
- (* 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
Since the tangent function can be represented as a series expansion
where are the Bernoulli numbers, defined by the contour integral
it follows that
Consequently, the accuracy of the tangent function improves with decreasing the argument x.
Unfortunately, the series expansion of the tangent function (25) requires the determination of the Bernoulli numbers, which is itself a big challenge [29,30,31,32]. For example, one of the most known formulas for computation of the Bernoulli numbers
is based on double summation with the binomial coefficients that decelerate the computation.
There are other equations for computation of the tangent function [31,32,33] and one of the efficient techniques to perform computation of the tangent function is the Newton–Raphson iteration (see [27] for more details). In particular, the following iteration formula
with an initial value that can be taken as
can be employed. This iteration leads to
Iteration (27) leads to the quadratic convergence of the tangent function. In practice, however, quadratic convergence can be achieved only if a sufficiently large number of the summation terms are applied in the series expansions like (3), (30) or (31) to approximate the arctangent function. We have already applied the Newton–Raphson iteration (27) to compute the digits of [27].
As an option, we can also apply the most common equation
where sine and cosine functions in the numerator and denominator are represented as the Maclaurin expansions. Unfortunately, this representation is not optimal for practical application since it requires separate computations of the expansion terms for the sine and cosine functions. However, if we rewrite the tangent function as
and take into account that , we can obtain the following identity
Although this this representation of the tangent function is not common, its application is significantly advantageous, since each nth term in the expansion
can be utilized again just by multiplying to obtain the expansion for the denominator
Such a technique may accelerate computation and reduce memory usage. Thus, we can write the following iterative procedure
leading to
according to Equation (28).
2.3. Arctangent Function
Since in this work we utilize the terms from the Machin-like Formula (17), a series expansion with rapid convergence of the arctangent function should be applied. Based on our empirical results, we can consider two equations with rapid convergence that can be used for implementation. The first equation is Euler’s series expansion [6,34]
The second equation is given by the series expansion [35]
where the expansion coefficients are computed by a two-step iteration such that
and
The derivation of the series expansion (31), shown in our work [35], is based on the Enhanced Midpoint Integration (EMI) formula (see also [22])
where we imply that
since
The series expansion (31) appears to be rapid in convergence. In particular, even at , its convergence rate is faster by many orders of the magnitude than that of Euler’s Formula (30) (see [35] for details). Thus, by taking , Equation (31) can be conveniently rearranged as
where the expansion coefficient can be computed by the following two-step iteration
with initial values
Series expansions (30) and (32) are significantly faster in convergence than the Maclaurin series expansion (3). In this work, the truncated series expansion (32) is used. Although a value of integer M that is greater than 1 further improves the convergence rate, it may be preferable to apply Equation (32) rather than its generalization (31), since an increment of M just by 1 increases the number of the terms in series expansion (31) by a factor of 2.
3. Results and Discussion
3.1. Modified Iteration
Changing the variable in Equation (15) leads to a more convenient form
where
Consequently, the constant can be found by iteration in accordance with Equation (16) such that
Comparing the limit (34) with (see [28] for derivation)
we can obtain an important relation
or
Consequently, the argument of the tangent function in Equation (33) tends to 1 with increasing n.
Since, in Equation (33), the argument of the tangent function tends to 1, the convergence per iteration of n in applied Equation (29) is expected to be extremely slow. Indeed, if the argument of the tangent function is not small enough, then, in accordance with relation (26), we cannot gain a reasonable convergence of the tangent function.
This problem can be effectively resolved by introducing a constant such that
The value of this constant is close to when n is sufficiently large (see Equation (35)). Therefore, with the help of this constant, we can modify the iteration Formula (33) by using the following procedure
The expression for can be simplified as follows
or
or
where . Since is supposed to be a small value, we may expect a reasonable convergence rate in iteration (36) at each increment n in Equation (29).
The tangent function in Equation (36) is represented twice. Therefore, we can define
and rewrite this equation in a more simplified form
3.2. Methodology
In our algorithm, we utilize a modified Equation (37). This yields the iteration based on a set of equations
We can take a few initial terms in the Machin-like Formula (17) as a value to compute the constant c.
Return to Equation (24), corresponding to the case . If we take only the first term, then the constant
is not close enough to to compute the digits of . As a consequence, we cannot achieve a rapid convergence. Specifically, our empirical results show that with constant (39), the set (38) of iteration formulas provides convergence of four to five digits of per increment of n in Equation (29). However, if we take the first two terms from Equation (24) such that
then the convergence rate significantly improves, providing ten digits of per increment.
Consider the following identity [36]
This identity can be used for computation of the constant . Thus, according to identity (41), we have
Now, using
and an elementary trigonometric relation
we can find that the constant is
Once the exact value of the constant is calculated according to Equation (43), we can use the set of iteration Formula (38) for computing the digits of . The Mathematica codes and their description are provided in the next section.
Although the convergence rate of 10 digits of per increment of n in Equation (29) is relatively high, application of the Machin-like Formula (17) may not be efficient at a smaller value of the integer k. In particular, the computation of both arctangents and is expected to be slow, since the two integers in the argument denominators (10 and 84) are not big enough for rapid convergence in accordance with Equation (4).
Consider another case where k is sufficiently large. We can take, for example, . Applying identity (17) together with Equation (22), we can find that [22]
Recently, the same equation was derived by Gasull et al. by a different method of computation (see Table 2 in [10] showing the row with ).
At first glance, it may appear problematic to find the corresponding coefficient , since at , the substitution into identity (41) results in an expression
that is impossible to compute due to the extremely large value of the exponent. However, application of the two-term Machin-like formula for of kind (11) gives a big advantage, since the multiplier is continuously divisible by 2. Thus, using the elementary trigonometric identity
in the iteration process, we can compute the required constant . Specifically, in accordance with this identity and due to relation , at , the following iteration formula
with initial value
yields a rational number
in which the integer is calculated according to Equation (18). It is interesting to note that the number of digits (522,185,816) in this equation is the same as the number of digits in the denominator of Equation (44).
At a larger value of the integer k, it is sufficient to take only the first term (leading term) of the Machin-like formula for to achieve rapid convergence. In particular, using only the leading term from Equation (44)
the set of iteration Formula (38) provides 17 to 18 digits of per increment of n in Equation (29). The corresponding Mathematica code and its description are discussed in the next section.
4. Mathematica Codes and Description
The Mathematica codes consist of seven cells that can be copied and pasted directly to the Mathematica notebook. The first cell is given by the following code:
- 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}]};
that defines the two-step iterative method for the arctangent function, based on Equation (32). This function can be invoked by running the command atanF.
The second cell provides the code:
- 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])};
that defines the iterative method for the tangent function, based on Equation (29). This function can be invoked by running the command tanF.
The code below in the third cell:
- 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″]};
defines the output format that includes the heading and ending parts for intermediate computed data. The header and the ending parts can be invoked by running the commands heading and ending, respectively.
The code in the fourth cell:
- 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;
computes the coefficient according to Equation (41) and coefficient c at by taking only the leading (first) term of the Machin-like Formula (24) for . As we do not require the highest precision at each cycle of computation within the while loop, the precision increases with increasing n in Equation (29). The parameter of the precision is given as , where n is the increment in Equation (29), since at , the number of correct digits of is 5 and multiplier 5 is the largest number of digits of per increment n.
Suppose we know the first 100 digits of . These digits of can be extracted from Mathematica by using the following division
Once we know 100 digits of , we can use the described iteration to double its number.
Running this cell generates the following output:
- 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
that shows the first five and last fifteen cycles. As we can see, each increment of n by one gives four to five digits of . After 39 cycles, the convergence slows down due to saturation. In particular, after 40th cycle, the number of digits doubles to 200. This saturation occurs since we have reached the limit of squared convergence in the determination of the digits of .
The code in the fifth cell:
- 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;
computes the coefficients c and at with the help of Equations (40), (45) and (46). Again, the precision increases with increasing n in Equation (29). The parameter of the precision is given as , where n is the increment in Equation (29), since at , the number of correct digits of is 12 and multiplier 10 is the largest number of digits of per increment n. We can use the 200 already obtained digits of to double it by iteration.
Running this cell produces the output:
- 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
that shows first five and last fifteen cycles. The convergence rate always remains the same, 10 digits per increment of n. After 39 cycles, the convergence slows down. In particular, after the 40th cycle, the number of digits of doubles to 402. Further cycles do not contribute to increasing the number of digits since again we reached the limit in the determination of the digits of .
The code in the sixth cell is the most interesting:
- 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;
as it provides an excellent convergence rate at 17 to 18 digits per increment n in Equation (29) at . Although the exact value of the rational number can be used (see Equation (46)), this code does not utilize it since a regular desktop or laptop computer requires a few hours for computation by using Equation (46). However, we can observe a rapid convergence computing this coefficient with tangent and arctangent approximations based on Equations (46) and (32), respectively. The code in this cell utilizes only a leading term of the Machin-like Formula (44) for . This is possible to achieve since at larger value of , the argument in the leading arctangent term becomes small. Consequently, this reduces the value of and improves the convergence rate according to Equation (29).
The precision of this code increases with increasing n in Equation (29). The parameter of the precision is given as , where n is the increment in Equation (29), since at , the number of correct digits of is 25 and the multiplier 18 is the largest number of digits of per increment n. Again, we can use the 402 already obtained digits of to double it by iteration.
Running this cell produces the output:
- 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
that shows first five and last fifteen cycles. After 43 cycles, the convergence slows down. In particular, after the 44th cycle, the number of digits of doubles to 804. Further cycles do not contribute to the number of digits since we have reached the limit in the determination of the digits of for squared convergence.
Since the proposed method requires at least the leading term of the Machin-like Formula (44) for , we have to verify its convergence rate to ensure efficient computation. Thus, at , the corresponding value of the leading term in Equation (44) is
An additional cell below is the Mathematica code:
- 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++];
showing the convergence rate of the arctangent function. This code generates following output:
- Increment of n | Correct digits------------------------------------1 | 242 | 413 | 584 | 745 | 916 | 1077 | 1248 | 1409 | 15710 | 17311 | 19012 | 20613 | 22314 | 23915 | 256
As we can see, the code provides 16 to 17 correct digits of the arctangent function value (47) per increment of n in Equation (32). Furthermore, computing just a single arctangent term greatly minimizes Lehmer’s measure (5). In particular, the value of the measure of the arctangent term (47) is only
The increase of the convergence rate with increasing k is due to a decrease of the argument of the tangent function. These results show that the set of Equation (38) can provide rapid convergence when computing the digits of .
5. Rational Numbers
There is an alternative method for computing the digits of . This method is based only on rational numbers and implemented without the iterative Formula (29).
As an example, consider the following approximation
that represents the first four terms in Equation (24). This approximation can provide at most 19 decimal digits of . Consequently, we can define
such that
according to relation (48).
Using the iterative Formula (45) together with identity (42), we can find the exact value of the tangent as a rational number
since all arguments of the arctangent terms in approximation (48) are also rational numbers (integer reciprocals). Once the exact value of tangent (49) is known, substituting it into iterative Formula (33) results in
such that the value doubles the number of the decimal digits of up to 39.
The corresponding Mathematica code:
- (* 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″];
produces the following output:
- 19 digits of π before iteration39 digits of π after iteration
showing number of digits of before and after a single iteration. This example demonstrates that the combination of iteration Formula (33) with the Machin-like formula for of type (17) can also be implemented for computing the digits of without any approximation formula of the tangent function.
Since Equation (24) consists of only seven terms, we should not expect a high accuracy. However, increasing k in Equation (17) leads to a rapid increase in the number of arctangent terms. Therefore, at sufficiently large values of k, we may also achieve the required accuracy for computing the digits of by using this alternative method based on rational numbers.
6. Conclusions
A new iterative method for computing the digits of by argument reduction of the tangent function is developed. This method combines a modified iterative formula for with squared convergence and a leading arctangent term from the Machin-like Formula (17). The computational test shows that algorithmic implementation can provide more than 17 digits of per increment n in Equation (29). This method requires no surd numbers, and with an arbitrarily large k, there is no upper limit for the convergence rate.
Author Contributions
S.M.A. developed the methodology, wrote the codes and prepared a draft version of the manuscript. R.S., R.K.J. and B.M.Q. verified, reviewed and edited the manuscript. All authors have read and agreed to the published version of the manuscript.
Funding
This research received no external funding.
Institutional Review Board Statement
Not applicable.
Informed Consent Statement
Not applicable.
Data Availability Statement
Data are contained within the article.
Acknowledgments
This work was supported by National Research Council Canada, Thoth Technology Inc., York University and Epic College of Technology. The authors wish to thank the reviewers for their constructive comments and recommendations.
Conflicts of Interest
The authors declare no conflicts of interest. The authors declare that the research was conducted in the absence of any commercial or financial relationships from Thoth Technology Inc. that could be construed as a potential conflict 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][Green Version]
- 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/).