11
$\begingroup$

Investigating DSolve misses a solution of a differential equation, I came across this odd behavior of DSolve.

The following DSolve command returns an answer to the ODE but the solutions do not satisfy the differential equation.

F[x_, y_, p_] := 4 p + p^2 x^2 - 2 p x y + y^2;
dsol = DSolve[{F[x, y[x], y'[x] - 5] == 0, y[1] == 1}, y, x]
F[x, y[x], y'[x] - 5] /. dsol // FullSimplify

Solve::ifun: Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. >>
Solve::svars: Equations may not give solutions for all "solve" variables. >>
Solve::ifun: ...
Solve::svars: ...
DSolve::bvnr: For some branches of the general solution, the given boundary conditions do not restrict the existing freedom in the general solution. >>
...
General::stop: Further output of DSolve::bvnr will be suppressed during this calculation. >>

(*
{{y -> Function[{x}, -5 x - 2 Sqrt[5 - Log[E^K$84905]] + x Log[E^K$84905]]},
 {y -> Function[{x}, -5 x + 2 Sqrt[5 - Log[E^K$84905]] + x Log[E^K$84905]]},
 {y -> Function[{x}, -5 x - 2 Sqrt[5 - Log[E^K$86037]] + x Log[E^K$86037]]},
 {y -> Function[{x}, -5 x + 2 Sqrt[5 - Log[E^K$86037]] + x Log[E^K$86037]]}}

{-5 (4 - 5 x^2 + 4 x Sqrt[5 - Log[E^K$84905]]), 
 5 (-4 + 5 x^2 + 4 x Sqrt[5 - Log[E^K$84905]]),
 -5 (4 - 5 x^2 + 4 x Sqrt[5 - Log[E^K$86037]]), 
 5 (-4 + 5 x^2 + 4 x Sqrt[5 - Log[E^K$86037]])}
*)

Well, the ODE is singular along y[x] == 1/x (see linked question). Maybe that has something to do with the DSolve::bvnr warning, and maybe we should try an initial condition located off the singular locus, but no luck. We even get the same answer:

DSolve[{F[x, y[x], y'[x] - 5] == 0, y[1] == 1/2}, y, x]
(* Same messages and result as above *)

Even asking for the general solution yields the same answer:

DSolve[{F[x, y[x], y'[x] - 5] == 0}, y, x]
(*
  Messages: Solve::ifun, Solve::svars but not DSolve::bvnr
  Same answer as above
*)

However a symbolic parameter results in an empty set.

dsol = DSolve[{F[x, y[x], y'[x] - a] == 0, y[1] == 1}, y, x]
(*  {}  *)

Following the advice of Solve::ifun, we can try using Reduce as the algebraic solver, and we get the empty solution:

With[{opts = Options[Solve]},
 Internal`WithLocalSettings[
  SetOptions[Solve, Method -> Reduce],
  redsol = DSolve[{F[x, y[x], y'[x] - a] == 0, y[1] == 1}, y, x],
  SetOptions[Solve, opts]]]

DSolve::bvimp: General solution contains implicit solutions. In the boundary value problem, these solutions will be ignored, so some of the solutions will be lost. >>

(*  {}  *)

Omitting the initial condition yields a "double-empty" solution {{}, {}}, which I've never seen before.

Questions:

  • The first result seems wrong and a bug. Is there a relationship to the ODE I am overlooking? Is it a bug?
  • The first result also suggests DSolve found some sort of solution that got mangled on its way back to user-level. If so, is there a way to coax it out of DSolve?
  • The result with Reduce normally means the equation are inconsistent, which is not the case; might it mean DSolve cannot solve the ODE with its current methods, or is it bug?
$\endgroup$
  • $\begingroup$ Looking at the errors, it looks like a branch cut problem. Solvers in general don't handle these kinds of branch cut problems very well. See this example: (wolframalpha.com/input/?i=Sqrt%5Bf%27%5Bx%5D%5D+%3D%3D+-x). This isn't really a bug as much as an expected hardship of computer algebra $\endgroup$ – Searke Jul 30 '15 at 19:37
  • $\begingroup$ @Searke, yes it does. Here's a plot of some (numerical) solutions, if it's any help: i.stack.imgur.com/Aezaa.png $\endgroup$ – Michael E2 Jul 30 '15 at 19:44
  • $\begingroup$ Put more simply. Do you consider this to be a bug? DSolve[{Sqrt[f'[x]] == -x}, f[x], x] {{f[x] -> x^3/3 + C[1]}} $\endgroup$ – Searke Jul 30 '15 at 19:53
  • 1
    $\begingroup$ @Searke No, that I expect. (Indeed, I explain why in the linked question.) But the behavior here is not the same in the following way. Algebraically, your ODE is a branch of the rationalized DE f'[x]^2 == x^2, and the return value is a solution of the rationalized equation. The return value in the question seems to have nothing to do with my ODE, which is already a polynomial (in x, y, y'). (It almost certainly does, but the relationship is obscure.) $\endgroup$ – Michael E2 Jul 30 '15 at 20:01
  • 2
    $\begingroup$ @MichaelE2 The solutions returned by DSolve are those that would be obtained from Solve[F[x, y, K$ - 5] == 0, y] and look nothing like the numerical solutions to this problem. I would guess that DSolve crashed internally and returned what it happened to have last calculated. Certainly, a bug. $\endgroup$ – bbgodfrey Jul 31 '15 at 1:49

Your Answer

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

Browse other questions tagged or ask your own question.