[Math] Solving ordinary differential equation

ordinary differential equations

I am trying to find analytical solution to the following ODE:

$\dot{x}=c_1x+\frac{c_2}{x}+c_3$, where $c_1,c_2,c_3$ are known constants.

If $c_2=0$, then it's a standard linear ODE which I know how to solve. But, I have no idea how to proceed when all the above constants are non-zero. I really appreciate any hints as to how proceed.

Update: I am looking to get a solution like x=f(t) for the above problem.

Thanks in advance.

$\textbf{P.S.}$: If this information helps, I basically started from the following ODE (below) and applied change of variables to obtain the above form :

$\dot{y}=c_1y+c_3 \sqrt{y}+c_2$ and used $x=\sqrt{y}$ variable transformation to get the above ODE. I want to obtain the analytical solution to this ODE, in fact.

Best Answer

So you have the following differential equation

$$\frac{\mathrm dx}{\mathrm dt} = c_1 x+ c_2 x^{-1} + c_3$$

We can isolate $x^{-1}$ in the right side of the equation to get

$$\frac{\mathrm dx}{\mathrm dt} = x^{-1}(c_1x^2+c_3x+c_2) =: x^{-1}p(x)$$

We can find the roots of the polynom $p(x):= c_1x^2+c_3x+c_2$ using

$$x_{\pm} = \frac{-c_3\pm\sqrt{c_3^2-4c_1c_2}}{2c_1}$$

So we will have that $p(x) = (x-x_{+})(x - x_{-})$ and we get the differential equation, where $x_{+},x_{-} \in \mathbb{R}$ are constants determined by the constants $c_1,c_2,c_3$ given by the problem with the relation above

$$\frac{\mathrm dx}{\mathrm dt} = x^{-1}(x - x_{+})(x - x_{-}) \implies \frac{x}{(x-x_{+})(x - x_{-})} \mathrm dx = \mathrm dt$$

Now we can use that

$$\frac{x}{(x-x_{+})(x - x_{-})} = \frac{A}{x - x_{+}} + \frac{B}{x - x_{-}}$$

Where we have that

$$A := \frac{-x_{+}}{x_{-} - x_{+}} \,\,\,\,\,\,\,\,B:=\frac{x_{-}}{x_{-}-x_{+}}$$

Now we integrate both sides of the equation, if we put $x(0) := x_0$ we will have

$$A\int_{x_0}^x\frac{\mathrm dx'}{x' - x_{+}} + B\int_{x_0}^x\frac{\mathrm dx'}{x' - x_{-}} = A\ln\left(\frac{x - x_{+}}{x_0 - x_{+}}\right) + B\ln\left(\frac{x - x_{-}}{x_0 - x_{-}}\right) = t$$

Then we'll have that

$$(x - x_{+})^A(x - x_{-})^B = (x_0 - x_{+})^A(x_0 - x_{-})^Be^t$$

You should work out the case $c_3^2 - 4c_1c_2 < 0$.

Related Question