Solve first order nonlinear differential equations

1k Views Asked by At

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

$$\frac{1}{1+x}=(\frac{1}{x-y}-\frac{1}{y})\frac{dy}{dx}$$

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.

Update

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

2

There are 2 best solutions below

3
On

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,

 g2=StreamPlot[{1,1/(1+x)/((1/(x-y)-1/y))},{x,-4,2},{y,-5,5}]

and then finally showing them both

 Show[g1,g2]

enter image description here

0
On

$\dfrac{1}{1+x}=\left(\dfrac{1}{x-y}-\dfrac{1}{y}\right)\dfrac{dy}{dx}$

$\dfrac{1}{x+1}=\dfrac{2y-x}{y(x-y)}\dfrac{dy}{dx}$

$y(x-y)\dfrac{dx}{dy}=(2y-x)(x+1)$

Let $u=x-y$ ,

Then $x=u+y$

$\dfrac{dx}{dy}=\dfrac{du}{dy}+1$

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

$yu\dfrac{du}{dy}+yu=yu+y(y+1)-u^2-(y+1)u$

$yu\dfrac{du}{dy}=y(y+1)-(y+1)u-u^2$

$u\dfrac{du}{dy}=y+1-\dfrac{(y+1)u}{y}-\dfrac{u^2}{y}$

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}$

$\therefore\dfrac{v}{y}\left(\dfrac{1}{y}\dfrac{dv}{dy}-\dfrac{v}{y^2}\right)=y+1-\dfrac{(y+1)v}{y^2}-\dfrac{v^2}{y^3}$

$\dfrac{v}{y^2}\dfrac{dv}{dy}-\dfrac{v^2}{y^3}=y+1-\dfrac{(y+1)v}{y^2}-\dfrac{v^2}{y^3}$

$\dfrac{v}{y^2}\dfrac{dv}{dy}=y+1-\dfrac{(y+1)v}{y^2}$

$v\dfrac{dv}{dy}=y^2(y+1)-(y+1)v$

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

Then $y=-s-1$

$\dfrac{dv}{dy}=\dfrac{dv}{ds}\dfrac{ds}{dy}=-\dfrac{dv}{ds}$

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

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

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

$\dfrac{dv}{ds}=\dfrac{dv}{dt}\dfrac{dt}{ds}=s\dfrac{dv}{dt}$

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

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

$v\dfrac{dv}{dt}-v=-(\pm\sqrt{2t}+1)^2$

$v\dfrac{dv}{dt}-v=-2t\mp2\sqrt{2t}-1$

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