- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
常微分方程初值问题的数值解法 举例: 例 本章要求 要求熟练掌握的内容: 欧拉格式和改进欧拉格式的基本公式,计算步骤,算法; 运用经典龙格-库塔法求常微分方程数值解。 要求掌握的内容: 龙格-库塔法的基本思想,计算格式的导出; 单步法局部截断误差及阶的定义和计算。 注: ? 龙格-库塔法的主要运算在于计算 Ki 的值,即计算 f 的值。Butcher 于1965年给出了计算量与可达到的最高精度阶数的关系: 7 5 3 可达到的最高精度 6 4 2 每步须算Ki 的个数 ?高于四阶时每步计算量增加较多,但精度提高不快,因此使用的比较少。 ?由于龙格-库塔法的导出基于泰勒展开,故精度主要受解函数的光滑性影响。对于光滑性不太好的解,最好采用低阶算法而将步长h 取小。 Lab 15. Runge-Kutta (Order Four) Use Runge-Kutta method of order four to approximate the solution of the initial-value problem , , and (1) You are supposed to write a function void RK4 ( double (*f)( ), double a, double b, double y0, int n, FILE *outfile) to approximate the solution of Problem (1) with y’= f, x in [a, b], and the initial value of y being y0. Output the approximating values of y on the n+1 equally spaced grid points from a to b to outfile. Input There is no input file. Instead, you must hand in your function in a *.h file. The rule of naming the *.h file is the same as that of naming the *.c or *.cpp files. Output (? represents a space) For each test case, you are supposed to print n+1 lines, and each line is in the following format: fprintf( outfile, “%8.4f?%12.8e\n”, x, y ); Sample Judge Program #include stdio.h #include math.h #include15.h ? double f0(double x, double y) { return (y?x*x+1.0); } ? void main( ) { FILE *outfile = fopen(out.txt, w); int n; double a, b, y0; ? a = 0.0; b = 2.0; y0 = 0.50; n = 10; RK4(f0, a, b, y0, n, outfile); fprintf(outfile, \n); fclose(outfile); } Sample Output (? represents a space) ??0.0000?5?001 ??0.2000?8?001 ??0.4000?1+000 ??0.6000?1+000 ??0.8000?2+000 ??1.0000?2+000 ??1.2000?3+000 ??1.4000?3+000 ??1.6000?4+000 ??1.8000?4+000 ??2.0000?5+000 §3 收敛性与稳定性 /* Convergency and Stability */ ? 收敛性 /* Convergency */ 定义 若某算法对于任意固定的 x = xi = x0 + i h,当 h?0 ( 同时 i ? ?) 时有 yi ?
您可能关注的文档
最近下载
- ××公司第二届掼蛋比赛活动方案.doc VIP
- 《重症医学》教学大纲要点.doc VIP
- 人教版 (2024) 七年级上册Starter Unit 3 welcome 课件+音频(共26张PPT).pptx VIP
- 锥套零件的机械加工工艺规程制订及锥套工序专用夹具设计.doc VIP
- 2024年全国职业院校技能大赛高职组(建筑装饰数字化施工赛项)备赛试题库(含答案).docx VIP
- 06216中外建筑史2007年01月试卷.doc VIP
- “尚德守法共治共享食品安全”主题班会.ppt VIP
- 高中数学课件:3《2-2-1直线的点斜式方程》0.pdf VIP
- 智能停车场系统中英文对照外文翻译文献.docx
- 建筑工程培训PPT课件范文.pptx VIP
文档评论(0)