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
DSolvefound some sort of solution that got mangled on its way back to user-level. If so, is there a way to coax it out ofDSolve? - The result with
Reducenormally means the equation are inconsistent, which is not the case; might it meanDSolvecannot solve the ODE with its current methods, or is it bug?
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 (inx,y,y'). (It almost certainly does, but the relationship is obscure.) – Michael E2 Jul 30 '15 at 20:01DSolveare those that would be obtained fromSolve[F[x, y, K$ - 5] == 0, y]and look nothing like the numerical solutions to this problem. I would guess thatDSolvecrashed internally and returned what it happened to have last calculated. Certainly, a bug. – bbgodfrey Jul 31 '15 at 01:49fr = Solve[F[x, y[x], y'[x] - 5] == 0, y'[x]]; DSolve[{fr[[1, 1]] /. Rule -> Equal, y[1] == 1}, y, x]gives the same error messages and nonsense answers. – bbgodfrey Jul 31 '15 at 01:52