I'm trying to solve a pair of differential equations with NDSolve
. They contain a discontinuous function bounce
. I've trimmed down my original equations to the following for simplicity:
eqxy = {
0.1 == bounce[x[t]] - Cos[x[t]] x''[t],
y''[t] == -Sin[x[t]] + Cos[x[t]] x''[t]
};
where
bounce[x_] := If[Abs[x] >= 0.045, Abs[x], 0]
The following formatting may be clearer $$ \left( \begin{align} 0.1 &=\text{If}\,[\left| x(t)\right| \geq 0.045,\,\left| x(t)\right|,\,0]-x''(t) \cos(x(t)) \cr y''(t) &=x''(t) \cos (x(t))-\sin (x(t)) \cr \end{align} \right) $$
Now, running
NDSolve[
Join[eqxy, {x[0] == 0, x'[0] == 1, y[0] == 1, y'[0] == 1}],
{x, y}, {t, 0, 1}, Method -> "Automatic"]
yields the error message
NDSolve::depdole: The differential order of a dependent variable in {x'[t], x''[t], y'[t], y''[t]} exceeds the highest order that appears in the differential equations.
although interpolating functions are produced as solutions.
The error seems to be associated with bounce
, with its conditional and absolute value functions -- removing bounce
eliminates the error message. But how does bounce
cause any order excess?
Appreciate any insights. (Hope I've eliminated any typos.)
I'm running Mathematica version 10.3.0.0, Linux x86 (64-bit).
Answer
It's a confirmed bug in event processing.
Try Method -> {Automatic, "DiscontinuityProcessing" -> False}
as a workaround.
NDSolve[
Join[eqxy, {x[0] == 0, x'[0] == 1, y[0] == 1, y'[0] == 1}],
{x, y}, {t, 0, 1}, Method -> {Automatic, "DiscontinuityProcessing" -> False}]
Comments
Post a Comment