第九章常微分方程数值解 / Numerical Methods for Ordinary Differential Equations 6考虑一阶常微分方程的初值问题/ Initial-Value Problem*: d tf(x,y)x∈la,b y(a)=yo 只要∫(x,y)在{a,b×R上连续,且关于y满足 Lipschitz条 件,即存在与x,y无关的常数L使|(x,yn)-f(x,y2)SL|-y2 对任意定义在{a,b上的y(x)和y2(x)都成立,则上述IVP存 在唯一解。 要计算出解函数y(x)在一系列节点a=xx1<xn=b 处的近似值v≈y(x;)(=1,…,n) 节点间距h=x1-X(=…,n-1)为步长,通常采用等距节点, 即取h=h(常数)
第九章 常微分方程数值解 /* Numerical Methods for Ordinary Differential Equations */ 考虑一阶常微分方程的初值问题 /* Initial-Value Problem */: = = 0 ( ) ( , ) [ , ] y a y f x y x a b dx dy 只要 f (x, y) 在[a, b] R1 上连续,且关于 y 满足 Lipschitz 条 件,即存在与 x, y 无关的常数 L 使 对任意定义在 [a, b] 上的 y1 (x) 和 y2 (x) 都成立,则上述IVP存 在唯一解。 | ( , ) ( , )| | | 1 2 1 2 f x y − f x y L y − y 要计算出解函数 y(x) 在一系列节点 a = x0< x1<…< xn= b 处的近似值 y y(x ) (i 1, ... ,n) i i = 节点间距 为步长,通常采用等距节点, 即取 hi = h (常数)。 ( 0, ... , 1) hi = xi+1 − xi i = n −
§1欧拉方注 亦称为欧拉折线法 向前去 Euler's polygonal arc method/ y(x)y/x(x)=y+b/(x,)运为y y+1=y2+hf(x1,y)(i=0,…,n-1) 定义在假设y=y(x),即第i步计算是精确的前提下,考 虑的截断误差R1=y(x1)-y称为局部截断误差 F local truncation error */ 定义若其然 阶精度。 R的主项OP"),则称该算法有p / leading term */ 欧拉法的局联在 R=y(x)h=1m)++号y(x)+O)+(川 ="y(x;)+O(h)欧拉法具有1阶精度
§1 欧拉方法 /* Euler’s Method */ ➢ 欧拉公式: x0 x1 向前差商近似导数 h y x y x y x ( ) ( ) ( ) 1 0 0 − ( ) ( ) ( ) ( , ) 1 0 0 0 0 0 y x y x + hy x = y + h f x y 1 y 记为 ( , ) ( 0, ... , 1) yi+1 = yi + h f xi yi i = n − 定义 在假设 yi = y(xi ),即第 i 步计算是精确的前提下,考 虑的截断误差 Ri = y(xi+1 ) − yi+1 称为局部截断误差 /* local truncation error */。 定义 若某算法的局部截断误差为O(h p+1 ),则称该算法有p 阶精度。 欧拉法的局部截断误差: ( ) [ ( ) ( ) ( ) ( )] [ ( , )] 3 1 1 2 2 i i i i h i i i i i R = y x − y = y x + hy x + y x +O h − y + hf x y + + ( ) ( ) 3 2 2 y xi O h h = + 欧拉法具有 1 阶精度。 Ri 的主项 /* leading term */ 亦称为欧拉折线法 /* Euler’s polygonal arc method*/
8 1 Euler's Method >欧拉公式的改进: a隐式欧拉法/ implicit Euler method* 向后差商近似导数一y(x)yx)y(x yoyo thf(xu,y(D Vi+1=y; the Hey! Isnt the leading term of the loca truncation errorof Euler's method y(x)? 由于末为 Seems that we can make a good 到,故 称为隐式 use of it 式/ explicit*/ 欧拉公式。 一般先用显式计算一个初值,再迭代求解 隐式欧拉法的局部截断误差: R;=y(x11)-y=-2y(x)+O(h) 即隐式欧拉公式具有1阶精度
§1 Euler’s Method ➢ 欧拉公式的改进: 隐式欧拉法 /* implicit Euler method */ 向后差商近似导数 h y x y x y x ( ) ( ) ( ) 1 0 1 − x0 x1 ( ) ( , ( )) 1 0 x1 y x1 y x y + h f ( , ) ( 0, ... , 1) 1 1 1 = + = − yi+ yi h f xi+ yi+ i n 由于未知数 yi+1 同时出现在等式的两边,不能直接得到,故 称为隐式 /* implicit */ 欧拉公式,而前者称为显式 /* explicit */ 欧拉公式。 一般先用显式计算一个初值,再迭代求解。 隐式欧拉法的局部截断误差: 1 1 ( ) i = i+ − i+ R y x y ( ) ( ) 3 2 2 y xi O h h = − + 即隐式欧拉公式具有 1 阶精度。 Hey! Isn’t the leading term of the local truncation error of Euler’s method ? Seems that we can make a good use of it … ( ) 2 2 i h y x
§1 Euler' s Method 梯形公式/ trapezoid formula一显、隐式两种算法的平均 J=2+,Uf(x,y)+f(x1m)(i=0,…,n-1 注:的确有局部都 即梯严需要2个初值y和y1来启动递推 但过程,这样的算法称为双步法/ double-step 迭 method,而前面的三种算法都是单步法 / single-step method*1o a中点欧拉公式/m 中心差商近似导岁y(x)=Xx)yx h →y(x2)≈y(yx2hf(x,y(x1) yH+1=y1+2hf(x,y)i=1,…,n-1 假设n=y(x1,y1=y(x),则可以导出R=yx-)-yn=0(h) 即中点公式具有2阶精度
§1 Euler’s Method 梯形公式 /* trapezoid formula */ — 显、隐式两种算法的平均 [ ( , ) ( , )] ( 0, ... , 1) 2 +1 = + f x y + f x +1 y +1 i = n − h y y i i i i i i 注:的确有局部截断误差 , 即梯形公式具有2 阶精度,比欧拉方法有了进步。 但注意到该公式是隐式公式,计算时不得不用到 迭代法,其迭代收敛性与欧拉公式相似。 ( ) ( ) 3 Ri = y xi+1 − yi+1 = O h 中点欧拉公式 /* midpoint formula */ 中心差商近似导数 h y x y x y x 2 ( ) ( ) ( ) 2 0 1 − x0 x1 x2 ( ) ( ) 2 ( , ( )) 2 0 1 x1 y x y x + h f x y yi+1 = yi−1 + 2h f (xi , yi ) i = 1, ... ,n−1 假设 ,则可以导出 即中点公式具有 2 阶精度。 ( ), ( ) i 1 i 1 i i y = y x y = y x − − ( ) ( ) 3 Ri = y xi+1 − yi+1 = O h 需要2个初值 y0和 y1来启动递推 过程,这样的算法称为双步法 /* double-step method */,而前面的三种算法都是单步法 /* single-step method */
&1 Euler's Method 方法 显式欧拉 简单 精度低 隐式欧拉 稳定性最好精度低,计算量大 梯形公式 精度提高计算量大 中点公式精度提高,显式 多一个初值, 可能影响精度 with OK,let’s ledy make it possible
方 法 §1 Euler’s Method 显式欧拉 隐式欧拉 梯形公式 中点公式 简单 精度低 稳定性最好 精度低, 计算量大 精度提高 计算量大 精度提高, 显式 多一个初值, 可能影响精度 Can’t you give me a formula with all the advantages yet without any of the disadvantages? Do you think it possible? OK, let’s Well, call me greedy… make it possible