スライディングモードの解を計算する
2Dと3Dの微分方程式の解を,Filippovスライディングモードを使って自動的に計算される不連続性で求める.
sxy = First[NDSolve[{x'[t] == If[x[t] ^ 2 + y[t] ^ 2 > 2, 1, x[t]], y'[t] == If[x[t] ^ 2 + y[t] ^ 2 > 2, -1, y[t]], x[0] == -1 / 15, y[0] == 1 / 10}, {x, y}, {t, 0, 10}]];
pplot = ParametricPlot[Evaluate[{x[t], y[t]} /. sxy], {t, 0, 10}, PlotStyle -> {Thickness[0.01], Red}, PlotRange -> {{-2, 2}, {-2, 2}}, Prolog -> {GrayLevel[.9], Disk[{0, 0}, Sqrt[2]]}, AxesLabel -> {"x", "y"}]Show[pplot, vf = VectorPlot[If[x ^ 2 + y ^ 2 > 2, {1, -1}, {x, y}], {x, -2, 2}, {y, -2, 2}, VectorColorFunction -> None, VectorStyle -> Gray, VectorPoints -> 30]]solutions = Table[First[NDSolve[{x'[t] == If[x[t] ^ 2 + y[t] ^ 2 > 2, 1, x[t]], y'[t] == If[x[t] ^ 2 + y[t] ^ 2 > 2, -1, y[t]], x[0] == Cos[θ] / 4, y[0] == Sin[θ] / 4}, {x, y}, {t, 0, 10}]], {θ, 0, 2π, .1}];
Show[ParametricPlot[Evaluate[{x[t], y[t]} /. solutions], {t, 0, 10}, PlotStyle -> Thickness[.01], PlotRange -> {{-2, 2}, {-2, 2}}, Prolog -> {GrayLevel[.9], Disk[{0, 0}, Sqrt[2]]}, AxesLabel -> {"x", "y"}], vf]sol3d = First[NDSolve[{x'[t] == Sign[8 - y[t] ^ 2 - (x[t] + 3 / 2) ^ 2 - (z[t] - 1) ^ 2], y'[t] == Sign[-y[t]], z'[t] == 1, x[0] == 2, y[0] == -2, z[0] == 0}, {x, y, z}, {t, 0, 5}]];不連続性について等高線曲面を形成し,解の曲線にParametricPlot3Dを使ってプロットを作成する:
c1 = ContourPlot3D[8 - y ^ 2 - (x + 3 / 2) ^ 2 - (z - 1) ^ 2, {x, -2, 2}, {y, -2, 2}, {z, 0, 5}, Contours -> {0}, Mesh -> False];
c2 = ContourPlot3D[-y, {x, -2, 2}, {y, -2, 2}, {z, 0, 5}, Contours -> {0}, Mesh -> False];p1 = ParametricPlot3D[Evaluate[{x[t], y[t], z[t]} /. sol3d], {t, 0, 5}, PlotStyle -> {Thickness[.015], Red}];
Show[c1, c2, p1, ImageSize -> Medium]