资源预览内容
第1页 / 共51页
第2页 / 共51页
第3页 / 共51页
第4页 / 共51页
第5页 / 共51页
第6页 / 共51页
第7页 / 共51页
第8页 / 共51页
第9页 / 共51页
第10页 / 共51页
亲,该文档总共51页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
第八章非线性方程及非线性方程组解决,x0,x1,a1,b2,x*,1区间对分法(二分法),1. 确定有根区间:,2. 逐次对分区间:,3. 取根的近似值:,b1,a2,其误差为:,根的近似值:,用对分区间法求根步骤:, f=inline(x3+10*x-20,x); x,err=bisection(f,1,2,0.00005,15) n x err 1.00000000000000 1.50000000000000 0.50000000000000 2.00000000000000 1.75000000000000 0.25000000000000 3.00000000000000 1.62500000000000 0.12500000000000 4.00000000000000 1.56250000000000 0.06250000000000 5.00000000000000 1.59375000000000 0.03125000000000 6.00000000000000 1.60937500000000 0.01562500000000 7.00000000000000 1.60156250000000 0.00781250000000 8.00000000000000 1.59765625000000 0.00390625000000 9.00000000000000 1.59570312500000 0.00195312500000 10.00000000000000 1.59472656250000 0.00097656250000 11.00000000000000 1.59423828125000 0.00048828125000 12.00000000000000 1.59448242187500 0.00024414062500 13.00000000000000 1.59460449218750 0.00012207031250 14.00000000000000 1.59454345703125 0.00006103515625 15.00000000000000 1.59457397460938 0.00003051757813x = 1.59457397460938err =3.051757812500000e-005,2简单迭代法,2.1 简单迭代法的一般形式及其几何意义,显然,此迭代序列发散。, f=inline(x3+11*x-20,x); iteration(f)enter initial guess x1=1.5allowable tolerance tol=0.01maximum number of iterations max=3zero not found to desired tolerance step x 1.0000 1.5000 2.0000 -0.1250 3.0000 -21.3770ans = 1.5000 -0.1250 -21.3770, f=inline(20/(x2+10),x); iteration(f)enter initial guess x1=1.5allowable tolerance tol=0.0000005maximum number of iterations max=20iteration method has convergedstep x 1.00000000000000 1.50000000000000 2.00000000000000 1.63265306122449 3.00000000000000 1.57908582703058 4.00000000000000 1.60083088897285 5.00000000000000 1.59201958344383 6.00000000000000 1.59559279984346 7.00000000000000 1.59414421311147 8.00000000000000 1.59473154634776 9.00000000000000 1.59449342271545 10.00000000000000 1.59458996763346 11.00000000000000 1.59455082476108 12.00000000000000 1.59456669477999 13.00000000000000 1.59456026047567 14.00000000000000 1.59456286918682 15.00000000000000 1.59456181151656 16.00000000000000 1.59456224033616,代入初值得:,例2的结果表明,对同一方程可构造不同的迭代格式,产生的迭代序列收敛性也不同。迭代序列的收敛性取决于迭代函数在方程的根的邻近的性态。,2.2 1.迭代法的收敛条件,由定理8.2,迭代收敛,2.3Steffensen (斯蒂芬森)方法简单迭代法的加速,(一)收敛速度,(二)Steffensen(斯蒂芬森)方法,将Aitken(埃特肯)加速技巧用于线性收敛的迭代序列,即得Steffensen方法,其计算过程为,iter_steffen(leonardo_iter)enter initial guess x1=2allowable tolerance tol=0.000001maximum number of iterations max=10iteration method has convergedstep x 1 2.00000000000000 2 1.19028340080972 3 1.35956267950143 4 1.36878079644430 5 1.36880810758180 6 1.36880810782137, iteration(leonardo_iter)enter initial guess x1=2allowable tolerance tol=0.0001maximum number of iterations max=10zero not found to desired tolerancestep x 1 2.00000000000000 2 0.40000000000000 3 1.96160000000000 4 0.47562601431040 5 1.94399636218919 6 0.50951571468586 7 1.93485140020862 8 0.52692937882011 9 1.92983865092369 10 0.53641914395953,function f=leonardo_iter(x)f=(20-x.3-2*x.2)/10,function f=leonardo(x)%达芬奇在1425年研究此方程%并得到1.368808107f=x.3+2*x.2.+10*x-20, Newton法与弦截法,3.1Newton法,基本思想:将非线性方程线性化,以线性方程的解 逼近非线性方程的解。,由此导出迭代公式,解:,代入初值得:,Newton法迭代公式为,由定理8.4,Newton法至少二阶收敛。,以上两种改进都是至少二阶收敛的。,在Newton公式中,用差商代替导数,即,即得迭代公式,3.2弦截法,切线 /* tangent line */,割线 /* secant line */,切线斜率割线斜率,证明略,因弦截法非单步法,不能用定理8.4判别证明参考(关治,陆金甫 数值分析基础)。, newton(leonardo,leonardo_pr)enter initial guess x1=2allowable tolerance tol=0.000001maximum number of iterations max=10Newton method has convergedstep x y 1 2.00000000000000 16.000000000000000 2 1.46666666666667 2.123851851851853 3 1.37151201380592 0.057086641904323 4 1.36881022263390 0.000044614406963 5 1.36880810782267 0.000000000027313 6 1.36880810782137 0.000000000000000ans = 2.0000 1.4667 1.3715 1.3688 1.3688 1.3688,function f=leonardo_pr(x)f=3*x.2.+4*x+10,function f=leonardo(x)f=x.3+2*x.2.+10*x-20, secant(leonardo)enter initial guess x0=1enter initial guess x1=2allowable tolerance tol=0.000001maximum number of iterations max=10secant method has converged step x y 1 1.00000000000000 -7.000000000000000 2 2.00000000000000 16.000000000000000 3 1.30434782608696 -1.334757951836934 4 1.35791230465787 -0.229135729587330 5 1.36901332599257 0.004329568312105 6 1.36880745972192 -0.000013672393695 7 1.36880810778288 -0.000000000812143ans = 1.0000 2.0000 1.3043 1.3579 1.3690 1.3688 1.3688,
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号