Qurak

Check the results of NDSolve

操作指南 共 8 個步驟,在同一個工作階段中依序執行。每一步都在引擎上實際執行過,下方的輸出就是它產生的結果。

步驟 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 用戶端使用這個