I searched this site looking for similar question but could not find one. Feel free to close this if it is duplicate.
Given the Bernoulli ode
\begin{align} y^{\prime} & =y+x\sqrt{y}\tag{1}\\ y\left( 0\right) & =4\tag{2} \end{align}
I have two questions about Mathematica solution to the above ode.
The first is: I solved this by hand and obtained the general solution (before applying the initial conditions) as (I can post the hand solution if needed)
\begin{equation} \sqrt{y}=-2-x+4e^{\frac{x}{2}}\tag{3} \end{equation}
Also Maple gives same solution as above:
But Mathematica gives the general solution as
ClearAll[x, y];
ode = y'[x] - y[x] == x*y[x]^(1/2);
ic = y[0] == 4;
solNoIc = DSolve[ode, y[x], x]
Mathematica automatically squared both side of the solution. But this causes a problem later on when finding the initial conditions, since it introduces extra root.
Question: Should Mathematica have left the general solution with the sqrt in the general solution as in (3)?
The second question on this solution: Adding now initial conditions, Mathematica gives two solutions. This is as side effect of squaring both side of (3). It gives
solWithIc = DSolve[{ode, ic}, y[x], x]
But these two solutions are the same only at $x=0$. Any interval around $x=0$ these two solutions are not the same. But this violates existence and uniqueness theory of first order ode (Picard-Lindelof theorem).
Writing (1) as $y^{\prime}=f\left( x,y\right) =$ $y+x\sqrt{y}$, this shows $f$ is continuous for all $x,y$. And $\frac{\partial f}{\partial y}=1+\frac{x}{2\sqrt{y}}$. This shows that $\frac{\partial f}{\partial y}$ is continuous for all $x,y$ except at $y=0$.
So the solution can not cross $y=0$. So there exists solution which is unique in some rectangle either in upper half of the plane or lower half of the plane. But initial conditions says $y=4$ at $x=0$.
Since initial conditions is in upper half of plane. This means there exists a unique solution in some rectangle around the initial conditions point and exists only in upper half of plane.
But Mathematica gives 2 solutions. These are the same only at $x=0$. So there is no interval (no matter how small) around $x=0$ where the solution of the ode is unique. This violates Picard-Lindelof. The ode should have only one solution.
Verify Mathematic's solutions
Here is attempt to verify Mathematica's own solutions. It verifies the first solution but not the second:
ClearAll[x,y];
ode=y'[x]-y[x]==x*y[x]^(1/2);
ic=y[0]==4;
solWithIc=DSolve[{ode,ic},y,x]
{ode,ic}/.solWithIc//FullSimplify
Reduce[x (2 - 4 E^(x/2) + x + Sqrt[(2 - 4 E^(x/2) + x)^2]) == 0, Reals]
Reduce[ x (2 + x + Sqrt[(2 + x)^2]) == 0, Reals]
So Mathematica says its second solution is only valid at initial conditions $x=0$ and for $x\leq -2$. But it should be an interval centered at $x=0$.
The question is: Is Mathematica solution mathematically correct? Does Mathematica solution for the IVP violate Picard-Lindelof theorem?
Solve
solves equations algebraically. I don't know how easy it is to verify that a solution is valid in a neighborhood and not just at a point. Further, I'm not sureDSolve
checks the results ofSolve
. The solution that''s "valid" only at a point is not a valid solution; otherwise, one could accept any expression whose value at x=0 is y=4. — BTW, Picard-Lindelöf does apply here since the IC is at y=4, not y=0. $\endgroup$Sqrt[]
was multivalued and convergence & continuity weren't always a concern, leastways not in the modern sense.) Anyway, the spurious solution does not violate P-L because it does not satisfy the ode in an interval containing x=0. Only one of the solutions satisfies the ode in such an interval. $\endgroup$