查看“︁有限差分法”︁的源代码
←
有限差分法
跳转到导航
跳转到搜索
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{NoteTA |G1=Math }} 在[[数学]]中,'''有限差分法'''('''finite-difference methods''',簡稱'''FDM'''),是一种[[微分方程]][[数值方法]],是通过有限[[差分]]來[[近似]][[导數]],从而寻求微分方程的近似解。 ==由泰勒展開式的推導== 首先假設要近似函數的各級導數都有良好的性質,依照[[泰勒定理]],可以形成以下的[[泰勒展開式]]: :<math>f(x_0 + h) = f(x_0) + \frac{f'(x_0)}{1!}h + \frac{f^{(2)}(x_0)}{2!}h^2 + \cdots + \frac{f^{(n)}(x_0)}{n!}h^n + R_n(x),</math> 其中''n''!表示是''n''的[[階乘]],''R''<sub>''n''</sub>(''x'')為餘數,表示泰勒多項式和原函數之間的差。可以推導函數''f''一階導數的近似值: :<math>f(x_0 + h) = f(x_0) + f'(x_0)h + R_1(x),</math> 設定x<sub>0</sub>=a,可得: :<math>f(a+h) = f(a) + f'(a)h + R_1(x),</math> 除以''h''可得: :<math>{f(a+h)\over h} = {f(a)\over h} + f'(a)+{R_1(x)\over h} </math> 求解f'(a): :<math>f'(a) = {f(a+h)-f(a)\over h} - {R_1(x)\over h}</math> 假設<math>R_1(x)</math>相當小,因此可以將"f"的一階導數近似為: :<math>f'(a)\approx {f(a+h)-f(a)\over h}.</math> ==準確度及誤差== <!--{{see also|Finite difference coefficient}}--> 近似解的誤差定義為近似解及解析解之間的差值。有限差分法的兩個誤差來源分別是[[捨入誤差]]及[[截尾誤差]](或稱為離散化誤差),前者是因為電腦計算小數時四捨五入造成的誤差,後者則是用有限阶级数表示导数引起的误差。 [[File:Finite Differences.svg|right|thumb|有限差分法是以在格點上函數的值為準]] 在運用有限差分法求解一問題(或是說找到問題的近似解)時,第一步需要將問題的定義域離散化。一般會將問題的定義域用均勻的網格分割(可參考右圖)。因此有限差分法會制造一組導數的離散數值近似值<!--often in a "time-stepping" manner-->。 一般會關注近似解的{{link-en|局部截尾誤差|local truncation error}},會用[[大O符號]]表示,局部截尾誤差是指應用有限差分法一次後產生的誤差,因此為<math>f'(x_i) - f'_i</math>,此時<math>f'(x_i)</math>是實際值,而<math>f'_i</math>為近似值。泰勒多項式的餘數項有助於分析局部截尾誤差。利用<math>f(x_0 + h)</math>泰勒多項式的餘數項,也就是 :<math> R_n(x_0 + h) = \frac{f^{(n+1)}(\xi)}{(n+1)!} (h)^{n+1} </math>, 其中<math> x_0 < \xi < x_0 + h</math>, 可以找到局部截尾誤差的主控項,例如用前項差分法計算一階導數,已知<math>f(x_i)=f(x_0+i h)</math>, :<math> f(x_0 + i h) = f(x_0) + f'(x_0)i h + \frac{f''(\xi)}{2!} (i h)^{2}, </math> 利用一些代數的處理,可得 :<math> \frac{f(x_0 + i h) - f(x_0)}{i h} = f'(x_0) + \frac{f''(\xi)}{2!} i h, </math> 注意到左邊的量是有限差分法的近似,右邊的量是待求解的量再加上一個餘數,因此餘數就是局部截尾誤差。上述範例可以用下式表示: :<math> \frac{f(x_0 + i h) - f(x_0)}{i h} = f'(x_0) + O(h). </math> 在此例中,局部截尾誤差和時間格點的大小成正比。 ==範例:常微分方程== 例如考慮以下的常微分方程 :<math> u'(x) = 3u(x) + 2. \, </math> 利用[[數值方法]]中歐拉法求解,利用以下的有限差分式 :<math>\frac{u(x+h) - u(x)}{h} \approx u'(x)</math> 來近似導數,並配合一些代數處理(等號兩側同乘以h,再加上u(x)),可得 :<math> u(x+h) = u(x) + h(3u(x)+2). \, </math> 最後的方程式即為有限差分方程,求解此方程則可得到原方程的近似解。 ==範例:熱傳導方程== 考慮正規化的一維[[熱傳導方程式]],為齊次的[[狄利克雷邊界條件]] :<math> U_t=U_{xx} \, </math> :<math> U(0,t)=U(1,t)=0 \, </math>(邊界條件) :<math> U(x,0) =U_0(x) \, </math>(初始條件) 對此問題求數值解的一種方式是用差分去近似所有的導數,可以將空間分割為<math> x_0, ..., x_J </math>,將時間也分割為<math> t_0, ...., t_N </math>。假設在時間及空間都是均勻的網格切割,空間中兩個連續位置的間隔為''h'',兩個連續時間之間的間隔為''k''。點 :<math> u(x_j,t_n) = u_{j}^n </math> 表示<math> u(x_j, t_n)</math>的數值近似解。 ===顯式方法=== [[File:Explicit method-stencil.svg|right|thumb|熱傳導方程最常用顯式方法的{{link-en|模版 (數值分析)|Stencil (numerical analysis)|模版}}]] 利用在時間<math> t_n </math>的前向差分,以及在位置<math> x_j </math>的二階中央差分({{link-en|FTCS 格式|FTCS scheme}}),可以得到以下的迭代方程: :<math> \frac{u_{j}^{n+1} - u_{j}^{n}}{k} = \frac{u_{j+1}^n - 2u_{j}^n + u_{j-1}^n}{h^2}. \, </math> 這是用求解一維導熱傳導方程的[[顯式方法]]。 可以用以下的式子求解<math> u_j^{n+1} </math> :<math> u_{j}^{n+1} = (1-2r)u_{j}^{n} + ru_{j-1}^{n} + ru_{j+1}^{n} </math> 其中<math> r=k/h^2. </math> 因此配合此迭代關係式,已知在時間''n''的數值,可以求得在時間''n''+1的數值。<math> u_0^n </math>及<math> u_J^n </math>的數值可以用邊界條件代入,在此例中為0。 此顯式方法在<math> r\le 1/2 </math>時,為[[数值稳定性|數值稳定]]且[[極限 (數列)|收斂]]<ref>Crank, J. ''The Mathematics of Diffusion''. 2nd Edition, Oxford, 1975, p. 143.</ref>。其數值誤差和時間間隔成正比,和位置間隔的平方成正比: :<math> \Delta u = O(k)+O(h^2) \, </math> ===隱式方法=== [[File:Implicit method-stencil.svg|right|thumb|隱式方法的模版]] 若使用時間<math> t_{n+1} </math>的後向差分,及位置<math> x_j </math>的二階中央差分(BTCS 格式),可以得到以下的迭代方程: :<math> \frac{u_{j}^{n+1} - u_{j}^{n}}{k} =\frac{u_{j+1}^{n+1} - 2u_{j}^{n+1} + u_{j-1}^{n+1}}{h^2}. \, </math> 這是用求解一維導熱傳導方程的[[隱式方法]]。 在求解線性聯立方程後可以得到<math> u_j^{n+1} </math>: :<math> (1+2r)u_j^{n+1} - ru_{j-1}^{n+1} - ru_{j+1}^{n+1}= u_{j}^{n} </math> 此方法不論<math>r</math>的大小,都數值稳定且收斂,但在計算量會較顯式方法要大,因為每前進一個時間間隔,就需要求解一個聯立的數值方程組。其數值誤差和時間間隔成正比,和位置間隔的平方成正比: :<math> \Delta u = O(k)+O(h^2) \, </math> ===克兰克-尼科尔森方法=== 若使用時間<math> t_{n+1/2} </math>的中間差分,及位置<math> x_j </math>的二階中央差分(CTCS 格式),可以得到以下的迭代方程: :<math> \frac{u_j^{n+1} - u_j^{n}}{k} = \frac{1}{2} \left(\frac{u_{j+1}^{n+1} - 2u_j^{n+1} + u_{j-1}^{n+1}}{h^2}+\frac{u_{j+1}^{n} - 2u_j^{n} + u_{j-1}^{n}}{h^2}\right).\, </math> 此公式為[[克兰克-尼科尔森方法]](Crank–Nicolson method)。 [[File:Crank-Nicolson-stencil.svg|right|thumb|克兰克-尼科尔森方法的模版]] 在求解線性聯立方程後可以得到<math> u_j^{n+1} </math>: :<math> (2+2r)u_j^{n+1} - ru_{j-1}^{n+1} - ru_{j+1}^{n+1}= (2-2r)u_j^n + ru_{j-1}^n + ru_{j+1}^n </math> 此方法不論<math>r</math>的大小,都[[數值稳定]]且收斂,但在計算量會較顯式方法要大,因為每前進一個時間間隔,就需要求解一個聯立的數值方程組。其數值誤差和時間間隔的平方成正比,和位置間隔的平方成正比: :<math> \Delta u = O(k^2)+O(h^2). \, </math> 若時間刻度較小時,克兰克-尼科尔森方法是最精確的,而顯式方法是最不精確的,而且可能會不穩定,但是是最容易計算的,其數值計算量也最少。若時間刻度較大時,隱式方法的效果最好。 ==相關條目== *[[有限元分析]] *[[差分]] *[[時域有限差分]] *{{link-en|模版 (數值分析)|Stencil (numerical analysis)}} *[[有限差分係數]] *{{link-en|五點Stencil|Five-point stencil}} *{{link-en|Lax等價定理|Lax equivalence theorem}} *{{link-en|期权定价的有限差分法|finite difference methods for option pricing}} ==參考資料== {{reflist}} * K.W. Morton and D.F. Mayers, ''Numerical Solution of Partial Differential Equations, An Introduction''. Cambridge University Press, 2005. * Oliver Rübenkönig, ''[https://web.archive.org/web/20100111163529/http://www.imtek.de/simulation/mathematica/IMSweb/imsTOC/Lectures%20and%20Tips/Simulation%20I/FDM_introDocu.html The Finite Difference Method (FDM) - An introduction]'', (2006) [[Albert Ludwigs University of Freiburg]] * Autar Kaw and E. Eric Kalu, ''Numerical Methods with Applications'', (2008) [http://www.autarkaw.com/books/numericalmethods/index.html] {{Wayback|url=http://www.autarkaw.com/books/numericalmethods/index.html |date=20200804172824 }} ==外部連結== * [https://web.archive.org/web/20140302111344/http://emlab.utep.edu/ee5390cem.htm Finite-Difference Method (see and listen to lecture 9)] *[https://web.archive.org/web/20060818132006/http://math.fullerton.edu/mathews/n2003/finitediffpde/FiniteDifferencePDEBib/Links/FiniteDifferencePDEBib_lnk_1.html List of Internet Resources for the Finite Difference Method for PDEs] * [http://numericalmethods.eng.usf.edu/topics/finite_difference_method.html Finite Difference Method of Solving ODEs (Boundary Value Problems) Notes, PPT, Maple, Mathcad, Matlab, Mathematica] {{Wayback|url=http://numericalmethods.eng.usf.edu/topics/finite_difference_method.html |date=20060901073121 }} *[https://web.archive.org/web/20090206071754/http://ltl.iams.sinica.edu.tw/document/training_lectures/2006/SH_Chen/Finite_Difference_Methods.pdf Lecture Notes] Shih-Hung Chen, [[國立中央大學|National Central University]] * {{tsl|en|Randall J. LeVeque||Randall J. LeVeque}}, ''[http://faculty.washington.edu/rjl/fdmbook/ Finite Difference Methods for Ordinary and Partial Differential Equations] {{Wayback|url=http://faculty.washington.edu/rjl/fdmbook/ |date=20200423113833 }}'', SIAM, 2007. *[https://web.archive.org/web/20120226144927/http://www.adeptscience.co.uk/products/mathsim/maple/powertools/des/unit18.html#MapleAutoBookmark4 Finite Difference Method] *[http://math.fullerton.edu/mathews/n2003/FiniteDifferenceMod.html Finite Difference Method for Boundary Value Problems] {{Wayback|url=http://math.fullerton.edu/mathews/n2003/FiniteDifferenceMod.html |date=20130708232426 }} *[https://web.archive.org/web/20120207024810/http://www.composite-agency.com/product.htm Finite Difference Methodology in Materials Science] *[http://jwhaverkort.net23.net/documents/NumMethPDEs.pdf Numerical Methods for time-dependent Partial Differential Equations] {{Wayback|url=http://jwhaverkort.net23.net/documents/NumMethPDEs.pdf |date=20141026111531 }} {{數值偏微分方程}} {{非線性偏微分方程理論與解法}} {{Authority control}} [[Category:有限差分]] [[Category:数值微分方程]]
该页面使用的模板:
Template:Authority control
(
查看源代码
)
Template:Link-en
(
查看源代码
)
Template:NoteTA
(
查看源代码
)
Template:Reflist
(
查看源代码
)
Template:Tsl
(
查看源代码
)
Template:Wayback
(
查看源代码
)
Template:數值偏微分方程
(
查看源代码
)
Template:非線性偏微分方程理論與解法
(
查看源代码
)
返回
有限差分法
。
导航菜单
个人工具
登录
命名空间
页面
讨论
不转换
查看
阅读
查看源代码
查看历史
更多
搜索
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
工具
链入页面
相关更改
页面信息