Qurak

Check the results of NDSolve

ハウツー 8 ステップを1つのセッション内で順に実行します。各ステップはエンジンで実行済みで、以下の出力は実際に生成されたものです。

ステップ 1
lowsol = NDSolve[{y'[x] == 1 / (2 y[x]), y[0] == 1 / 10}, y, {x, 0, 1}, InterpolationOrder -> All];

出力なし - このステップは次のステップの準備をします。

ステップ 2
highsol = NDSolve[{y'[x] == 1 / (2 y[x]), y[0] == 1 / 10}, y, {x, 0, 1}, WorkingPrecision -> 22, InterpolationOrder -> All];

出力なし - このステップは次のステップの準備をします。

ステップ 3
Plot[Evaluate[RealExponent[(y[x] /. lowsol) - (y[x] /. highsol)]], {x, 0, 1}]
出力
-Graphics-
ステップ 4
residual[x_] = y'[x] - 1 / (2 y[x]);

出力なし - このステップは次のステップの準備をします。

ステップ 5
Plot[Evaluate[RealExponent[{residual[x] /. lowsol, residual[x] /. highsol}]], {x, 0, 1}, PlotStyle -> {GrayLevel[0], RGBColor[1, 0, 0]}, AxesOrigin -> {0, 0}]
出力
-Graphics-
ステップ 6
sol = NDSolve[{x''[t] + 1 / 10 x'[t] + x[t] (x[t]^2 - 1) == 3 / 10 Cos[t], x[0] == x'[0] == 0}, x, {t, 0, 100}, InterpolationOrder -> All];

出力なし - このステップは次のステップの準備をします。

ステップ 7
hpsol = NDSolve[{x''[t] + 1 / 10 x'[t] + x[t] (x[t]^2 - 1) == 3 / 10 Cos[t], x[0] == x'[0] == 0}, x, {t, 0, 100}, WorkingPrecision -> 24, InterpolationOrder -> All];

出力なし - このステップは次のステップの準備をします。

ステップ 8
Plot[Evaluate[RealExponent[(x[t] /. sol) - (x[t] /. hpsol)]], {t, 0, 100}]
出力
-Graphics-

使用する関数

関連レシピ

すべてのレシピ · 関数リファレンス · MCPクライアントから使う