下表列出使用有限差分法进行数值微分时,各项的系数。按计算中自变量取值方向,分为中心差分,前向差分和后向差分。
中心差分
中心差分估算一阶至高阶微分按照下式:
:f^{(n)}(x) = \frac{1}{h_x^n}\sum_{i=-m}^{m} k_{i} f(x+ih) + O(h_x^p)
其中 h_x 为自变量取等距格点计算函数值时的间隔。
下表列出不同计算精度下,等间距的一阶至高阶中心差分系数。
例如,h_x^2精度的三阶导的中心差分式为
: \displaystyle f**(x_{0}) \approx \displaystyle \frac{-\frac{1}{2}f(x_{-2}) + f(x_{-1}) -f(x_{+1}) +\frac{1}{2}f(x_{+2})}{h^3_x} + O\left(h_x^2 \right)
前向与后向差分
下表列出不同精度下,等间距的一阶至高阶前向差分系数。
例如,h_x^3精度一阶导的前向差分式为
For example, the first derivative with a third-order accuracy and the second derivative with a second-order accuracy are
: \displaystyle f'(x_{0}) \approx \displaystyle \frac{-\frac{11}{6}f(x_{0}) + 3f(x_{+1}) -\frac{3}{2}f(x_{+2}) +\frac{1}{3}f(x_{+3}) }{h_{x}} + O\left(h_{x}^3 \right),
h_x^2精度二阶导的前向差分式为
: \displaystyle f*(x_{0}) \approx \displaystyle \frac{2f(x_{0}) - 5f(x_{+1}) + 4f(x_{+2}) - f(x_{+3}) }{h_{x}^2} + O\left(h_{x}^2 \right),
对应的后向差分式分别为
: \displaystyle f'(x_{0}) \approx \displaystyle \frac{\frac{11}{6}f(x_{0}) - 3f(x_{-1}) +\frac{3}{2}f(x_{-2}) -\frac{1}{3}f(x_{-3}) }{h_{x}} + O\left(h_{x}^3 \right),
: \displaystyle f*(x_{0}) \approx \displaystyle \frac{2f(x_{0}) - 5f(x_{-1}) + 4f(x_{-2}) - f(x_{-3}) }{h_{x}^2} + O\left(h_{x}^2 \right),
实际上,奇数阶后向差分式相对前向差分,各系数q取相反数;而偶数阶的则不变。如下表:
参见
- 有限差分法
- 數值微分
参考资料
评论 (0)