π的近似计算

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

实验报告

课程名称:数学实验

实验名称:π的近似计算

实验目的、要求:

1.了解圆周率π的计算历程。

2.了解计算π的割圆术、韦达公式、级数法、拉马努金公式、迭代法。

3.学习、掌握MATLAB 软件有关的命令。

实验仪器:

安装有MA TLAB 软件的计算机

实验步骤:

一、 实验内容

1.内容

π是人们经常使用的数学常数,对π的研究已经持续了2500多年,今天,这种探索还在继续中。1.割圆术。2.韦达(VieTa )公式。3.利用级数计算π。4.拉马努金(Ranmaunujan )公式。5.迭代方法。6.π的两百位近似值。

计算π的近似值:

2. 原理

1、 刘徽的迭代公式

1106.2 6.2 6.2 6.224, 3.2,1n n n n n x x s x x ++=--==

2、利用韦达(VieTa )公式

22222

222222...2222π

++++++= 3、莱布尼茨级数 n 1(1)=421n

n π∞=-+∑

4、级数加速后的公式

2121n 0n 011(1)1(1)116arctan 4arctan 164523921521239k k k k k k π∞∞++==--=-=⋅-⋅++∑∑

5、拉马努金公式

4n 01

22(4)!110326396=9801396n n n π∞=+⋅∑(n!)

二、实验结果

练习1 用刘徽的迭代公式

11 6.206.2 6.2 6.224, 3.2,1n n n n x x s x x ++=--==

计算π的近似值。

相应的MA TLAB 代码为

>>clear;

>>x=1;

>>for i=1:30

>>x=vpa (sqrt(2-sqrt(4-x^2)),15)%计算精度为15位有效数字

>>S=vpa(3*2^i*x,10)

>>end

计算可得

x =.517638********* S =3.105828541

x =.261052384440103 S =3.132628613 …

练习题 1.1106.2 6.2 6.2 6.224, 3.2,1n n n n n x x s x x ++=--==,计算π的近似值,迭代50次,有效数字取为100位。

解:

x=.5176380902050415899751101278525311499834060668945312500000000000000000000000000000000000000000000000

S =3.105828541

x =.26105238444010321659775747351901 S =3.132628613

x =.13080625846028615048946927650964 S =3.139350203

x =.65438165643552292570302790136363e-1 S =3.141031951

x =.32723463252973567509131365534310e-1 S =3.141452472

x =.16362279207874260682204029836769e-1 S =3.141557608

x =.81812080524695802451715035172989e-2 S =3.141583892

x =.40906125823281907567941283992211e-2 S =3.141590463

x =.20453073606766093463703416909438e-2 S =3.141592106

x =.10226538140273951344639001691572e-2 S =3.141592517

x =.51132692372483469411943625174689e-3 S =3.141592619

x =.25566346395130951352151834359580e-3 S =3.141592645

x =.12783173223676627836851115115739e-3 S =3.141592651

x =.63915866151022079410225244625580e-4 S =3.141592653

x =.31957933079590907234139446466181e-4 S =3.141592653

x =.15978966540305437058221873847277e-4 S =3.141592654

x =.79894832702164664592540752808922e-5 S =3.141592654

x =.39947416351162017209013439939351e-5 S =3.141592654

x =.19973708175590969218580033534076e-5 S =3.141592654

x =.99868540877967296859318388180810e-6 S =3.141592654

x =.49934270438985204773114636404083e-6 S =3.141592654

x =.24967135219492796927298869033863e-6 S =3.141592654

x =.12483567609746422765596560845085e-6 S =3.141592654

x =.62417838048732144468262246567435e-7 S =3.141592654

x =.31208919024366076239396409864371e-7 S =3.141592654

x =.15604459512183038119698204932186e-7 S =3.141592654

x =.78022297560915174577429878338312e-8 S =3.141592654

x =.39011148780457619330837231814377e-8 S =3.141592654

x =.19505574390228809665418615907189e-8 S =3.141592654

x =.97527871951145330011984785335838e-9 S =3.141592654

x =.48763935975575228375775804183490e-9 S =3.141592654

x =.24381967987797867667021545728558e-9 S =3.141592654

x =.12190983993919440791778038578154e-9 S =3.141592654

x =.60954919969597203958890192890768e-10 S =3.141592654

x =.30477459984388462814097367475721e-10 S =3.141592654

x =.15238729993014509737727583788009e-10 S =3.141592654

x =.76193649997883681907846134144596e-11 S =3.141592655

x = .38096825064564107321692503847144e-11 S =3.141592660

x =.19048412532282053660846251923572e-11 S =3.141592660

x =.95242065286300884583045335519372e-12 S =3.141592747

x =.47621035268040950056566904654351e-12 S =3.141592920

x =.23810522883800767133458981166171e-12 S =3.141593613

x =.11905250942336326914690870705313e-12 S =3.141590842

x =.59526464702684973075452865921534e-13 S =3.141601925

x =.29764072302022114258805759148830e-13 S =3.141690584

x =.14882876066137216880187288510066e-13 S =3.141867896

x =.74431176263713581056781550557580e-14 S =3.142577041

x =.37282703764614497175334507121310e-14 S =3.148244452

x =.18708286933869706927918743661583e-14 S =3.159548777

x =.94868329805051379959966806332982e-15 S =3.204367311

2. 利用利用韦达公式,构造出一类算法来计算π的近似值,并进行实际计算,评价算法效果。解:

相关文档
最新文档