数値解析 第5回 (5) 例と注意
前進差分・後退差分・中心差分の比較
$y(x)=\sin(x)$, $h=0.1$ の場合の $y'$$\require{color}$$x$ | 真の値 $\cos(x)$ | 前進差分 | 前進差分 の誤差 | 後退差分 | 後退差分 の誤差 | 中心差分 | 中心差分 の誤差 |
$0.300000$ | $0.955336$ | $0.938981$ | $\color{red}{0.016355}$ | $0.968509$ | $\color{red}{0.013172}$ | $0.953745$ | $\color{red}{0.001591}$ |
$0.400000$ | $0.921061$ | $0.900072$ | $\color{red}{0.020989}$ | $0.938981$ | $\color{red}{0.017920}$ | $0.919527$ | $\color{red}{0.001534}$ |
$0.500000$ | $0.877583$ | $0.852169$ | $\color{red}{0.025413}$ | $0.900072$ | $\color{red}{0.022489}$ | $0.876121$ | $\color{red}{0.001462}$ |
$0.600000$ | $0.825336$ | $0.795752$ | $\color{red}{0.029583}$ | $0.852169$ | $\color{red}{0.026834}$ | $0.823961$ | $\color{red}{0.001375}$ |
$0.700000$ | $0.764842$ | $0.731384$ | $\color{red}{0.033458}$ | $0.795752$ | $\color{red}{0.030910}$ | $0.763568$ | $\color{red}{0.001274}$ |
$x$ | 真の値 $\cos(x)$ | 前進差分 | 前進差分 の誤差 | 後退差分 | 後退差分 の誤差 | 中心差分 | 中心差分 の誤差 |
$0.300000$ | $0.955336$ | $0.953843$ | $\color{red}{0.001494}$ | $0.956798$ | $\color{red}{0.001462}$ | $0.955321$ | $\color{red}{0.000016}$ |
$0.400000$ | $0.921061$ | $0.919099$ | $\color{red}{0.001962}$ | $0.922993$ | $\color{red}{0.001932}$ | $0.921046$ | $\color{red}{0.000015}$ |
$0.500000$ | $0.877583$ | $0.875171$ | $\color{red}{0.002412}$ | $0.879965$ | $\color{red}{0.002382}$ | $0.877568$ | $\color{red}{0.000015}$ |
$0.600000$ | $0.825336$ | $0.822499$ | $\color{red}{0.002837}$ | $0.828145$ | $\color{red}{0.002809}$ | $0.825322$ | $\color{red}{0.000014}$ |
$0.700000$ | $0.764842$ | $0.761608$ | $\color{red}{0.003234}$ | $0.768051$ | $\color{red}{0.003208}$ | $0.764829$ | $\color{red}{0.000013}$ |
2・3・4階の中心差分の例
$y(x)=\sin(x)$, $h=0.1$ の場合の $y''$, $y'''$, $y^{(4)}$$x$ | 2 階の 中心差分 | 2 階の 中心差分 の誤差 | 3 階の 中心差分 | 3 階の 中心差分 の誤差 | 4 階の 中心差分 | 4 階の 中心差分 の誤差 |
$0.300000$ | $-0.295274$ | $\color{red}{0.000246}$ | $-0.952951$ | $\color{red}{0.002386}$ | $0.295028$ | $\color{red}{0.000492}$ |
$0.400000$ | $-0.389094$ | $\color{red}{0.000324}$ | $-0.918761$ | $\color{red}{0.002300}$ | $0.388770$ | $\color{red}{0.000649}$ |
$0.500000$ | $-0.479026$ | $\color{red}{0.000399}$ | $-0.875391$ | $\color{red}{0.002192}$ | $0.478627$ | $\color{red}{0.000798}$ |
$0.600000$ | $-0.564172$ | $\color{red}{0.000470}$ | $-0.823274$ | $\color{red}{0.002061}$ | $0.563702$ | $\color{red}{0.000940}$ |
$0.700000$ | $-0.643681$ | $\color{red}{0.000537}$ | $-0.762932$ | $\color{red}{0.001910}$ | $0.643145$ | $\color{red}{0.001073}$ |
$x$ | 2 階の 中心差分 | 2 階の 中心差分 の誤差 | 3 階の 中心差分 | 3 階の 中心差分 の誤差 | 4 階の 中心差分 | 4 階の 中心差分 の誤差 |
$0.300000$ | $-0.295518$ | $\color{red}{0.000002}$ | $-0.955313$ | $\color{red}{0.000024}$ | $0.295515$ | $\color{red}{0.000005}$ |
$0.400000$ | $-0.389415$ | $\color{red}{0.000003}$ | $-0.921038$ | $\color{red}{0.000023}$ | $0.389412$ | $\color{red}{0.000007}$ |
$0.500000$ | $-0.479422$ | $\color{red}{0.000004}$ | $-0.877561$ | $\color{red}{0.000022}$ | $0.479418$ | $\color{red}{0.000008}$ |
$0.600000$ | $-0.564638$ | $\color{red}{0.000005}$ | $-0.825315$ | $\color{red}{0.000021}$ | $0.564633$ | $\color{red}{0.000009}$ |
$0.700000$ | $-0.644212$ | $\color{red}{0.000005}$ | $-0.764823$ | $\color{red}{0.000019}$ | $0.644207$ | $\color{red}{0.000011}$ |