2
$\begingroup$

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).

$\endgroup$
4
  • $\begingroup$ I did not get this error when I ran your code. It actually worked fine. Quit the kernel and try again. (However, if I extended the time limit past 1.2, you get a numerical stiffness error, so you have some work to do to make it numerically tractable.) $\endgroup$
    – march
    Commented Dec 1, 2015 at 21:51
  • $\begingroup$ I was able to reproduce the error with V10.3 running on OS X 10.10.2. $\endgroup$
    – m_goldberg
    Commented Dec 1, 2015 at 22:40
  • $\begingroup$ Thanks. I added my version & platform above. By the way, I've quit and restarted the kernel multiple times. I did move over to v10.1, on Windows 8.1, and quit getting the error. (But I do still have more work to do, to be sure.) $\endgroup$
    – user36015
    Commented Dec 1, 2015 at 23:31
  • $\begingroup$ The message also goes away if you use bounce[x_?NumericQ]. I think NDSolve gets confused during the derivative estimation. You could report this to the wolfram support. $\endgroup$
    – user21
    Commented Dec 9, 2015 at 17:43

1 Answer 1

4
$\begingroup$

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}]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.