查看“︁梅欽類公式”︁的源代码
←
梅欽類公式
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
'''梅钦类公式'''(英语:'''Machin-like formula''')是[[数学]]中计算[[圆周率]]的一个常用技巧,它是[[約翰·梅欽|梅欽]]公式的推广,梅钦公式的形式为 :<math>\frac{\pi}{4} = 4 \arctan \frac{1}{5} - \arctan \frac{1}{239}</math> 梅钦依据此公式,把圆周率计算到一百多位小数。 梅钦类公式的形式为: {{NumBlk|:|<math>c_0 \frac{\pi}{4} = \sum_{n=1}^N c_n \arctan \frac{a_n}{b_n}</math>|{{EquationRef|1}}}} 其中, <math>a_n</math> 和 <math>b_n</math> 为正 [[整数]],且 <math>a_n < b_n</math>, <math>c_n</math> 为非零整数,且<math>c_0</math> 为正整数。 梅钦类公式的应用可结合[[反正切|反正切函数]]的[[泰勒级数]]展开: {{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}}}} ==导出== 根据[[三角恒等式#角的和差恒等式|角的和差公式]], :<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> 若 <math> -\frac{\pi}{2} < \arctan \frac{a_1}{b_1} + \arctan \frac{a_2}{b_2} < \frac{\pi}{2}.</math> 有 {{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}}}} 反复应用这一方程,可得到所有的梅欽類公式,比如最初的梅欽公式: :<math>2 \arctan \frac{1}{5}</math> ::<math>= \arctan \frac{1}{5} + \arctan \frac{1}{5}</math> ::<math>= \arctan \frac {1\times5 + 1\times5}{5\times5 - 1\times1}</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\times12 + 5\times12}{12\times12 - 5\times5}</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\times1 + (-1)\times119}{119\times1 - 120\times(-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.2C_division_and_exponentiation_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. --> ==用梅钦公式编程计算圆周率(C++)== <syntaxhighlight lang="C++"> #include<stdio.h> #include<iostream> using namespace std; int main(void) { //本程序每四位数输出,如果请求计算的位数不是4的整数倍,最后输出可能会少1~3位数 long a[2]={956,80},b[2]={57121,25},i=0,j,k,p,q,r,s=2,t,u,v,N,M=10000; printf("%9cMachin%6cpi=16arctan(1/5)-4arctan(1/239)\nPlease input a number.\n",32,32); cin>>N,N=N/4+3; long *pi=new long[N],*e=new long[N]; while(i<N)pi[i++]=0; while(--s+1) { for(*e=a[k=s],i=N;--i;)e[i]=0; for(q=1;j=i-1,i<N;e[i]?0:++i,q+=2,k=!k) for(r=v=0;++j<N;pi[j]+=k?u:-u)u=(t=v*M+(e[j]=(p=r*M+e[j])/b[s]))/q,r=p%b[s],v=t%q; } while(--i)(pi[i]=(t=pi[i]+s)%M)<0?pi[i]+=M,s=t/M-1:s=t/M; for(cout<<"3.";++i<N-2;)printf("%04ld",pi[i]); delete []pi,delete []e,cin.ignore(),cin.ignore(); return 0; } </syntaxhighlight> == 參考文獻 == * {{MathWorld|urlname=Machin-LikeFormulas|title=Machin-like formulas}} * [http://numbers.computation.free.fr/Constants/Pi/piclassic.html The constant π] {{Wayback|url=http://numbers.computation.free.fr/Constants/Pi/piclassic.html |date=20120204044407 }} * [http://www.mathpages.com/home/kmath373.htm Machin's Merit] {{Wayback|url=http://www.mathpages.com/home/kmath373.htm |date=20101127043601 }} at MathPages * [https://web.archive.org/web/20120119034334/http://milan.milanovic.org/math/english/pi/machin.html Archimedes' constant pi - Machin's formula] gives a proof for the John Machin`s formula * GUIDORIZZI, Hamilton Luiz. ''Um Curso de Cálculo'', vol. 4. 3ª edição. Rio de Janeiro: Livros Técnicos e Científicos Editora, 1999. [[Category:数学恒等式]] [[Category:圆周率算法]] [[Category:级数]]
该页面使用的模板:
Template:MathWorld
(
查看源代码
)
Template:NumBlk
(
查看源代码
)
Template:Wayback
(
查看源代码
)
返回
梅欽類公式
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息