I am solving differential equations numerically by using NDSolve. Let's say that the function that I want to obtain is f[t]. Then, it turns out that my differential equation is a sextic polynomial of f'[t]. Therefore, there are six solutions (including imaginary solutions). My initial condition is given when t=0, then I get six f'[0], and I know which one I want, so I can choose the proper one that has the correct value for f'[0]. Regarding this, I asked a question here and obtained a satisfactory answer: How can I make assumptions in NDSolve

However, the problem is the following. Let's say that the six solutions are f1'[t], f2'[t]..., f6'[t]. So, from the initial value of f'[0], I know that f1[t] is the one I want. However, while solving the sextic equation, Mathematica seems to suddenly pick up the other solution, such as f2'[t] or f3'[t]. Thus, if I draw the results by graphs, I notice that there are certain sudden discontinuities as in the figure below.

enter image description here

How can I ensure that Mathematica doesn't pick up the wrong solution (such as f2 or f3) when it solves the differential equation numerically? Can I enforce a condition such as continuity? Like |f'[t+Delta t] -f'[t]|<small number ? Condition such as f'[t]>0 wouldn't possibly work, because there can be one or two other solutions that satisfy the same condition.

  • 2
    $\begingroup$ Please provide code that illustrates your problem. Actual code to copy&paste, no screenshots please. If your code is complicated, please provide a simple example that shows the same problem. $\endgroup$
    – user293787
    Commented Dec 27, 2022 at 10:04


Your Answer

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