V 12.1.1 on windows 10
Any one has any suggestions how to persuade Mathematica to obtain these solutions below?
I have small collection of such ODE's from textbooks. But do not know now how to obtain these special solutions.
I'll just show 2 for now. I think one method should works for all.
The problem is that one can not just follow the standard method on these, which is to obtain the general solution and then solve for the constant of integration using the initial conditions, since that leads to singularity.
First
ode = y'[x] == (x^2 + y[x]^2)/(2 x^2)
ic = y[-1] == -1;
DSolve[ode, y[x], x] (*no problem finding general solution*)
DSolve[{ode, ic}, y[x], x]
(* {} *)
But a particular solution exist, which is y[x]==x
:
sol = y -> Function[{x}, x];
ic /. sol
(* True *)
ode /. sol
(* True *)
Second
ode = (x + y[x]) + (x - y[x])*y'[x] == 0;
ic = y[0] == 0;
DSolve[ode, y[x], x] (*no problem finding general solution*)
DSolve[{ode, ic}, y[x], x]
(* {} *)
But a particular solution exist, which is y[x]==(1+Sqrt[2])x
:
sol = y -> Function[{x}, (1 + Sqrt[2]) x];
ic /. sol
(* True *)
ode /. sol // Simplify
(* True*)
ps. I tried the method to find singular solutions given in nonlinear-first-order-differential-equation but it did not find these.
projSolve
to solve over the projective complex line. It solves over the projective real line. I was going to update the answer later when I get a chance. I don't think it matters in practice, but it might be less robust. Conceptually it bothers me. :) $\endgroup$