1、 Euler 法和预估校正法求解初值问题Euler 法和预估校正法求解初值问题摘要在数学与计算科学中,Euler 法是一种一阶数值方法,通常用于对给定初值的常微分方程(初值问题)的求解。Euler 法的基本思想是迭代,就是逐次替代,然后求出所要求的解,并达到一定的精度。Euler 法思想是简单地取切线的端点作为下一步的起点进行计算,当步数增多时,误差会因积累而越来越大,因此 Euler 法一般不用于实际计算。为提高精度,需要在 Euler 法的基础上进行改进,即为预估校正法。预估校正法的精度为二阶,思想是采用区间两端的函数值的平均值作为直线方程的斜率。预估校正法先用 Euler 法求出预报值,
2、再利用梯形公式求出校正值,局部截断误差比 Euler法低了一阶,较大程度地提高了计算精度。并编写 MATLAB 程序实现两种数值解法,通过作图对比其精度,加深对两种方法的认识。关键字:Euler 法,预估校正法,MATLAB 软件Euler 法和预估校正法求解初值问题EULER METHOD AND FORECAST CORRECTION METHOD FOR SOLVING INITIAL VALUE PROBLEMSABSTRACTIn mathematics and computer science, the Euler method is a numerical method. It
3、is usually used to solve the equations of the given initial value(initial value problems),Eulers basic method is iterative, that is to say, the ideal is successive substitution, then, find out the required solution and achieved a certain accuracy. Euler method simply means take as the starting point
4、 of the next step to calculate the tangent of the end point, when numbers increase, errors due to the accumulation of more and more big. So, the Euler method is generally not used for practical calculation. In order to improve the accuracy, we need to be on the basis of Euler method was improved, th
5、e forecast correction method. Forecasts for the second order correction method of the precision, using the average value of a function as a linear equation at each end of the range of the slope. Forecast correction method with Euler method first predicted value, using trapezoid formula to find the c
6、orrection, the local truncation error lower than the Euler method, greatly improve the calculation accuracy. By write MATLAB program to realize two methods, and through comparing the drawing accuracy, deepen understanding of the two methods.Key words: Euler method, forecast correction method, MATLAB
7、Euler 法和预估校正法求解初值问题目录1 欧拉法11.1 Euler方法简介.11.1.1 Euler 格式21.1.2 欧拉方法的误差估计22 预估校正法.62.1 预估校正法简介621.1 预估校正法.62.2.2 预估校正法的误差估计63.实例以及结果分析.43.1 Euler 法与预估校正法的 Matlab 实例及实现3.1.1 实例 1 的求解及 Matlab 实现.73.1.2 实例 2 的求解及 Matlab 实现.3.1.3 实例 3 的求解及 Matlab 实现.参考文献10附录11Euler 法和预估校正法求解初值问题第 1 页 共 18 页Euler 法1.1Eule
8、r 方法一阶常微分方程的初值问题,其一般形式为 (1)0(,)yfx我们知道,只要函数 f(x,y)适当光滑-譬如关于 y 满足 Lipschitz 条件 (,),;xyfL理论上就可以保证初值问题(1)的解 存在且唯一。所谓数值解法,就是求问题(1)在某些离散节点 a=x0 Euler(fun,0,1,0.1,10)T = Columns 1 through 10 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.90001.0000 1.1000 1.1918 1.2774 1.3582 1.4351 1.5090 1.
9、5803 1.6498 1.7178Column 111.00001.7848 Euler(fun,0,1,0.2,5)T = 0 0.2000 0.4000 0.6000 0.8000 1.00001.0000 1.2000 1.3733 1.5315 1.6811 1.8269预估校正法:M 文件:Euler_modify.mfunction E=Euler_modify(fun,x0,y0,h,N)x=zeros(1,N+1);y=zeros(1,N+1);x(1)=x0;y(1)=y0;for n=1:Nx(n+1)=x(n)+h;Euler 法和预估校正法求解初值问题第 15 页 共
10、 18 页z0=y(n)+h*feval(fun,x(n),y(n);y(n+1)=y(n)+h/2*(feval(fun,x(n),y(n)+feval(fun,x(n+1),z0);endT=x;y Euler_modify(fun,0,1,0.1,10)T = Columns 1 through 9 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.80001.0000 1.0959 1.1841 1.2662 1.3434 1.4164 1.4860 1.5525 1.6165Columns 10 through 11 0.9000 1.00001.6782 1.7379 Euler_modify(fun,0,1,0.2,5)T = 0 0.2000 0.4000 0.6000 0.8000 1.00001.0000 1.1867 1.3483 1.4937 1.6279 1.7542