Qurak

Nd solve delay differential equations comparison and contrast with odes

Tutorial 8 langkah, dijalankan mengikut urutan dalam satu sesi. Setiap langkah dilaksanakan terhadap enjin dan output di bawah ialah apa yang dihasilkannya.

Langkah 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]}}]
Output
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]}}]
Langkah 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}]
Output
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}]
Langkah 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}]];

Tiada output - langkah ini menyediakan sesuatu untuk langkah seterusnya.

Langkah 4
Plot[Evaluate[x[t] /. {sol1, sol2}], {t, 0, 500}]
Output
-Graphics-
Langkah 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}]]
Output
Grid[{{-Graphics- . -Graphics-}, {-Graphics- . -Graphics-}, {-Graphics- . -Graphics-}}]
Langkah 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]]
Output
-Graphics-
Langkah 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]]
Output
-Graphics-
Langkah 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}]
Output
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}]

Fungsi yang digunakan

Resipi berkaitan

Semua resipi · Rujukan fungsi · Gunakan ini daripada klien MCP