I need to get a phase portrait for a non-linear oscillator, for this I wrote down the corresponding equations. 3 equations for different "a" which can take values from minus to plus infinity. In each equation, the last term is an expression for the nonlinearity of our oscillator. In general, the problem (error message NDSolve::ndsz
) arises when I try to solve equations for "a" which value is more than zero. For example, if i change last term for another like that: (a*x)/(a+x), it works. Can't anderstand where is my mistake in the first case?
My code is:
δ = 0.1;
ω0 = 1;
α1 = 0.1;
α2 = 0;
α3 = -0.5;
Subscript[t, 0] = 0;
Subscript[t, 1] = 100;
x1 = DSolve[{x''[t] +
2δ*x'[t] + (ω0^2)*x[t] + α1/x[t]^2 == 0,
x[0] == 1, x'[0] == 0}, x, {t, Subscript[t, 0], Subscript[t, 1]}];
x2 = DSolve[{x''[t] +
2δ*x'[t] + (ω0^2)*x[t] + α2/x[t]^2 == 0,
x[0] == 1, x'[0] == 0}, x, {t, Subscript[t, 0], Subscript[t, 1]}];
x3 = DSolve[{x''[t] +
2δ*x'[t] + (ω0^2)*x[t] + α3/x[t]^2 == 0,
x[0] == 1, x'[0] == 0}, x, {t, Subscript[t, 0], Subscript[t, 1]}];
Show[ParametricPlot[{x[t], x'[t]} /. x1, {t, 0, 60},
PlotRange -> {{-1, 1}, {-2, 2}}, PlotStyle -> Blue,
PlotLegends -> {"α = 0.1"}],
ParametricPlot[{x[t], x'[t]} /. x2, {t, 0, 60},
PlotRange -> {{-1, 1}, {-2, 2}}, PlotStyle -> Black,
PlotLegends -> {"α = 0"}],
ParametricPlot[{x[t], x'[t]} /. x3, {t, 0, 60},
PlotRange -> {{-1, 1}, {-2, 2}}, PlotStyle -> Red,
PlotLegends -> {"α = -0.5"}]]
NDSolve[]
and ilk can produce theNDSolve::ndsz
error, yet you are usingDSolve[]
in your code. What am I missing? $\endgroup$DSolve
doesn't work, tryNDSolve
, if a numeric solution would be acceptable. (It seemsx1
andx3
fail.) $\endgroup$ParametricPlot
,N[DSolve[..]]
is tried, which now callsNDSolve
, whenDSolve
fails. $\endgroup$DSolve
is unable to solve thex1
andx3
ODEs. Incidentally, because the ODEs are autonomous, they can be reduced to first order, although it is unclear whether that would help. Also, I would guess that, ifNDSolve
eventually is called, it would fail at the turning points of the nonlinear oscillators or whenx[t] == 0
. $\endgroup$