Skip to main content
Added message name
Source Link
Michael E2
  • 244.8k
  • 18
  • 351
  • 774

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"}]]

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 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"}]]

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"}]]
warks to works
Source Link
John
  • 573
  • 2
  • 10

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 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 warksworks. 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"}]]

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 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 warks. 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"}]]

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 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"}]]
Source Link
John
  • 573
  • 2
  • 10

At t == ..., step size is effectively zero; \ singularity or stiff system suspected

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 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 warks. 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"}]]