一类二阶常微分方程的差分格式1.引言考虑二阶常微分边值问题:⑴最简形:22()()duLuqxuxfdxaxb(1.1)()()uaub(1.2)其中()0,()qxfx为[,]ab上已知的连续函数,为已知常数。⑵变系数:22()()()()duLupxuxqxuxfdxaxb(2.1)()()uaub(2.2)其中(),()0,()pxqxfx为[,]ab上已知的连续函数,为已知常数。⑶守恒形:[()]()()dduLuaxqxuxfdxdxaxb(2.3)()()uaub(2.4)其中(),()0,()axqxfx为[,]ab上已知的连续函数,为已知常数。2.差分格式将区间[,]ab分成N等分(N为正整数),则对步长abhN,将[,]Iab进行网格剖分,则网格节点为,0ixaihiN.⑴最简形:对充分光滑的解u,由Taylor展开式在ix处展开得:123(4)411111111()()()()()()()()()()2!3!4!iiiiiiiiiiiiiuxuxuxxxuxxxuxxxuxx123(4)411111()()()()()()2!3!4!iiiiiiuxuxhuxhuxhuhxx①23(4)4111121111()()()()()()()()()()2!3!4!iiiiiiiiiiiiiuxuxuxxxuxxxuxxxuxx23(4)4212111()()()()()()2!3!4!iiiiiiuxuxhuxhuxhuhxx②由①+②:42(4)111112()()2()()()(,max{,})12iiiiiihuxuxuxuxhuxx③42(4)111112()2()()()()(,max{,})12iiiiiihuxuxuxuxhuxx④2(4)1111122()2()()()()(,max{,})12iiiiiiuxuxuxhuxuxxh⑤用二阶差商代替ix点处二阶导数得到:2(4)1111122()2()()()()(,max{,})12iiiiiiuxuxuxhuxuxxh⑥带入原方程:112()2()()()()()()iiiiiiiiuuxuxuxLuqxuxfxRxh,⑦其中2(4)()()12niihRxu.则当0h时,()niRx是h的二阶无穷小量,舍去()niRx即得到逼近方程的差分方程:1122(0,1,,1)iiihiiiiuuuLuqufiNh⑧()niRx即为截断误差。考虑到边值条件0Nuu,组成关于iu的差分格式:11202(0,1,,1)iiihiiiiNuuuLuqufiNhuu⑨其解iu是()ux于ixx的近似,称⑨为逼近。⑵变系数:对充分光滑的解u,由Taylor展开式在ix处展开得:①11221111111()()()()()()()()()()2!2!iiiiiiiiiiiuxuxuxxxuxxuxuxhuhxx②22112121211()()()()()()()()()()2!2!iiiiiiiiiiiuxuxuxxxuxxuxuxhuhxx由①-②:2111112()()2()()(,max{,})iiiiiuxuxuxuhxx③111112()()()()(,max{,})24iiiiiuxuxhuxuxxh④用一阶差商代替ix点处一阶导数得到:111112()()()()(,max{,})24iiiiiuxuxhuxuxxh⑤带入原方程得到⑥:11112()2()()()()()()()()()2iiiiiiiiiiiuuxuxuxuxuxLupxqxuxfxRxhh其中2(4)()()()124niiihhRxuu.则当0h时,()niRx是h的二阶无穷小量,舍去()niRx即得到逼近方程的差分方程:111122(0,1,,1)2iiiiihiiiiiuuuuuLupqufiNhh⑦()niRx即为截断误差。考虑到边值条件0Nuu,组成关于iu的差分格式:1111202(0,1,,1)2iiiiihiiiiiNuuuuuLupqufiNhhuu⑧其解iu是()ux于ixx的近似,称⑨为逼近。⑶守恒形:对充分光滑的解u,由Taylor展开式在ix处展开得:22111111112222221112221()()()()()()(())2!()()()()28iiiiiiiiiiiiiuxuxuxxxuxxxoxxhhuxuxuxoh①22111111222222221112221()()()()()()(())2!()()()()28iiiiiiiiiiiiiuxuxuxxxuxxxoxxhhuxuxuxoh②由①-②:2112()()()()iiiuxuxhuxoh③112()()()()iiiuxuxuxohh④用一阶差商代替12ix点处一阶导数得到:112()()()()iiiuxuxuxohh⑤同理得到12ix点处一阶导数⑥:112()()()()iiiuxuxuxohh用二阶差商代替ix点处二阶导数得到⑦:1/21/2111/21/2()()()()[()][()]()()[()]iiiiiixxiiiuxuxuxuxduduaxaxaxaxddudxdxhhaxdxdxhh带入原方程得到:111/21/2()()()()()()()()()()iiiiiiiiiiiuuxuxuxuxaxaxhhLuqxuxfxRxh,其中2(4)()()12niihRxu.则当0h时,()niRx是h的二阶无穷小量,舍去()niRx即得到逼近方程的差分方程:111/21/2(0,1,,1)iiiiiihiiiiuuuuaahhLuqufiNh⑧()niRx即为截断误差。考虑到边值条件0Nuu,组成关于iu的差分格式:111/21/20(0,1,,1)iiiiiihiiiiNuuuuaahhLuqufiNhuu⑨其解iu是()ux于ixx的近似,称⑨为逼近。3.格式求解⑴最简形:22112211[2](0,1,,1)(2)(0,1,,1)iiiiiiiiiiiuuuhquhfiNuhquuhfiN⑩考虑0Nuu与⑩可写为22111222222222222111211212112NNNNNNuhqhfuhqhfuhqhfuhqhf⑵变系数:22111122111122112(2)()22(0,1,,1)24222(0,1,,1)(2)(24)(2)2(0,1,,1)iiiiiiiiiiiiiiiiiiiiiiiiiiuuuhpuuhquhfiNuuuhpuhpuhquhfiNhpuhquhpuhfiN⑩考虑0Nuu与⑩可写为22111122222222211112422242224222NNNNuhphqhfuhphqhphfuhqhphf⑶守恒形:221/211/21221/211/21/21/21()()()iiiiiiiiiiiiiiiiiiauuauuhquhfauaahquauhf⑩考虑0Nuu与⑩可写为23311222211225531322222222111313222NNNNNNaaahquhfaaahqauhfuhfaahqa4.数值例子⑴最简形:计算如下两点边值问题:()()(sin2cos),0(0)0,()0.xuxuxexxxuu其精确解为()sinxuxex。将区间[0,]做N等分,记/,,0ihNxihiN.绝对误差最大值记为0()()maxiiiNEhuxu.表1列出了4个结点处的精确解和取不同步长时所得的数值解。表2给出不同步长时在这4个结点处所得数值解的绝对误差。表3给出不同步长时在这4个结点处所得数值解的最大误差图1给出了取不同步长时所得的数值解曲线。图2给出了精确解曲线和取h=π/10时所得数值解曲线。图3给出了取不同步长时所得数值解的误差曲线。表1部分结点处的精确解和取不同步长时所得的数值解hxπ/52π/53π/54π/5π/101.064006657723173.266547950347426.166190953632747.17872520542625π/201.092311140592203.322830064623116.239354819138907.23703886968308π/401.099409548548123.336920147061516.257627876805947.25154646861715π/801.101185528775123.340443837347326.262194912740827.25516880025087π/1601.101629609734983.341324832185986.263336593206527.25607409539735精确解1.101777644352513.341618503537926.263717146344477.25637583481747表2取不同步长时部分结点处数值解的误差绝对值表3取不同步长时部分结点处数值解的最大误差h()Eh(2)/()EhEhπ/100.0975261927*π/200.02438907473.9988π/400.00611500673.9884π/800.00152863844.0003π/1603.821525e-044.0000hxπ/52π/53π/54π/5π/100.03777098660.07507055320.09752619270.0776506294π/200.00946650380.01878843890.02436232720.0193369651π/400.00236809580.00469835650.00608926950.0048293662π/