- 1、本文档共16页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
* 第二章 非线性方程求根 /* Solutions of Nonlinear Equations */ §1 多项式基础 /* Polynomials */ (自习) §2 二分法 /* Bisection Method */ 求 f (x) = 0 的根 原理:若 f ?C[a, b],且 f (a) · f (b) 0,则 f 在 (a, b) 上必有一根。 §2 Bisection Method a b x1 x2 a b When to stop? 或 不能保证 x 的精度 x* ?2 x x* §2 Bisection Method 误差 分析: 第1步产生的 有误差 第 k 步产生的 xk 有误差 对于给定的精度 ? ,可估计二分法所需的步数 k : ①简单; ② 对f (x) 要求不高(只要连续即可) . ①无法求复根及偶重根 ② 收敛慢 注:用二分法求根,最好先给出 f (x) 草图以确定根的大概位置。或用搜索程序,将[a, b]分为若干小区间,对每一个满足 f (ak)·f (bk) 0 的区间调用二分法程序,可找出区间[a, b]内的多个根,且不必要求 f (a)·f (b) 0 。 §2 Bisection Method Lab 02. Bisection Method Use the Bisection method to find on m given intervals the m real roots of a given polynomial of degree 5 ? n ? m, . Input There are several sets of inputs. For each set: The 1st line contains an integer n which is the degree of a polynomial. n = ?1 signals the end of file. The 2nd line contains n+1 real numbers which are the coefficients of the polynomial. The numbers are separated by spaces. The 3rd line contains an integer Max and two real numbers eps1 and eps2, where Max is the maximum number of iterations, eps1 is the accuracy bound for x and eps2 is the accuracy bound for p(x). The 4th line contains an integer m (n ? m ? 0), followed by m pairs of real numbers a1 b1 …am bm which are the end points of the intervals [ a1 , b1 ] …[ am , bm ]. Output? Each root is to be printed as in the C fprintf: fprintf(outfile, %12.7f?, root ); /* here ? represents a space */ If there is no root found in an interval, simply print “no?root?”. The output of the next set must be printed in a new line. Sample Input (? represents a space) 2 1?0??1 1000?002??2??0.5?0.5?2 3 1?0?0??1 1000?002??1?0?0?2 ?1 Sample Output (? represents a space) ???1.0000000????1.0000000? no?root????1.0000000? §2 Bisection Method ? 试位法 /* Regula Falsi Method */ a b (a+b)/2 x* (a, f (a)) (b, f (b)) Is it re
文档评论(0)