2
$\begingroup$

Cross-posted in https://www.zhihu.com/question/40784580

In Mathematica I got the different answer of the same differential equation respectively in analytical method and numerical method. At the beginning I think it is queer and later I know that this different equation has more than one answers and this two answer are all right and now it is queer that why each method can only get one answer and why they didn't get the same one answer and what can we do to get all answers of this equation in any one method? Thank you! enter image description here

$\endgroup$
4
  • $\begingroup$ 同学,请不要贴截图,贴代码文本。 $\endgroup$
    – xzczd
    Feb 28 '16 at 3:31
  • $\begingroup$ It is always appreciated when one includes actual code in questions rather than, or at least in addition to, a screen capture of the Notebook. $\endgroup$
    – Mr.Wizard
    Feb 28 '16 at 3:32
  • 2
    $\begingroup$ DSolve picks the generic solution and specializes to the initial condition; NDSolve starts from the initial condition, and because the singular solution is already rectified, NDSolve never strays from it. $\endgroup$
    – Michael E2
    Feb 28 '16 at 4:01
  • $\begingroup$ Related: mathematica.stackexchange.com/a/89385 (with F[x, y, p] == p^2 - y; also mathematica.stackexchange.com/a/57912 -- I'm pretty sure this same equation has come up before, but I can't find it. $\endgroup$
    – Michael E2
    Feb 28 '16 at 4:06
2
$\begingroup$

The IVP does not have a unique solution. Though DSolve gave you one, another is the trivial solution y = 0 provided by NDSolve. So both solutions are correct. MMA cannot determine which one you want.

The DSolve solution is a symbolic solution; the NDSolve solution is a numerical one. Given the algorithm used in the latter, the trivial solution y = 0 is the only one possible by NDSolve. The analytical solution provided by DSolve is just one of infinitely many solutions. The latter are piecewise functions patched together from the trivial solution y = 0 with y = (x-x_0)^2/4 at x = x_0

$\endgroup$
1
  • $\begingroup$ The DSolve solution is a symbolic solution; the NDSolve solution is a numerical one. Given the algorithm used in the latter, the solution x = 0 is the only one possible by NDSolve. The analytical solution provided by DSolve is just the $\endgroup$
    – Stephen
    Feb 28 '16 at 4:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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