|
|
Line 1: |
Line 1: |
| {{Refimprove|date=October 2011}}
| | Myrtle Benny is how I'm known as and I really feel comfortable when individuals use the at home std testing full title. His spouse doesn't like it the way he does but [http://www.pinaydiaries.com/blog/104745 http://www.pinaydiaries.com/blog/104745] what he really likes doing is to do aerobics and he's been doing [http://flashtrue.com/stay-yeast-infection-free-using-these-useful-tips/ at home std testing] it for fairly a whilst. Her family members lives in [http://Rhrealitycheck.org/article/2013/02/22/trich-the-most-common-sexually-transmitted-infection-you-may-never-have-heard-of/ Minnesota]. Hiring is her day job now and she will not alter it anytime soon.<br><br>my blog home std test - over the counter std test ([http://Bogangsa.com/board_avHE75/389128 source web page]) |
| In [[mathematics]], '''Machin-like formulae''' are a popular technique for computing [[pi|π]] to a [[approximations of pi|large number of digits]]. They are generalizations of [[John Machin]]'s formula from 1706:
| |
| | |
| :<math>\frac{\pi}{4} = 4 \arctan \frac{1}{5} - \arctan \frac{1}{239}</math>
| |
| | |
| which he used to compute π to 100 decimal places.
| |
| | |
| Machin-like formulas have the form:
| |
| | |
| {{NumBlk|:|<math>c_0 \frac{\pi}{4} = \sum_{n=1}^N c_n \arctan \frac{a_n}{b_n}</math>|{{EquationRef|1}}}}
| |
| | |
| Where <math>a_n</math> and <math>b_n</math> are positive [[integer]]s such that <math>a_n < b_n</math>, <math>c_n</math> is a signed non-zero integer, and <math>c_0</math> is a positive integer.
| |
| | |
| These formulae are used in conjunction with the [[Taylor series]] expansion for [[arctangent]]:
| |
| | |
| {{NumBlk|:|<math>\arctan x = \sum^{\infin}_{n=0} \frac{(-1)^n}{2n+1} x^{2n+1} = x - \frac{x^3}{3} + \frac{x^5}{5} - \frac{x^7}{7} + ...</math>|{{EquationRef|4}}}}
| |
| | |
| ==Derivation==
| |
| In [[Angle addition formula]] we learned the following equations:
| |
| | |
| :<math>\sin(\alpha + \beta) = \sin \alpha \cos \beta + \cos \alpha \sin \beta</math>
| |
| :<math>\cos(\alpha + \beta) = \cos \alpha \cos \beta - \sin \alpha \sin \beta</math> | |
| | |
| Simple algebraic manipulations of these equations yield the following:
| |
| | |
| {{NumBlk|:|<math>\arctan \frac{a_1}{b_1} + \arctan \frac{a_2}{b_2} = \arctan\frac{a_1 b_2 + a_2 b_1}{b_1 b_2 - a_1 a_2},</math>|{{EquationRef|2}}}}
| |
| | |
| if
| |
| | |
| <math> -\frac{\pi}{2} < \arctan \frac{a_1}{b_1} + \arctan \frac{a_2}{b_2} < \frac{\pi}{2}.</math>
| |
| | |
| All of the Machin-like formulae can be derived by repeated application of this equation. As an example, we show the derivation of Machin's original formula:
| |
| | |
| :<math>2 \arctan \frac{1}{5}</math>
| |
| | |
| ::<math>= \arctan \frac{1}{5} + \arctan \frac{1}{5}</math>
| |
| | |
| ::<math>= \arctan \frac {1*5 + 1*5}{5*5 - 1*1}</math>
| |
| | |
| ::<math>= \arctan \frac {10}{24}</math>
| |
| | |
| ::<math>= \arctan \frac {5}{12}</math>
| |
| | |
| :<math>4 \arctan \frac{1}{5}</math>
| |
| | |
| ::<math>= 2 \arctan \frac{1}{5} + 2 \arctan \frac{1}{5}</math>
| |
| | |
| ::<math>= \arctan \frac{5}{12} + \arctan \frac{5}{12}</math>
| |
| | |
| ::<math>= \arctan \frac{5*12 + 5*12}{12*12 - 5*5}</math>
| |
| | |
| ::<math>= \arctan \frac{120}{119}</math>
| |
| | |
| :<math>4 \arctan \frac{1}{5} - \frac{\pi}{4}</math>
| |
| | |
| ::<math>= 4 \arctan \frac{1}{5} - \arctan \frac{1}{1}</math>
| |
| | |
| ::<math>= 4 \arctan \frac{1}{5} + \arctan \frac{-1}{1}</math>
| |
| | |
| ::<math>= \arctan \frac{120}{119} + \arctan \frac{-1}{1}</math>
| |
| | |
| ::<math>= \arctan \frac{120*1 + (-1)*119}{119*1 - 120*(-1)}</math>
| |
| | |
| ::<math>= \arctan \frac{1}{239}</math>
| |
| | |
| :<math>\frac{\pi}{4} = 4 \arctan \frac{1}{5} - \arctan \frac{1}{239}</math>
| |
| | |
| An insightful way to visualize equation {{EquationNote|2}} is to picture what happens when two complex numbers are multiplied together:
| |
| | |
| :<math>(b_1 + a_1 i)*(b_2 + a_2 i)</math>
| |
| ::<math>=b_1 b_2 + a_2 b_1 i + a_1 b_2 i - a_1 a_2</math>
| |
| {{NumBlk|::|<math>=(b_1 b_2 - a_1 a_2) + (a_1 b_2 + a_2 b_1) * i</math>|{{EquationRef|3}}}}
| |
| | |
| The angle associated with a complex number <math>(b_n + a_n i)</math> is given by:
| |
| | |
| :<math>\arctan \frac {a_n}{b_n}</math>
| |
| | |
| Thus, in equation {{EquationNote|3}}, the angle associated with the product is:
| |
| | |
| :<math>\arctan \frac{a_1 b_2 + a_2 b_1}{b_1 b_2 - a_1 a_2}</math>
| |
| | |
| Note that this is the same expression as occurs in equation {{EquationNote|2}}. Thus equation {{EquationNote|2}} can be interpreted as saying that the act of multiplying two complex numbers is equivalent to adding their associated angles (see [[Complex_number#Multiplication_and_division_in_polar_form|multiplication of complex numbers]]).
| |
| | |
| The expression:
| |
| | |
| :<math>c_n \arctan \frac{a_n}{b_n}</math>
| |
| | |
| is the angle associated with:
| |
| | |
| :<math>(b_n + a_n i)^{c_n}</math>
| |
| | |
| Equation {{EquationNote|1}} can be re-written as:
| |
| | |
| :<math>k * (1 + i)^{c_0} = \prod_{n=1}^N (b_n + a_n i)^{c_n}</math>
| |
| | |
| Where <math>k</math> is an arbitrary constant that accounts for the difference in magnitude between the vectors on the two sides of the equation. The magnitudes can be ignored, only the angles are significant.
| |
| | |
| ===Using Complex Numbers===
| |
| Other formulas may be generated using complex numbers. For example the angle of a complex number <math>(a + bi)</math> is given by <math>\arctan\frac{b}{a}</math> and when you multiply complex numbers you add their angles. If a=b then <math>\arctan\frac{b}{a}</math> is 45 degrees or <math>\frac{\pi}{4}</math>. This means that if the real part and complex part are equal then the arctangent will equal <math>\frac{\pi}{4}</math>. Since the arctangent of one has a very slow convergence rate if we find two complex numbers that when multiplied will result in the same real and imaginary part we will have a Machin-like formula. An example is <math>(2 + i)</math> and <math>(3 + i)</math>. If we multiply these out we will get <math>(5 + 5i)</math>. Therefore <math>\arctan\frac{1}{2} + \arctan\frac{1}{3} = \frac{\pi}{4}</math>.
| |
| | |
| If you want to use complex numbers to show that <math>\frac{\pi}{4} = 4\arctan\frac{1}{5} - \arctan\frac{1}{239}</math> you first must know that when multiplying angles you put the complex number to the power of the number that you are multiplying by. So <math>(5+i)^4 (-239+i) = -2^2(13^4)(1+i)</math> and since the real part and imaginary part are equal then, <math>4\arctan\frac{1}{5} - \arctan\frac{1}{239} = \frac{\pi}{4}</math>
| |
| | |
| ==Two-term formulas==
| |
| | |
| [[File:QuartercircleA222.JPG|thumb|relations]] | |
| | |
| If we limit ourselves to the special case where <math>a_n</math> is one, then there are vanishingly few solutions having only two terms. It is believed that there are exactly four.<ref>Carl Störmer, Bulletin de la S.M.F., tome 27 (1899),p. 160-170{{cite web |url=http://archive.numdam.org/ARCHIVE/BSMF/BSMF_1899__27_/BSMF_1899__27__160_1/BSMF_1899__27__160_1.pdf
| |
| |title=Complete solution for the equation <math>m \arctan\frac{1}{x} + n \arctan\frac{1}{y} = k \frac{\pi}{4}</math>}}</ref> These are [[Leonhard Euler|Euler]]'s:
| |
| | |
| :<math>\frac{\pi}{4} = \arctan\frac{1}{2} + \arctan\frac{1}{3}</math>
| |
| | |
| Hermann's:
| |
| | |
| :<math>\frac{\pi}{4} = 2 \arctan\frac{1}{2} - \arctan\frac{1}{7}</math>
| |
| | |
| Hutton's:
| |
| | |
| :<math>\frac{\pi}{4} = 2 \arctan\frac{1}{3} + \arctan\frac{1}{7}</math>
| |
| | |
| and Machin's:
| |
| | |
| :<math>\frac{\pi}{4} = 4 \arctan\frac{1}{5} - \arctan\frac{1}{239}</math>
| |
| | |
| In the general case, where the value of <math>a_n</math> is not restricted, there are countless other solutions. Example:
| |
| | |
| {{NumBlk|:|<math>\frac{\pi}{4} = 22 \arctan\frac{24478}{873121} + 17 \arctan\frac{685601}{69049993}</math>|{{EquationRef|5}}}}
| |
| | |
| ==More terms==
| |
| The 2002 record for digits of π, 1,241,100,000,000, was obtained by [[Yasumasa Kanada]] of [[Tokyo University]]. The Calculation was performed on a 64-node [[Hitachi, Ltd.|Hitachi]] [[supercomputer]] with 1 terabyte of main memory, performing 2 trillion operations per second. The following two equations were both used:
| |
| | |
| :<math> \frac{\pi}{4} = 12 \arctan\frac{1}{49} + 32 \arctan\frac{1}{57} - 5 \arctan\frac{1}{239} + 12 \arctan\frac{1}{110443}</math>
| |
| : [[Kikuo Takano]] (1982).
| |
| | |
| : <math> \frac{\pi}{4} = 44 \arctan\frac{1}{57} + 7 \arctan\frac{1}{239} - 12 \arctan\frac{1}{682} + 24 \arctan\frac{1}{12943}</math>
| |
| :[[Carl Størmer|F. C. W. Störmer]] (1896).
| |
| | |
| The most efficient currently known Machin-like formulas for computing π:
| |
| | |
| : <math>
| |
| \begin{align}
| |
| \frac{\pi}{4} =& 183\arctan\frac{1}{239} + 32\arctan\frac{1}{1023} - 68\arctan\frac{1}{5832}\\
| |
| & + 12\arctan\frac{1}{110443} - 12\arctan\frac{1}{4841182} - 100\arctan\frac{1}{6826318}\\
| |
| \end{align}
| |
| </math>
| |
| :黃見利 (Hwang Chien-Lih) (1997).
| |
| | |
| : <math>
| |
| \begin{align}
| |
| \frac{\pi}{4} =& 183\arctan\frac{1}{239} + 32\arctan\frac{1}{1023} - 68\arctan\frac{1}{5832}\\
| |
| & + 12\arctan\frac{1}{113021} - 100\arctan\frac{1}{6826318}\\
| |
| & - 12\arctan\frac{1}{33366019650} + 12\arctan\frac{1}{43599522992503626068}\\
| |
| \end{align}
| |
| </math>
| |
| :黃見利 (Hwang Chien-Lih) (2003).
| |
| | |
| : <math>
| |
| \begin{align}
| |
| \frac{\pi}{4} =& 83\arctan\frac{1}{107} + 17\arctan\frac{1}{1710} - 22\arctan\frac{1}{103697}\\
| |
| & - 24\arctan\frac{1}{2513489} - 44\arctan\frac{1}{18280007883}\\
| |
| & + 12\arctan\frac{1}{7939642926390344818}\\
| |
| & + 22\arctan\frac{1}{3054211727257704725384731479018}\\
| |
| \end{align}
| |
| </math>
| |
| : (M.Wetherfield) (2004).
| |
| | |
| ==Efficiency==
| |
| It is not the goal of this section to estimate the actual run time of any given algorithm. Instead, the intention is merely to devise a relative metric by which two algorithms can be compared against each other.
| |
| | |
| Let <math>N_d</math> be the number of digits to which <math>\pi</math> is to be calculated.
| |
| | |
| Let <math>N_t</math> be the number of terms in the [[Taylor series]] (see equation {{EquationNote|4}}).
| |
| | |
| Let <math>u_n</math> be the amount of time spent on each digit (for each term in the Taylor series).
| |
| | |
| The Taylor series will converge when:
| |
| | |
| :<math>\left(\left(\frac{b_n}{a_n}\right)^2\right)^{N_t} = 10^{N_d}</math>
| |
| | |
| Thus:
| |
| | |
| :<math>N_t = N_d \quad \frac{\ln 10}{2 \ln \frac{b_n}{a_n}}</math>
| |
| | |
| For the first term in the Taylor series, all <math>N_d</math> digits must be processed. In the last term of the Taylor series, however, there's only one digit remaining to be processed. In all of the intervening terms, the number of digits to be processed can be approximated by linear interpolation. Thus the total is given by:
| |
| | |
| :<math> \frac{N_d N_t}{2}</math>
| |
| | |
| The run time is given by:
| |
| | |
| :<math> time = \frac{u_n N_d N_t}{2}</math>
| |
| | |
| Combining equations, the run time is given by:
| |
| | |
| :<math> time = \frac{u_n {N_d}^2 \ln 10}{4 \ln \frac{b_n}{a_n}} = \frac{k u_n}{\ln \frac{b_n}{a_n}}</math>
| |
| | |
| Where <math>k</math> is a constant that combines all of the other constants. Since this is a relative metric, the value of <math>k</math> can be ignored.
| |
| | |
| The total time, across all the terms of equation {{EquationNote|1}}, is given by:
| |
| | |
| :<math>time = \sum_{n=1}^N \frac{u_n}{\ln \frac{b_n}{a_n}}</math>
| |
| | |
| <math>u_n</math> cannot be modelled accurately without detailed knowledge of the specific software. Regardless, we present one possible model.
| |
| | |
| The software spends most of its time evaluating the Taylor series from equation {{EquationNote|4}}. The primary loop can be summarized in the following pseudo code:
| |
| | |
| ::<math>1: \quad term \quad *= \quad {a_n}^2</math>
| |
| | |
| ::<math>2: \quad term \quad /= \quad -{b_n}^2</math>
| |
| | |
| ::<math>3: \quad tmp \quad = \quad term \quad / \quad (2*n+1)</math>
| |
| | |
| ::<math>4: \quad sum \quad += \quad tmp</math>
| |
| | |
| In this particular model, it is assumed that each of these steps takes approximately the same amount of time. Depending on the software used, this may be a very good approximation or it may be a poor one.
| |
| | |
| The unit of time is defined such that one step of the pseudo code corresponds to one unit. To execute the loop, in its entirety, requires four units of time. <math>u_n</math> is defined to be four.
| |
| | |
| Note, however, that if <math>a_n</math> is equal to one, then step one can be skipped. The loop only takes three units of time. <math>u_n</math> is defined to be three.
| |
| | |
| As an example, consider the equation:
| |
| | |
| {{NumBlk|:|<math>\frac{\pi}{4} = 44 \arctan \frac{74684}{14967113} + 139 \arctan \frac{1}{239} - 12 \arctan \frac{20138}{15351991}</math>|{{EquationRef|6}}}}
| |
| | |
| The following table shows the estimated time for each of the terms:
| |
| | |
| {|class="wikitable"
| |
| |-
| |
| ! align="center" | <math>a_n</math>
| |
| ! align="center" | <math>b_n</math>
| |
| ! align="center" | <math>\frac{b_n}{a_n}</math>
| |
| ! align="center" | <math>\ln \frac{b_n}{a_n}</math>
| |
| ! align="center" | <math>u_n</math>
| |
| ! align="center" | <math>time</math>
| |
| |-
| |
| | align="right" | 74684
| |
| | align="right" | 14967113
| |
| | align="right" | 200.41
| |
| | align="right" | 5.3003
| |
| | align="center" | 4
| |
| | align="right" | 0.75467
| |
| |-
| |
| | align="right" | 1
| |
| | align="right" | 239
| |
| | align="right" | 239.00
| |
| | align="right" | 5.4765
| |
| | align="center" | 3
| |
| | align="right" | 0.54780
| |
| |-
| |
| | align="right" | 20138
| |
| | align="right" | 15351991
| |
| | align="right" | 762.34
| |
| | align="right" | 6.6364
| |
| | align="center" | 4
| |
| | align="right" | 0.60274
| |
| |}
| |
| | |
| The total time is 0.75467 + 0.54780 + 0.60274 = 1.9052
| |
| | |
| Compare this with equation {{EquationNote|5}}. The following table shows the estimated time for each of the terms:
| |
| | |
| {|class="wikitable"
| |
| |-
| |
| ! align="center" | <math>a_n</math>
| |
| ! align="center" | <math>b_n</math>
| |
| ! align="center" | <math>\frac{b_n}{a_n}</math>
| |
| ! align="center" | <math>\ln \frac{b_n}{a_n}</math>
| |
| ! align="center" | <math>u_n</math>
| |
| ! align="center" | <math>time</math>
| |
| |-
| |
| | align="right" | 24478
| |
| | align="right" | 873121
| |
| | align="right" | 35.670
| |
| | align="right" | 3.5743
| |
| | align="center" | 4
| |
| | align="right" | 1.1191
| |
| |-
| |
| | align="right" | 685601
| |
| | align="right" | 69049993
| |
| | align="right" | 100.71
| |
| | align="right" | 4.6123
| |
| | align="center" | 4
| |
| | align="right" | 0.8672
| |
| |}
| |
| | |
| The total time is 1.1191 + 0.8672 = 1.9863
| |
| | |
| The conclusion, based on this particular model, is that equation {{EquationNote|6}} is slightly faster than equation {{EquationNote|5}}, regardless of the fact that equation {{EquationNote|6}} has more term(s). This result is typical of the general trend. The dominant factor is the ratio between <math>a_n</math> and <math>b_n</math>. In order to achieve a high ratio, it is necessary to add additional terms. Often, there's a net savings in time.
| |
| | |
| ==References==
| |
| {{Reflist}}
| |
| | |
| ==External links==
| |
| * {{MathWorld|urlname=Machin-LikeFormulas|title=Machin-like formulas}}
| |
| * [http://numbers.computation.free.fr/Constants/Pi/piclassic.html The constant π]
| |
| * [http://mathpages.com/home/kmath373/kmath373.htm Machin's Merit] at MathPages
| |
| * [http://milan.milanovic.org/math/english/pi/machin.html Archimedes' constant pi - Machin's formula] gives a proof for the John Machin`s formula
| |
| | |
| [[Category:Pi algorithms]]
| |