Qurak

Nd solve delay differential equations comparison and contrast with odes

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

步驟 1
Manipulate[
	Module[{sol = NDSolve[{x'[t] == x[t - 1](1 - x[t]), x[t /; t ≤ 0] == ϕ}, x, {t, -2, 2}]},
	Plot[Evaluate[x[t] /. First[sol]], {t, -2, 2}]], {ϕ, {Exp[t], Cos[t], 1 - t, 1 - Sin[t]}}]
輸出
Manipulate[Module[{sol = NDSolve[{Derivative[1][x][t] == x[t - 1]*(1 - x[t]), x[t /; t <= 0] == ϕ}, x, {t, -2, 2}]}, Plot[Evaluate[x[t] /. First[sol]], {t, -2, 2}]], {ϕ, {E^t, Cos[t], 1 - t, 1 - Sin[t]}}]
步驟 2
Manipulate[
	Module[{T = 50, sol, x, t}, sol = First[x /. NDSolve[{x'[t] == a x[t](1 - x[t - 1]), x[t /; t ≤ 0] == 0.1}, x, {t, 0, T}]];
	If[pp, ParametricPlot[{sol[t], sol[t - 1]}, {t, 1, T}, PlotRange -> {{0, 3}, {0, 3}}],
	Plot[sol[t], {t, 0, T}, PlotRange -> {{0, 50}, {0, 3}}]]], {{pp, False, "Plot in Phase Plane"}, {False, True}}, {{a, 1}, 0, 2}]
輸出
Manipulate[Module[{T = 50, sol, x, t}, sol = First[x /. NDSolve[{Derivative[1][x][t] == a*x[t]*(1 - x[t - 1]), x[t /; t <= 0] == 0.1}, x, {t, 0, T}]]; If[pp, ParametricPlot[{sol[t], sol[t - 1]}, {t, 1, T}, PlotRange -> {{0, 3}, {0, 3}}], Plot[sol[t], {t, 0, T}, PlotRange -> {{0, 50}, {0, 3}}]]], {{pp, False, Plot in Phase Plane}, {False, True}}, {{a, 1}, 0, 2}]
步驟 3
sol1 = First[NDSolve[{x'[t] == Sin[x[t - 20]], x[t /; t ≤ 0] == .0001}, x, {t, 0, 500}]];
sol2 = First[NDSolve[{x'[t] == Sin[x[t - 20]], x[t /; t ≤ 0] == .00011}, x, {t, 0, 500}]];

沒有輸出——這個步驟是在為下一步做準備。

步驟 4
Plot[Evaluate[x[t] /. {sol1, sol2}], {t, 0, 500}]
輸出
-Graphics-
步驟 5
Grid[Table[sol = First[NDSolve[{x'[t] == Sin[x[t - τ]], x[t /; t ≤ 0] == .1}, x, {t, 100τ, 200τ}, MaxSteps -> Infinity]];
	{ParametricPlot[Evaluate[{x[t - 1], x[t]} /. sol], {t, 101τ, 200τ}].
	Plot[Evaluate[x[t] /. sol], {t, 100τ, 200τ}]}, {τ, 4.9, 5.1, .1}]]
輸出
Grid[{{-Graphics- . -Graphics-}, {-Graphics- . -Graphics-}, {-Graphics- . -Graphics-}}]
步驟 6
Block[{λ = 1 / 2, μ = -1, T = 25}, Plot[Evaluate[First[x[t] /. NDSolve[{x'[t] == λ x[t] + μ x[t - 1], x[t /; t ≤ 0] == 1 - t}, x, {t, 0, T}]]], {t, 0, T}, PlotRange -> All]]
輸出
-Graphics-
步驟 7
Block[{λ = -7 / 2, μ = 4, T = 25}, Plot[Evaluate[First[x[t] /. NDSolve[{x'[t] == λ x[t] + μ x[t - 1], x[t /; t ≤ 0] == 1 - t}, x, {t, 0, T}]]], {t, 0, T}, PlotRange -> All]]
輸出
-Graphics-
步驟 8
Manipulate[Module[{T = 25, x, t}, Plot[Evaluate[First[x[t] /. NDSolve[{x'[t] == λ x[t] + μ x[t - 1], x[t /; t ≤ 0] == 1 - t}, x, {t, 0, T}]]], {t, 0, T}, PlotRange -> All]], {λ, -5, 5}, {μ, -5, 5}]
輸出
Manipulate[Module[{T = 25, x, t}, Plot[Evaluate[First[x[t] /. NDSolve[{Derivative[1][x][t] == λ*x[t] + μ*x[t - 1], x[t /; t <= 0] == 1 - t}, x, {t, 0, T}]]], {t, 0, T}, PlotRange -> All]], {λ, -5, 5}, {μ, -5, 5}]

使用到的函式

相關的操作範例

所有操作範例 · 函式參考 · 從 MCP 用戶端使用這個