计算物理课后部分习题答案
- 格式:docx
- 大小:232.13 KB
- 文档页数:30
习题33.1选择题(1) 有一半径为R 的水平圆转台,可绕通过其中心的竖直固定光滑轴转动,转动惯量为J ,开始时转台以匀角速度ω0转动,此时有一质量为m 的人站在转台中心,随后人沿半径向外跑去,当人到达转台边缘时,转台的角速度为(A) (B) 02ωmRJ J+02)(ωR m J J +(C) (D) 02ωmRJ0ω[答案: (A)](2) 如题3.1(2)图所示,一光滑的内表面半径为10cm 的半球形碗,以匀角速度ω绕其对称轴OC 旋转,已知放在碗内表面上的一个小球P 相对于碗静止,其位置高于碗底4cm ,则由此可推知碗旋转的角速度约为(A)13rad/s (B)17rad/s (C)10rad/s (D)18rad/s (a)(b)题3.1(2)图[答案: (A)](3)如3.1(3)图所示,有一小块物体,置于光滑的水平桌面上,有一绳其一端连结此物体,;另一端穿过桌面的小孔,该物体原以角速度ω在距孔为R 的圆周上转动,今将绳从小孔缓慢往下拉,则物体(A )动能不变,动量改变。
(B )动量不变,动能改变。
(C )角动量不变,动量不变。
(D )角动量改变,动量改变。
(E )角动量不变,动能、动量都改变。
[答案: (E)]3.2填空题(1) 半径为30cm 的飞轮,从静止开始以0.5rad·s -2的匀角加速转动,则飞轮边缘上一点在飞轮转过240˚时的切向加速度a τ= ,法向加速度a n = 。
0.15; 1.256[答案:](2) 如题3.2(2)图所示,一匀质木球固结在一细棒下端,且可绕水平光滑固定轴O转动,今有一子弹沿着与水平面成一角度的方向击中木球而嵌于其中,则在此击中过程中,木球、子弹、细棒系统的 守恒,原因是 。
木球被击中后棒和球升高的过程中,对木球、子弹、细棒、地球系统的 守恒。
题3.2(2)图[答案:对o轴的角动量守恒,因为在子弹击中木球过程中系统所受外力对o轴的合外力矩为零,机械能守恒](3) 两个质量分布均匀的圆盘A和B的密度分别为ρA和ρB (ρA>ρB),且两圆盘的总质量和厚度均相同。
人教版八年级物理课后习题及答案TYYGROUP system office room 【TYYUA16H-TYY-TYYYUA8Q8-第一章机械运动第一节长度时间及测量1、许多石英电子手表具有听表的功能,通过反复尝试学会使用这个功能。
2、在一条长绳的一端系一个小铁块就做成了一个来回摆。
测出它摆动一个来回所用的时间。
怎样能测得更准确你能做一个周期为1s的摆吗答:测出小铁块摆动若干次所用的时间,然后除以摆动次数,这样测量的结果更准确。
对于后一个问题,可让学生通过不断尝试,认识到小铁块的摆动周期只与绳的长度有关。
3、各组同学之间比一比,怎样才能更精确地测量硬币的直径、硬币的周长、一页纸的厚度、铜丝直径你能想出多少种测量硬币周长的方法答:略4、用宽约2cm的牛皮纸条,自制量程为2m、分度值为1cm的卷尺。
用这个卷尺测量家里某个人的身高。
起床后和临睡前各测一次,你会发现什么?答:由于白天人们多处于站立姿势,自身的重使得骨骼间缝隙变小,因此临睡前的身高要低于起床后的身高。
5、联系电流表、温度计等测量工具的用法,总结一下,使用刻度尺时容易出现哪些错误哪些做法会引起较大的误差答:使用刻度尺常出现的错误有:(1)不注意起始刻度;(2)读数时视线与尺面不垂直测量结果不写单位;(3)刻度尺没有与被测物体重合;第二节运动的描述1.以火车头、车厢的座椅、乘客、路边的树木、房屋为参照物填空:在平稳行驶的列车中,放在行李架上的物品相对于___________是静止的,相对于___________是运动的。
答:火车;树木、房屋等。
2.坐在逆水行驶的船中的乘客,我们说他静止是以下列哪个物体为参照物的?B A.河岸上的树B.船舱 C.迎面驶来的船 D.河水3.看电视转播的百米赛跑时,我们常常感觉运动员跑的很快,但实际上他们始终处于屏幕上。
这是为什么?答:运动员和屏幕之间相对静止,而跑道在不断运动。
4.我国自1984年4月8日第一颗地球同步通信卫星以来,已经陆续发射了多颗这类通信卫星。
第九章 静电场 (Electrostatic Field)二、计算题9.7 电荷为+q 和-2q 的两个点电荷分别置于x =1 m 和x =-1 m 处.一试验电荷置于x 轴上何处,它受到的合力等于零?解:设试验电荷0q 置于x 处所受合力为零,根据电力叠加原理可得()()()()022220000(2)(2)ˆˆ0041414141q q q q q q i i x x x x εεεε⋅-⋅-+=⇒+=π-π+π-π+即:2610(3x x x m -+=⇒=±。
因23-=x 点处于q 、-2q 两点电荷之间,该处场强不可能为零.故舍去.得()223+=x m9.8 一个细玻璃棒被弯成半径为R 的半圆形,沿其上半部分均匀分布有电荷+Q ,沿其下半部分均匀分布有电荷-Q ,如题图9.4所示.试求圆心O 处的电场强度.解:把所有电荷都当作正电荷处理. 在θ 处取微小电荷d q = λd l = 2Q d θ / π它在O 处产生场强θεεd 24d d 20220R QR q E π=π=按θ 角变化,将d E 分解成二个分量:θθεθd sin 2sin d d 202R QE E x π==θθεθd cos 2cos d d 202RQE E y π-=-= 对各分量分别积分,积分时考虑到一半是负电荷⎥⎦⎤⎢⎣⎡-π=⎰⎰πππθθθθε2/2/0202d sin d sin 2R QE x =02022/2/0202d cos d cos 2R QR Q E y εθθθθεππππ-=⎥⎦⎤⎢⎣⎡-π-=⎰⎰ 所以j R Q j E i E E y x202επ-=+=9.9如图9.5所示,一电荷线密度为λ的无限长带电直导线垂直纸面通过A 点;附近有一电量为Q 的均匀带电球体,其球心位于O 点。
AOP ∆是边长为a 的等边三角形。
已知P 处场强方向垂直于OP ,求:λ和Q 间的关系。
3-1 有一半径为R 的水平圆转台,可绕通过其中心的竖直固定光滑轴转动,转动惯量为J ,开始时转台以匀角速度ω0转动,此时有一质量为m 的人站在转台中心,随后人沿半径向外跑去,当人到达转台边缘时,转台的角速度为 [ ] A.2ωmR J J + B. 02)(ωR m J J+ C.02ωmR JD. 0ω 答案:A3-2 如题3-2图所示,圆盘绕O 轴转动。
若同时射来两颗质量相同,速度大小相同,方向相反并在一直线上运动的子弹,子弹射入圆盘后均留在盘内,则子弹射入后圆盘的角速度ω将:[ ]A. 增大.B. 不变.C. 减小.D. 无法判断. 题3-2 图 答案: C3-3 芭蕾舞演员可绕过脚尖的铅直轴旋转,当她伸长两手时的转动惯量为J 0,角速度为ω0,当她突然收臂使转动惯量减小为J 0 / 2时,其角速度应为:[ ] A. 2ω0 . B. ω0 . C. 4ω0 . D. ω 0/2. 答案:A3-4 如题3-4图所示,一个小物体,位于光滑的水平桌面上,与一绳的一端相连结,绳的另一端穿过桌面中心的小孔O . 该物体原以角速度ω 在半径为R 的圆周上绕O 旋转,今将绳从小孔缓慢往下拉.则物体:[ ]A. 动量不变,动能改变; 题3-4图B. 角动量不变,动量不变;C. 角动量改变,动量改变;D. 角动量不变,动能、动量都改变。
答案:D3-5 在XOY 平面内的三个质点,质量分别为m 1 = 1kg, m 2 = 2kg,和 m 3 = 3kg,位置坐标(以米为单位)分别为m 1 (-3,-2)、m 2 (-2,1)和m 3 (1,2),则这三个质点构成的质点组对Z 轴的转动惯量J z = .答案: 38kg ·m 23-6 如题3-6图所示,一匀质木球固结在一细棒下端,且可绕水平光滑固定轴O 转动,今有一子弹沿着与水平面成一角度的方向击中木球并嵌于其中,则在此击中过程中,木球、子弹、细棒系统对o 轴的 守恒。
第1章:绪论【1.2】设准确值为* 3.78694x =,*10y =,取它们的近似值分【1.1】按有效数字的定义,从两个方面说出1.0,1.00,1.000的不同含义【解】1.0,1.00,1.000的有效数字分别是两位,三位和四位;绝对误差限分别是0.05,0.005和0.0005别为123.7869, 3.780x x ==及129.9999, 10.1y y ==,试分析1212,,,x x y y 分别具有几位有效数字。
【解】*10.000040.00005x x -=<,1x 有5位有效数字;*20.006940.005x x -=>,2x 有2位有效数字;*10.000010.0005y y -=<,1y 有4位有效数字*2||0.10.5y y -=<,2y 有2位有效数字【1.3】(1)设p 的近似数有4位有效数字,求其相对误差限。
(2)用22/7和355/113作为 3.14159265p =L 的近似值,问它们各有几位有效数字?【解】(1)其绝对误差限是0.0005,则相对误差限为0.0005/3.1420.01591%r E ==(2)22/7 3.142857...=,有3位有效数字;355/113 3.14159292...=,有7位有效数字。
【1.4】试给出一种算法计算多项式32216180x a x a x a ++的函数值,使得运算次数尽可能少。
【解】24816328163281632012012,,,,x x x x x a x a x a x a x a x a x Þ++=++,总共8次乘法,两次加法【1.5】测量一木条长为542cm ,若其绝对误差不超过0.5cm ,问测量的相对误差是多少?【解】相对误差为0.5/5420.09%Î==【1.6】已知 2.71828e =L ,试问其近似值1232.7, 2.71, 2.718x x x ===各有几位有效数字?并给出他们的相对误差限。
计算题专项练(四)(满分:46分时间:45分钟)1.(7分)趣味运动“充气碰碰球”如图所示。
用完全封闭的PVC薄膜充气膨胀成型,人钻入洞中,进行碰撞游戏。
充气之后碰碰球内气体体积为0.8 m3,压强为1.5×105 Pa。
碰撞时气体最大压缩量是0.08 m3,不考虑压缩时气体的温度变化。
(1)求压缩量最大时,球内气体的压强。
(结果保留3位有效数字)(2)为保障游戏安全,球内气体压强不能超过1.75×105 Pa,那么,在早晨17 ℃环境下充完气的碰碰球,球内气体压强为1.5×105 Pa,若升温引起的球内容积变化可忽略,请通过计算判断是否可以安全地在中午37 ℃的环境下进行碰撞游戏。
2.(9分)如图所示,在竖直平面内建立、电荷量为q的质子,自原点O以初速度v0沿x轴正方向运动。
若在以O为圆心的圆形区域内分布着垂直于xOy平面的匀强磁场,一段时间后质子沿与y轴夹角为30°方向经P点射入第二象限。
若撤去磁场,在第一象限内加一与x轴正方向夹角为150°的匀强电场(电场、磁场均未画出),该质子恰能经过y轴上的P点。
已知点P到O的距离为l,求:(1)磁场的磁感强度B的大小;(2)匀强电场的电场强度E的大小。
3.(14分)如图所示,水平面上固定两条光滑金属轨道,两导轨PQ、PR关于x轴对称放置且与x轴夹角均为θ=37°,在的金属杆CD置于y轴上时,杆两端点CD恰好与导轨和y轴的两交点重合。
整个装置处于竖直向下的匀强磁场中,磁感应强度大小为B=0.5 T。
现给杆的中点施加外力,使杆以速度v0=4 m/s沿x轴正方向匀速运动,运动过程中杆始终与y轴平行。
已知导轨和杆电阻与长度的比值均为λ=0.5 Ω/m,杆与导轨始终接触良好,接触电阻不计,sin 37°=0.6。
(提示:可以用F-x图像下的“面积”代表力F所做的功)求:(1)杆在O位置时,杆上通过的电流大小;(2)杆从O位置运动到P位置过程中,杆两端点CD间的电势差U CD与杆所在处的横坐标x的关系式;(3)杆从O位置运动到P位置,杆产生的焦耳热。
第3章函数近似方法(习题及答案)§3.1插值法【3.1.1】已知sin()x 在030,45,60的值分别为1/2,分别用一次插值和二次插值求0sin(50)近似值。
【3.1.2】误差函数的数据表:x 0.460.470.480.49…f(x)0.48465550.49374520.50274980.5116683…利用二次插值计算:(1)(0.472)f ;(2)()0.5,?f x x ==【3.1.3】【3.1.4】已知列表函数x -101y-15-5-3给出二次插值函数【解】0(0)(1)1()(1)(10)(11)2x x l x x x --==-----;1(1)(1)()(1)(1)(01)(01)x x l x x x +-==--++-2(1)(0)1()(1)(11)(10)2x x l x x x +-==++-2153()(1)5(1)(1)(1)22L x x x x x x x =--+-+--【3.1.5】已知,3)9(,2)4(==f f 用线性插值计算)5(f ,并估计误差。
【解】取插值节点014, 9x x ==,两个插值基函数分别为)9(51)(1010--=--=x x x x x x l )4(51)(0101-=--=x x x x x x l 故有565)4(53)9(52)()()(11001+=-+--=+=x x x y x l y x l x L 2.25655)5()5(1=+=»L f 误差为)(2)95)(45(!2)()5(2x x f f R ¢¢-=--¢¢=【3.1.6】已知(1)2,(1)1,(2)1f f f -===,求()f x 的二次拉格郎日插值多项式【解】22(1)(2)(1)(2)(1)(1)()21(11)(12)(11)(12)(21)(21)1(38)6x x x x x x L x x x --+-+-=++----+-+-=-+【3.1.7】求经过(0,1),(1,2),(2,3)A B C 三点的二次拉格郎日插值多项式【解】22(1)(2)(0)(2)(0)(1)()123(01)(02)(10)(12)(20)(21)1(343)2x x x x x x L x x x ------=++------=-+【3.1.8】编写拉格朗日三点插值程序,绘出)cos(x y =在[p ,0]区间的插值曲线,将[p ,0]区间8等份(9个插值点),由插值函数取25个点绘出插值曲线。
第五题/*计算物理作业 3.5题*学号:20092200129*/程序:public class sun {public static void main(String argv[]){double del=1e-6;int n=10,m=10;double h=Math.PI/(2*n);//Evaluate the derivative and output the resultint k=0;for(int i=0;i<=n;++i){double x=h*i;double d=(f(x+h)-2*f(x)+f(x-h))/(h*h);double f2=firstOrderDerivative3(x,h,d,del,k,m);double df2=f2-O(x,f2);System.out.println("x="+x);System.out.println(" f"(x)="+f2);System.out.println("Error in f"(x):"+df2);System.out.println();System.out.println();}}//Method to carry out 2st-order derivative throuth the adaptive scheme.public static double firstOrderDerivative3(double x,double h,doubled,double del,int step,int maxstep){step++;h=h/2;double d2=(f(x+h)-2*f(x)+f(x-h))/(h*h);if(step>=maxstep){System.out.println("Not converged after"+step+"recursions");return d2;}else{if((h*h*Math.abs(d-d2))<del)return(4*d2-d)/3;else return firstOrderDerivative3(x,h,d2,del,step,maxstep);}}public static double f(double x){return Math.exp(-x)*Math.log(x);}public static double O(double x,double f2){returnMath.exp(-x)*Math.log(x)-(2*Math.exp(-x))/x-Math.exp(-x)/(x*x);}}运行结果:Not converged after10recursionsx=0.0f"(x)=NaNError in f"(x):NaNx=0.15707963267948966f"(x)=-47.10058585750553Error in f"(x):3.329329885559673E-6x=0.3141592653589793f"(x)=-12.896114166464196Error in f"(x):8.610592701074893E-7x=0.47123889803846897f"(x)=-5.929972627646059Error in f"(x):1.254731920141694E-6x=0.6283185307179586f"(x)=-3.2974024228908525Error in f"(x):2.3189374909193816E-7x=0.7853981633974483f"(x)=-2.010313400857776Error in f"(x):1.0145469402367269E-6x=0.9424777960769379f"(x)=-1.2886478977422928Error in f"(x):3.5448832647055895E-7x=1.0995574287564276f"(x)=-0.8495690372991292Error in f"(x):1.4696104200240256E-7x=1.2566370614359172f"(x)=-0.568185223209793Error in f"(x):6.901975246886849E-8x=1.413716694115407f"(x)=-0.38160076561659223Error in f"(x):3.562357669961713E-8x=1.5707963267948966f"(x)=-0.25505577758216Error in f"(x):3.170312274369813E-7第六题解题思路:首先定义主函数,计算出x[i],f[i],然后调用两个子函数,两个子函数分别计算泰勒展开式求最后一项的结果和辛普森方法求得last slice的结果。
对于两个子函数来书直接用last=h*(5*y[n]+8*y[n-1]-y[n-2])/12即可求得辛普森算法的最后一个的结果而泰勒方法中最后一项等于=h*h*f(x0)的一阶导数/2+h*f[n-1]+h*h*h*f(x0)的二阶导数/二的阶乘。
对于f(x0)的一阶和二阶导数则由另外两个子程序分别计算一阶导数=c[i]=(y[i+1]-y[i-1])/(2*h);二阶导数c[i]=(y[i+1]-2*y[i]+y[i-1])/(h*h);将所得值比较即可。
源程序:import ng.*;public class n2 {static final int n=9;public static void main (String argv[]){double f[]= new double[n+1];double h=Math.PI/(2.0*n);//定义均匀间隔for(int i=0;i<=n;i++){double x=h*i;f[i]=Math.sin(x);//为f[i]赋值}double l=lastlice(f,h);double t=taylor(f,h);System.out.println("lastlice is "+l);System.out.println("taylor is "+t);if(l == t)System.out.println("they are equal");elseSystem.out.println("they are not equal");}//辛普森方法的last slicepublic static double lastlice(double f[],double h){d ouble y[]= new double [n+1];f or(int i=0;i<=n;i++){y[i]=f[i];}d ouble l=h*(5*y[n]+8*y[n-1]-y[n-2])/12;r eturn l;}public static double taylor(double f[],double h){//泰勒展开式求最后一项d ouble y[]= new double [n+1];f or(int i=0;i<=n;++i){y[i]=f[i];}d ouble fl=first(n,y,h);d ouble s=second(n,y,h);d ouble t=h*h*fl/2+h*f[n-1]+h*h*h*s/6;return t;}public static double first(int n,double y[],double h){ //定义first orderd ouble c[]=new double [n+1];f or(int i=1;i<n;i++){c[i]=(y[i+1]-y[i-1])/(2*h);}r eturn c[n-1];}p ublic static double second(int n,double y[],double h){ //定义second orderdouble c[]=new double [n+1];for(int i=1;i<n;i++){c[i]=(y[i+1]-2*y[i]+y[i-1])/(h*h);}return c[n-1];}}运行结果:lastlice is 0.1736423622701241taylor is 0.1736423622701241they are equal事实证明结果一样。
第十一题// An example of searching for a root via the secant method // for f(x)=exp(x)*ln(x)-x*x=0.import ng.*;public class Root {public static void main(String argv[]) {double del = 1e-6, a = 0, b =2;double dx = (b-a)/10, x = (a+b)/2;int n = 6;x = secant(n, del, x, dx);System.out.println("Root obtained: " + x);}// Method to carry out the secant search.public static double secant(int n, double del,double x, double dx) {int k = 0;double x1 = x+dx;while ((Math.abs(dx)>del) && (k<n)) {double d = f(x1)-f(x);double x2 = x1-f(x1)*(x1-x)/d;x = x1;x1 = x2;dx = x1-x;k++;}if (k==n) System.out.println("Convergence not" + " found after " + n + " iterations");return x1;}public static double f(double x) {return Math.exp(x*x)*Math.log(x*x)-x;}}解题思路:f(x)=ⅇx2∗Log[ⅇ,x2]−x的大致图像如图由于正割法对初始值有依赖,只能逼近较近的根,所以我们可以通过改变初始点来求解函数的多个根;容易观察到函数在[-1,2]区间上有两个根,所以调整初值求解如下:运行结果:a=-1,b=2时:Root obtained: 1.1624063469159338a=-1,b=0时:Root obtained: -0.8105015386160186第十三题// An example of searching for a minimum of a multivariable// function through the steepest-descent method.import ng.*;public class minimum13 {static double c=-1;//区间static double d=2;//区间public static void main(String argv[]) {double del = 1e-6, a = 0.1;double x =0.2;x=steepestDescent(x, a, del);//compare the functions at the points of x=c,x=ddouble min=0;double mx=0;if(g(c)>g(d)){min=g(d);mx=d;}else{min=g(c);mx=c;}//ensure the x isamong [c,d]if(x>c&&x<d){if(g(x)<min) {min=g(x);mx=x;}}System.out.println("The minimum is at"+ " x= " + mx+" "+"minimum=" +min);}// Method to carry out the steepest-descent search.public static double steepestDescent(double x,double a, double del) {double h = 1e-6;double g0 = g(x);double fi = f(x, h);double dg = 0;dg += fi*fi;dg = Math.sqrt(dg);double b = a/dg;while (dg > del) {x-= b*fi;h /= 2;fi = f(x, h);dg = 0;dg += fi*fi;dg = Math.sqrt(dg);b = a/dg;double g1 = g(x);if (g1 > g0) a/= 2;else g0 = g1;}return x;}// Method to provide the gradient of g(x).public static double f(double x, double h) {double z;double y = x;y+=h;double g0 = g(x);z = (g(y)-g0)/h;return z;}// Method to provide function g(x).public static double g(double x) {return x*x;}}运行结果:在区间[-1,2]:The minimum is at x= 0.0 minimum=0.0在区间[3,5]: The minimum is at x= 3.0 minimum=9.0第十五题程序://第十五题任时坤//let ∑=sigma=E=m=1;//so V=4(pow((1/r),12)-pow((1/r),6))//using the exp(theta) and log(ruth) to plot the relations between theta and cross section;public class Lennard15 {static final int n = 1000, m = 100;static double b;public static void main(String argv[]) {int nc = 100, ne = 2;double del = 1e-6, db = 0.5, b0 = 0.01, h = 0.01;double g1, g2;double theta[] = new double[n+1];double fi[] = new double[n+1];double sig[] = new double[m+1];for (int i=0; i<=m; ++i) {b = b0+i*db;// Calculate the first term of thetafor (int j=0; j<=n; ++j) {double r = b+h*(j+1);fi[j] = 1/(r*r*Math.sqrt(fb(r)));}g1 = simpson(fi, h);// Find r_m from 1-b*b/(r*r)-U/E = 0double rm = secant(nc, del, b, h);// Calculate the second term of thetafor (int j=0; j<=n; ++j) {double r = rm+h*(j+1);fi[j] = 1/(r*r*Math.sqrt(f(r)));}g2 = simpson(fi, h);theta[i] = 2*b*(g1-g2);}// Calculate d theta/d bsig = firstOrderDerivative(db, theta, ne);// Put the cross section in log form with the exact// result of the Coulomb scattering (ruth)//theta = abs(theta)for (int i=m; i>=0; --i) {b = b0+i*db;sig[i] = b/(Math.abs(sig[i])*Math.sin(Math.abs(theta[i])));theta[i] = Math.abs(theta[i]);double ruth = 1/Math.pow(Math.sin(theta[i]/2),4);ruth /= 16;// because of sig and ruth are always very big numbersdouble si = Math.log(sig[i]);double ru = Math.log(ruth);//useing the exp(theta)---log(ruth)://System.out.println(Math.exp(theta[i])+" "+ru);System.out.println("theta = " + theta[i]);System.out.println("ln sigma(theta) = " + si);System.out.println("ln sigma_r(theta) = " + ru);System.out.println();}}// Method to achieve the evenly spaced Simpson rule.public static double simpson(double y[], double h) { int n = y.length-1;double s0 = 0, s1 = 0, s2 = 0;for (int i=1; i<n; i+=2) {s0 += y[i];s1 += y[i-1];s2 += y[i+1];}double s = (s1+4*s0+s2)/3;// Add the last slice separately for an even n+1if ((n+1)%2 == 0)return h*(s+(5*y[n]+8*y[n-1]-y[n-2])/12);elsereturn h*s;}// Method to carry out the secant search.public static double secant(int n, double del,double x, double dx) {int k = 0;double x1 = x+dx;while ((Math.abs(dx)>del) && (k<n)) {double d = f(x1)-f(x);double x2 = x1-f(x1)*(x1-x)/d;x = x1;x1 = x2;dx = x1-x;k++;}if (k==n) System.out.println("Convergence not" +" found after " + n + " iterations");return x1;}// Method for the 1st-order derivative with the 3-point // formula. Extrapolations are made at the boundaries.public static double[] firstOrderDerivative(double h,double f[], int m) {int n = f.length-1;double[] y = new double[n+1];double[] xl = new double[m+1];double[] fl = new double[m+1];double[] fr = new double[m+1];for (int i=1; i<n; ++i)y[i] = (f[i+1]-f[i-1])/(2*h);// Lagrange-extrapolate the boundary pointsfor (int i=1; i<=(m+1); ++i) {xl[i-1] = h*i;fl[i-1] = y[i];fr[i-1] = y[n-i];}y[0] = aitken(0, xl, fl);y[n] = aitken(0, xl, fr);return y;}// The Aitken method for the Lagrange interpolation.public static double aitken(double x, double xi[],double fi[]) {int n = xi.length-1;double ft[] = (double[]) fi.clone();for (int i=0; i<n; ++i) {for (int j=0; j<n-i; ++j) {ft[j] = (x-xi[j])/(xi[i+j+1]-xi[j])*ft[j+1]+(x-xi[i+j+1])/(xi[j]-xi[i+j+1])*ft[j];}}return ft[0];}// Method to provide function f(x) for the root search.public static double f(double x) {return 1-b*b/(x*x)-4*0.01*(Math.pow(4/x, 12)-Math.pow(4/x, 6));}// Method to provide function 1-b*b/(x*x).public static double fb(double x) {return 1-b*b/(x*x);}}结果:theta = 1.846559973157913E-8ln sigma(theta) = 39.46332190354649ln sigma_r(theta) = 71.2294252391947theta = 1.9678432294709114E-8ln sigma(theta) = 41.44547859635677ln sigma_r(theta) = 70.97497043326803theta = 2.0984203072983707E-8ln sigma(theta) = 41.29685975650948ln sigma_r(theta) = 70.71798366765296theta = 2.23910832153687E-8ln sigma(theta) = 41.146741657981565ln sigma_r(theta) = 70.45841211231631theta = 2.390804116802342E-8ln sigma(theta) = 40.99510503114457ln sigma_r(theta) = 70.1962039362033theta = 2.554492433300831E-8ln sigma(theta) = 40.84190815616484ln sigma_r(theta) = 69.9313087850952theta = 2.731263311225862E-8ln sigma(theta) = 40.68710838170971ln sigma_r(theta) = 69.66366596170842theta = 2.9223164015913793E-8ln sigma(theta) = 40.530684636823345ln sigma_r(theta) = 69.39321661577095ln sigma(theta) = 40.37260354657837 ln sigma_r(theta) = 69.11990334355792theta = 3.3526957719659523E-8ln sigma(theta) = 40.21283100549856 ln sigma_r(theta) = 68.84366405467912theta = 3.595097888327986E-8ln sigma(theta) = 40.0513********ln sigma_r(theta) = 68.56443809651903theta = 3.857973084525623E-8ln sigma(theta) = 39.888040827526325 ln sigma_r(theta) = 68.28215522411509theta = 4.143302109810981E-8ln sigma(theta) = 39.72294822235678 ln sigma_r(theta) = 67.99675065188941theta = 4.453289077006872E-8ln sigma(theta) = 39.55599779288899 ln sigma_r(theta) = 67.70815120943685theta = 4.790380100420932E-8ln sigma(theta) = 39.387160641391176 ln sigma_r(theta) = 67.41628393108627theta = 5.157289538093579E-8ln sigma(theta) = 39.216384308703816 ln sigma_r(theta) = 67.12107834313481theta = 5.5570533061197186E-8ln sigma(theta) = 39.043619581398794 ln sigma_r(theta) = 66.82245102837247theta = 5.99304568799086E-8ln sigma(theta) = 38.86882832471159 ln sigma_r(theta) = 66.52032399578432theta = 6.46903786532399E-8ln sigma(theta) = 38.691957273192436 ln sigma_r(theta) = 66.21461341422884ln sigma(theta) = 38.51295815805794ln sigma_r(theta) = 65.90523242502154theta = 7.558386080179501E-8ln sigma(theta) = 38.3317748114848ln sigma_r(theta) = 65.5920922320363theta = 8.181753405028802E-8ln sigma(theta) = 38.14835589090251ln sigma_r(theta) = 65.27509705445983theta = 8.865279546306503E-8ln sigma(theta) = 37.96264830487491ln sigma_r(theta) = 64.95415308486821theta = 9.615640111509949E-8ln sigma(theta) = 37.77458657724528ln sigma_r(theta) = 64.62915917147035theta = 1.0440352998339342E-7ln sigma(theta) = 37.58411412087224ln sigma_r(theta) = 64.30000939987208theta = 1.1347885113151267E-7ln sigma(theta) = 37.39116871455187ln sigma_r(theta) = 63.96659740412114theta = 1.2347806189527687E-7ln sigma(theta) = 37.195682818068484 ln sigma_r(theta) = 63.62880933253239theta = 1.345093455251689E-7ln sigma(theta) = 36.997588804528476 ln sigma_r(theta) = 63.28652862743951theta = 1.4669530836800004E-7ln sigma(theta) = 36.796815908764096 ln sigma_r(theta) = 62.939632533761774theta = 1.6017502676726746E-7ln sigma(theta) = 36.593289325848964 ln sigma_r(theta) = 62.58799480923479ln sigma(theta) = 36.38693222724815ln sigma_r(theta) = 62.23148173935577theta = 1.9167030948119556E-7ln sigma(theta) = 36.17766504484714ln sigma_r(theta) = 61.86995631603575theta = 2.1007138338434426E-7ln sigma(theta) = 35.96540241655411ln sigma_r(theta) = 61.50327377244451theta = 2.3054472993791484E-7ln sigma(theta) = 35.750057714899796 ln sigma_r(theta) = 61.13128374882553theta = 2.5335927519312685E-7ln sigma(theta) = 35.531539119699225 ln sigma_r(theta) = 60.753829181994995theta = 2.7882362735029416E-7ln sigma(theta) = 35.30975100457115ln sigma_r(theta) = 60.37074566022896theta = 3.07292622861513E-7ln sigma(theta) = 35.08459242279057ln sigma_r(theta) = 59.98186149762503theta = 3.3917520823927016E-7ln sigma(theta) = 34.855959129143315 ln sigma_r(theta) = 59.586996098468155theta = 3.7494352488370854E-7ln sigma(theta) = 34.623741482142805 ln sigma_r(theta) = 59.18596169050993theta = 4.151441435293335E-7ln sigma(theta) = 34.38782385725622ln sigma_r(theta) = 58.77856017286608theta = 4.604110535080114E-7ln sigma(theta) = 34.14808583292972ln sigma_r(theta) = 58.36458460759438ln sigma(theta) = 33.904400024954256 ln sigma_r(theta) = 57.94381718855084theta = 5.692151840329396E-7ln sigma(theta) = 33.65663315821511ln sigma_r(theta) = 57.51602917996846theta = 6.346164715751585E-7ln sigma(theta) = 33.40464498182495ln sigma_r(theta) = 57.080980009182426theta = 7.08862596056209E-7ln sigma(theta) = 33.148287972084795 ln sigma_r(theta) = 56.63841651533806theta = 7.933367794020485E-7ln sigma(theta) = 32.8874063658783ln sigma_r(theta) = 56.188072060697465theta = 8.896690350412157E-7ln sigma(theta) = 32.62183592432788ln sigma_r(theta) = 55.72966525648614theta = 9.997857765142727E-7ln sigma(theta) = 32.351403415585345 ln sigma_r(theta) = 55.26289921759669theta = 1.1259707037666184E-6ln sigma(theta) = 32.07592576636889ln sigma_r(theta) = 54.787460186218226theta = 1.2709395789602812E-6ln sigma(theta) = 31.795209114472588 ln sigma_r(theta) = 54.30301642030872theta = 1.4379326957132678E-6ln sigma(theta) = 31.50904830915759ln sigma_r(theta) = 53.809216415418184theta = 1.6308292001151331E-6ln sigma(theta) = 31.21722588807881ln sigma_r(theta) = 53.30568784307433ln sigma(theta) = 30.919510821416043 ln sigma_r(theta) = 52.79203535679371theta = 2.1139343178147585E-6ln sigma(theta) = 30.61565773149832ln sigma_r(theta) = 52.267838964384744theta = 2.416566206005638E-6ln sigma(theta) = 30.305405437773395 ln sigma_r(theta) = 51.732651794235196theta = 2.770453722952815E-6ln sigma(theta) = 29.988475657942747 ln sigma_r(theta) = 51.18599780911595theta = 3.1856879611830147E-6ln sigma(theta) = 29.664571469016604 ln sigma_r(theta) = 50.62736916757544theta = 3.6746383340544035E-6ln sigma(theta) = 29.333375610469282 ln sigma_r(theta) = 50.05622337058027theta = 4.252536203071811E-6ln sigma(theta) = 28.99454854777367ln sigma_r(theta) = 49.47197999740563theta = 4.93822662616647E-6ln sigma(theta) = 28.647726366980937 ln sigma_r(theta) = 48.87401709509007theta = 5.755142357569132E-6ln sigma(theta) = 28.292518410731745 ln sigma_r(theta) = 48.26166711907795theta = 6.732573461354642E-6ln sigma(theta) = 27.928504575092518 ln sigma_r(theta) = 47.634212403477896theta = 7.907333024784469E-6ln sigma(theta) = 27.555232254078774 ln sigma_r(theta) = 46.99087999219401ln sigma(theta) = 27.17221300370534ln sigma_r(theta) = 46.330835826113045theta = 1.1047630828540518E-5ln sigma(theta) = 26.778918618778874 ln sigma_r(theta) = 45.653178*********theta = 1.3148109286668792E-5ln sigma(theta) = 26.374776732486097 ln sigma_r(theta) = 44.95693036066628theta = 1.5725012876565414E-5ln sigma(theta) = 25.959165866061433 ln sigma_r(theta) = 44.24103174611569theta = 1.8905037492587125E-5ln sigma(theta) = 25.531409680376637 ln sigma_r(theta) = 43.504328549712504theta = 2.2853858185053202E-5ln sigma(theta) = 25.090770478433576 ln sigma_r(theta) = 42.74556242615165theta = 2.778985758680505E-5ln sigma(theta) = 24.636441723209035 ln sigma_r(theta) = 41.96335775550143theta = 3.4003342543032086E-5ln sigma(theta) = 24.167539454931855 ln sigma_r(theta) = 41.15620691255692theta = 4.18837209046552E-5ln sigma(theta) = 23.683092446964054 ln sigma_r(theta) = 40.322453316662596theta = 5.195835833631451E-5ln sigma(theta) = 23.18203088644655ln sigma_r(theta) = 39.46027184613055theta = 6.4948782643445E-5ln sigma(theta) = 22.66317341440529ln sigma_r(theta) = 38.56764623271658ln sigma(theta) = 22.12521233161425ln sigma_r(theta) = 37.642342997328385theta = 1.0406754740503121E-4ln sigma(theta) = 21.566696875806777 ln sigma_r(theta) = 36.68188150330053theta = 1.3357132418628624E-4ln sigma(theta) = 20.98601462403819ln sigma_r(theta) = 35.68349983987055theta = 1.7320596395968308E-4ln sigma(theta) = 20.381371414537902 ln sigma_r(theta) = 34.6441165189257theta = 2.2711088897784586E-4ln sigma(theta) = 19.75077092040879ln sigma_r(theta) = 33.560288656833634theta = 3.01409068290954E-4ln sigma(theta) = 19.09194311482954ln sigma_r(theta) = 32.42816875512143theta = 4.053162908582683E-4ln sigma(theta) = 18.40251914958873ln sigma_r(theta) = 31.243371349660784theta = 5.529029996976504E-4ln sigma(theta) = 17.679849592743274 ln sigma_r(theta) = 30.001311967934182theta = 7.661195683031765E-4ln sigma(theta) = 16.921021997658006 ln sigma_r(theta) = 28.696689321881497theta = 0.0010797952324843956ln sigma(theta) = 16.12320163486973ln sigma_r(theta) = 27.323935615821338theta = 0.0015502182762195764ln sigma(theta) = 15.283874246657785 ln sigma_r(theta) = 25.87743853892223theta = 0.002269769554237988ln sigma(theta) = 14.401745878318513ln sigma_r(theta) = 24.352308741038165theta = 0.0033912436700995877ln sigma(theta) = 13.478901248373013ln sigma_r(theta) = 22.74623615888332theta = 0.005164095381224361ln sigma(theta) = 12.526616258062047ln sigma_r(theta) = 21.0641057876601theta = 0.007965793323853805ln sigma(theta) = 11.583767293951484ln sigma_r(theta) = 19.330405533020915theta = 0.012192937936150904ln sigma(theta) = 10.797226474868692ln sigma_r(theta) = 17.6276181881397theta = 0.017210180336480897ln sigma(theta) = 11.564602732336702ln sigma_r(theta) = 16.249066126079722theta = 0.014957527039389101ln sigma(theta) = 8.58553644926581ln sigma_r(theta) = 16.81019978782069theta = 0.039112308192289655ln sigma(theta) = 5.9394958026453475ln sigma_r(theta) = 12.965527261356753theta = 0.2550969665562406ln sigma(theta) = 3.1561366006712133ln sigma_r(theta) = 5.475297811713763theta = 0.6315321811346928ln sigma(theta) = 1.8701683740161505ln sigma_r(theta) = 1.9051200004245903theta = 1.040747665790346ln sigma(theta) = 1.2952272070259088ln sigma_r(theta) = 0.02242657177744099theta = 1.428172678843424ln sigma(theta) = 1.0021476205032662ln sigma_r(theta) = -1.079664214060937theta = 1.7861676543974974ln sigma(theta) = 0.8169839653186198ln sigma_r(theta) = -1.773658246046629theta = 2.1110088158201457ln sigma(theta) = 0.7031431382362978ln sigma_r(theta) = -2.2162250149887663theta = 2.369163840140268ln sigma(theta) = -0.3748970500196441ln sigma_r(theta) = -2.466540159639649theta = 1.0478280744015163ln sigma(theta) = -5.90995091993309ln sigma_r(theta) = -0.002183401622834268第十六题//using the simpson methodpublic class pendulum_16 {static final int n = 100000;static final double pi=Math.PI;static final double l=1,g=9.8;public static void main(String argv[]) {double f[] = new double[n+2];double space[] ={pi/128,pi/64,pi/32,pi/16,pi/8,pi/4,pi/2};for(int k=space.length-1;k>=0;k--){double sp=space[k];double h=sp/n;for (int i=0; i<n; i++) {double theta = h*i;f[i] = 4*Math.sqrt(l/(2*g))/Math.sqrt(Math.cos(theta)-Math.cos(sp));}double s = simpson(f, h);System.out.println("While the theta0 = "+space[k]+" The integral is: " + s); }System.out.println("The T = 2pi*sqrt(l/g) = "+2*pi*Math.sqrt(l/g));}//Method to achieve the evenly spaced Simpson rule.public static double simpson(double y[], double h) {int n = y.length-1;double s0 = 0, s1 = 0, s2 = 0;for (int i=1; i<n; i+=2) {s0 += y[i];s1 += y[i-1];s2 += y[i+1];}double s = (s1+4*s0+s2)/3;// Add the last slice separately for an even n+1if ((n+1)%2 == 0)return h*(s+(5*y[n]+8*y[n-1]-y[n-2])/12);elsereturn h*s;}}运行结果:While the theta0 = 1.5707963267948966 The integral is: 2.364243960873343 While the theta0 = 0.7853981633974483 The integral is: 2.0832788690555177 While the theta0 = 0.39269908169872414 The integral is: 2.022723192575113 While the theta0 = 0.19634954084936207 The integral is: 2.00809006000594 While the theta0 = 0.09817477042468103 The integral is: 2.0044621218895236 While the theta0 = 0.04908738521234052 The integral is: 2.003557015039689 While the theta0 = 0.02454369260617026 The integral is: 2.003330855409693 The T = 2pi*sqrt(l/g) = 2.007089923154493第十七题://用simpson方法解决此积分问题;public class problem_17 {static final double l=1,g=9.8;static final double thit=0;static final int n = 1000;static final double pi=Math.PI;public static void main(String argv[]) { double f[] = new double[n+1];double space[] ={pi/8,pi/4,pi/2};for(int k=0;k<space.length;k++){double sp=space[k];double h=sp/n;for (int i=0; i<n; i++) {double theta = h*i;f[i] = 0.5*Math.sqrt(l/(3*g))*Math.sqrt((1+3*Math.cos(theta)*Math.cos(theta))/(Math.sin(sp)-Math.sin(theta)));}double s = simpson(f, h);System.out.println("theta0 = "+space[k]+" The integral of t is: " + s); }}//Method to achieve the evenly spaced Simpson rule.public static double simpson(double y[], double h) {int n = y.length-1;double s0 = 0, s1 = 0, s2 = 0;for (int i=1; i<n; i+=2) {s0 += y[i];s1 += y[i-1];s2 += y[i+1];}double s = (s1+4*s0+s2)/3;// Add the last slice separately for an even n+1if ((n+1)%2 == 0)return h*(s+(5*y[n]+8*y[n-1]-y[n-2])/12);elsereturn h*s;}}运行结果:theta0 = 0.39269908169872414 The integral of t is: 0.22615514392751754 theta0 = 0.7853981633974483 The integral of t is: 0.3206139187126751 theta0 = 1.5707963267948966 The integral of t is: 1.1404447118395957第十八题// set : T0= 2*pi,E0=1.6,// w = T0*Math.sqrt(E0)/(2*pi*Math.sqrt(2*m))=1;// u = 10//so x(u) = ∫ (1+alfa[k]*Math.exp(-e/E0))/Math.sqrt(u-e) dxpublic class problem_18 {static final int n = 10000;static final double pi=Math.PI,u=10;static final double T0=2*pi,E0=1.6,w=1;public static void main(String argv[]) {double f[] = new double[n+1];double alfa[] = {0,0.1,1,10};for(int k=0;k<alfa.length;k++){double h=u/n;for (int i=0; i<n; i++) {double e = h*i;f[i] = (1+alfa[k]*Math.exp(-e/E0))/Math.sqrt(u-e);}double s = simpson(f, h);System.out.println("alfa = "+alfa[k]+" The integral is: " + s); }}//Method to achieve the evenly spaced Simpson rule.public static double simpson(double y[], double h) {int n = y.length-1;double s0 = 0, s1 = 0, s2 = 0;for (int i=1; i<n; i+=2) {s0 += y[i];s1 += y[i-1];s2 += y[i+1];}double s = (s1+4*s0+s2)/3;// Add the last slice separately for an even n+1if ((n+1)%2 == 0)return h*(s+(5*y[n]+8*y[n-1]-y[n-2])/12);elsereturn h*s;}}运行结果:alfa = 0.0 The integral is: 6.284751047501293 alfa = 0.1 The integral is: 6.341179576835809 alfa = 1.0 The integral is: 6.849036340846619 alfa = 10.0 The integral is: 11.927603980954794。