- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
计算物理lecture1103
例题 例 用Newton法求 在(0,?/2)内 的近似解。 迭代法的几何意义 交点的横坐标 4. Secant method 割线, 正切 Convergence on the root using the secant method Divergence using the secant method =1.618 =0.618 例:用割线法求方程 在x = 1.5附近的根,使绝对误差精确到10-4。 按上式计算得: 解:取初值x0 = 1.5,x1 = 1.4,按公式 得迭代格式 x2 = 1.33522;x3 = 1.32541; x4 = 1.32472; x5 = 1.32472 取x* ? 1.32472 f(x)=exp(x)*ln(x)-x2 f(1)=-1 f(2)=1 x?[1,2] A=1.0 B=2.0 DX=(B-A)/10.0 X0=(A+B)/2.0 WRITE(*,*) ISTEP,X0,DX STOP END Call secant(DL,X0,DX,ISTEP) FUNCTION F(X) F=exp(x)*ALOG(x)-X*X RETURN END DL=1.0E-06 DO WHILE(ABS(DX).GT.DL) D= F(X1)- F(X0) X2=X1-(X1-X0)* F(X1)/D X0=X1 X1=X2 DX=X1-X0 X1=X0+DX ISTEP=0 ISTEP=ISTEP+1 ENDDO SUBROUTINE secant(DL,X0,DX,ISTEP) RETURN END 5. Direct iteration (直接迭代法) 迭代法是求方程近似根的一个重要方法,也是计算方法中的一种基本方法,它的算法简单,应用范围广,故学好这一方法对以后的学习也很有帮助。 简单迭代法 从而构成序列 简单迭代法的基本思想是:将方程f (x) = 0化为一个等价的方程 给定一个初值x0,由上式可算得x1 = ? (x0),再将x1代入上式的右端又可得x2 =? (x1),…。我们称{xk}为迭代序列,而称 x=? (x) 中的? (x)为迭代函数,上式为迭代格式。如果? (x)连续,迭代序列{xk}收敛于x*,则x*就是方程 x=? (x) 的解。 方程f (x) = 0 等价于方程 y=x ? í ì = = T = ) ( ) ( x y x y x x j j y=?(x) 方程f (x) = 0 * * 第四章: Root finding in one dimension 1. Bisection method 3. The Newton method 4. Secant (chord) method 2. Linear interpolation (regula falsi) 5. Direct iteration 1. Bisection method If there is a root in the region x?[a,b] for f(x)=0, we can use Bisection method to find it within a required accuracy. * if fc = f(xc) = 0 then x = xc is an exact solution, *else if fa fc0 then the root lies in the interval (xa, xc), then replacing the interval (xa, xb) with (xa, xc). *else the root lies in the interval (xc, xb), then replacing the interval (xa, xb) with (xc, xb). We repeat this interval halving until either the exact root has been found or the interval is smaller than some specified tolerance. The basic algorithm for the bisection method relies on repeated application of * Let xc = (xa+xb)/2, en |xa - xb|. en+1 ~ en /2. p = 1 and C = 1/
文档评论(0)