Skip to main content
Improved formatting
Source Link
Michael E2
  • 244.9k
  • 18
  • 351
  • 774

I'm trying to solve the two order differential equations using NDSolve. Here is the code:

ClearAll["Global`*"]; \[CapitalOmega]1Ω1 = 5; \[CapitalOmega]2Ω2 = -2; m \
= 0.1109; g = 0.0089; timelimit = 10000;
s = NDSolve[{m x''[t] + x'[t] == 
     Sin[x[t] - \[CapitalOmega]1Ω1 t] Exp[-y[t]] + 
      Sin[2 x[t] - \[CapitalOmega]2Ω2 t] Exp[-2 y[t]], 
    m y''[t] + y'[t] == 
     Cos[\[CapitalOmega]1Cos[Ω1 t - x[t]] Exp[-y[t]] + 
      Cos[\[CapitalOmega]2Cos[Ω2 t - 2 x[t]] Exp[-2 y[t]] - g, x[0] == 0, 
    y[0] == 0, x'[0] == 0, y'[0] == 0}, {x, y}, {t, 0, timelimit}];
ParametricPlot[Evaluate[{x[t], y[t]} /. s], {t, 0, timelimit}, 
 Frame -> True, PlotRange -> All, AspectRatio -> 1/2]

The parameter of m and g is based on physical model. And the source in the right hand of the function is the product of Sin function and exponential function.

If I set y[0] == 0

It will illustrate that NDSolve::ndsz: At t == 3.0092307260023015`, step size is effectively zero; singularity or stiff system suspected

If I changed the value of y'[0] to 1,2 or other values, or I add whenevent like this , this problems will be solved.

WhenEvent[y[t] == 0, y'[t] -> - y'[t]]} .

But I don't know the basic mechanism.

LIke in what conditions it will show a stiff system. If I want to get the simulation results in that condition, what's the proper way to solve the problem.

Any suggestions would be appreciated.

I'm trying to solve the two order differential equations using NDSolve. Here is the code:

ClearAll["Global`*"]; \[CapitalOmega]1 = 5; \[CapitalOmega]2 = -2; m \
= 0.1109; g = 0.0089; timelimit = 10000;
s = NDSolve[{m x''[t] + x'[t] == 
     Sin[x[t] - \[CapitalOmega]1 t] Exp[-y[t]] + 
      Sin[2 x[t] - \[CapitalOmega]2 t] Exp[-2 y[t]], 
    m y''[t] + y'[t] == 
     Cos[\[CapitalOmega]1 t - x[t]] Exp[-y[t]] + 
      Cos[\[CapitalOmega]2 t - 2 x[t]] Exp[-2 y[t]] - g, x[0] == 0, 
    y[0] == 0, x'[0] == 0, y'[0] == 0}, {x, y}, {t, 0, timelimit}];
ParametricPlot[Evaluate[{x[t], y[t]} /. s], {t, 0, timelimit}, 
 Frame -> True, PlotRange -> All, AspectRatio -> 1/2]

The parameter of m and g is based on physical model. And the source in the right hand of the function is the product of Sin function and exponential function.

If I set y[0] == 0

It will illustrate that NDSolve::ndsz: At t == 3.0092307260023015`, step size is effectively zero; singularity or stiff system suspected

If I changed the value of y'[0] to 1,2 or other values, or I add whenevent like this , this problems will be solved.

WhenEvent[y[t] == 0, y'[t] -> - y'[t]]} .

But I don't know the basic mechanism.

LIke in what conditions it will show a stiff system. If I want to get the simulation results in that condition, what's the proper way to solve the problem.

Any suggestions would be appreciated.

I'm trying to solve the two order differential equations using NDSolve. Here is the code:

ClearAll["Global`*"]; Ω1 = 5; Ω2 = -2; m \
= 0.1109; g = 0.0089; timelimit = 10000;
s = NDSolve[{m x''[t] + x'[t] == 
     Sin[x[t] - Ω1 t] Exp[-y[t]] + 
      Sin[2 x[t] - Ω2 t] Exp[-2 y[t]], 
    m y''[t] + y'[t] == 
     Cos[Ω1 t - x[t]] Exp[-y[t]] + 
      Cos[Ω2 t - 2 x[t]] Exp[-2 y[t]] - g, x[0] == 0, 
    y[0] == 0, x'[0] == 0, y'[0] == 0}, {x, y}, {t, 0, timelimit}];
ParametricPlot[Evaluate[{x[t], y[t]} /. s], {t, 0, timelimit}, 
 Frame -> True, PlotRange -> All, AspectRatio -> 1/2]

The parameter of m and g is based on physical model. And the source in the right hand of the function is the product of Sin function and exponential function.

If I set y[0] == 0

It will illustrate that NDSolve::ndsz: At t == 3.0092307260023015`, step size is effectively zero; singularity or stiff system suspected

If I changed the value of y'[0] to 1,2 or other values, or I add whenevent like this , this problems will be solved.

WhenEvent[y[t] == 0, y'[t] -> - y'[t]]} .

But I don't know the basic mechanism.

LIke in what conditions it will show a stiff system. If I want to get the simulation results in that condition, what's the proper way to solve the problem.

Any suggestions would be appreciated.

Source Link

Stiff system problems with NDSolve

I'm trying to solve the two order differential equations using NDSolve. Here is the code:

ClearAll["Global`*"]; \[CapitalOmega]1 = 5; \[CapitalOmega]2 = -2; m \
= 0.1109; g = 0.0089; timelimit = 10000;
s = NDSolve[{m x''[t] + x'[t] == 
     Sin[x[t] - \[CapitalOmega]1 t] Exp[-y[t]] + 
      Sin[2 x[t] - \[CapitalOmega]2 t] Exp[-2 y[t]], 
    m y''[t] + y'[t] == 
     Cos[\[CapitalOmega]1 t - x[t]] Exp[-y[t]] + 
      Cos[\[CapitalOmega]2 t - 2 x[t]] Exp[-2 y[t]] - g, x[0] == 0, 
    y[0] == 0, x'[0] == 0, y'[0] == 0}, {x, y}, {t, 0, timelimit}];
ParametricPlot[Evaluate[{x[t], y[t]} /. s], {t, 0, timelimit}, 
 Frame -> True, PlotRange -> All, AspectRatio -> 1/2]

The parameter of m and g is based on physical model. And the source in the right hand of the function is the product of Sin function and exponential function.

If I set y[0] == 0

It will illustrate that NDSolve::ndsz: At t == 3.0092307260023015`, step size is effectively zero; singularity or stiff system suspected

If I changed the value of y'[0] to 1,2 or other values, or I add whenevent like this , this problems will be solved.

WhenEvent[y[t] == 0, y'[t] -> - y'[t]]} .

But I don't know the basic mechanism.

LIke in what conditions it will show a stiff system. If I want to get the simulation results in that condition, what's the proper way to solve the problem.

Any suggestions would be appreciated.