I want to solve this nonlinear 1-st order ODE,


I find it non-separable, and Wolfram Alpha does not give me a closed form solution, but the following plots. enter image description here

I am a little rusty on solving ODEs, can someone tell me the method to solve this one? A variable transformation or any other trick? Or do I need initial values to see the behavior of the system (directional fields)?

Thanks in advance.


Now the modified code is as follows,

f[x_] = NDSolveValue[{(1 + x) (0.5 y[x]^-0.5 (x - y[x])^0.5 - 
       0.5 y[x]^0.5 (x - y[x])^-0.5) == -y[x] (x - y[x])/y'[x], 
   y[1] == 0.5}, y[x], {x, 0, 2}]

But the result is still error,

Infinite expression 1/0. encountered. >>
NDSolveValue::ndnum: Encountered non-numerical value for a derivative at x == 1.`. >>

Why in your code, we do not have the indeterminate problem? And the direction field I want is like the one below:

enter image description here

  • $\begingroup$ Try the sub $y = vx$ and come back. I have not solved it personally, but it would be the first place I try. $\textbf{edit}$ Sin ce wolfram cannot find a close formed solution, you most likely wouldn't find one with my suggestion, but you may get to a ode we know for sure can not be solved analytically. $\endgroup$
    – Chinny84
    May 15, 2015 at 7:10
  • $\begingroup$ Nope, the variables are still inseperable. $\endgroup$
    – Mann
    May 15, 2015 at 7:14
  • $\begingroup$ You use the square brackets [ ] wrongly in your Mathematica code as parenthesis. Replace with round ones ( ). $\endgroup$
    – mickep
    May 15, 2015 at 14:40
  • $\begingroup$ @mickep, I can only have initial value y[0]==sth to not get these two error message. Why I can only assign x0=0 for initial value? $\endgroup$
    – Bob
    May 16, 2015 at 1:51
  • $\begingroup$ I guess things are not stable. Look at the coefficient in front of the derivative if y[1]=1/2. $\endgroup$
    – mickep
    May 16, 2015 at 4:38

2 Answers 2


This is not a complete answer, but I'd like to show a figure and that I cannot do in a comment.

I don't see a way to solve this in closed form. Nevertheless, to answer your second question, you can plot the directional field without initial values (in fact, if you had initial values, you'd only plot one of the curves, see the red one in the figure below).

I let Mathematica plot the vector field together with the solution with condition $y(0)=1$.

Update with code included Since you ask for it, I add the Mathematica code below.

First, I let Mathematica solve the differential equation numerically,

 f[x_]=NDSolveValue[{1/(1+x)==(1/(x-y[x])-1/y[x])y'[x],y[0] == 1}, y[x], {x, -1, 2}]

and then plot it,

 g1=Plot[f[x], {x, -1, 2},
   PlotStyle -> Directive[Thick, Red], 
   PlotRange -> {{-0.999, 2}, Automatic}, 
   PlotPoints -> 100

then do the streamplot as it is called,


and then finally showing them both


enter image description here

  • $\begingroup$ thanks for help, can I ask what tool are you using to plot this nice plot? And how do you add the red part for that initial value? I am using Mathematica but do not know how to highlight the line corresponding to an initial value. $\endgroup$
    – Bob
    May 15, 2015 at 12:00
  • $\begingroup$ Updated now, with code. $\endgroup$
    – mickep
    May 15, 2015 at 13:01
  • $\begingroup$ thank you again, BTW, in your streamplot g2, what is the use of 1 at the beginning of the curly bracket? Can you have a look at my updates? Many thanks~ $\endgroup$
    – Bob
    May 15, 2015 at 14:40




Let $u=x-y$ ,

Then $x=u+y$


$\therefore yu\left(\dfrac{du}{dy}+1\right)=(y-u)(u+y+1)$




This belongs to an Abel equation of the second kind.

Follow the method in http://eqworld.ipmnet.ru/en/solutions/ode/ode0126.pdf:

Let $u=\dfrac{v}{y}$ ,

Then $\dfrac{du}{dy}=\dfrac{1}{y}\dfrac{dv}{dy}-\dfrac{v}{y^2}$





Let $s=-(y+1)$ ,

Then $y=-s-1$


$\therefore v\dfrac{dv}{ds}=sv-s(s+1)^2$

Let $t=\dfrac{s^2}{2}$ ,

Then $s=\pm\sqrt{2t}$


$\therefore sv\dfrac{dv}{dt}=sv-s(s+1)^2$




This belongs to an Abel equation of the second kind in the canonical form.

Please follow the method in https://arxiv.org/ftp/arxiv/papers/1503/1503.05929.pdf


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.