# Solving a difficult differential equation

I've the following DE, describing a physical phenomenon. And the prupose is to solve that DE using Mathematica

$$x(t)\cdot r+x'(t)\cdot l+a\cdot\ln\left(1+\frac{x(t)}{b}\right)=0\space\Longleftrightarrow\space x(t)=\dots$$

The intial conditon is equal to $$x(0)=x_0$$ which is bigger than zero.

For the constants:

• $$r$$ can be very large;
• $$l$$ can be very large;
• $$a$$ is round about $$0.02526$$;
• $$b$$ is very small, round about $$300\cdot10^{-6}$$;
• $$x_0$$ can be very large

How can I solve $$x(t)$$ for general the general constants?!

• Are you worried about numerical issues when your parameters get very large and very small? In that case, a re-parametrization may help: set $s=t\cdot r/l$ as the new "scaled time" and $y(s)=x(t)/b$ as the reparametrized function, to find the differential equation $$y(s)+y'(s)+A\cdot\ln(1+y(s))=0$$ with the constant $A=\frac{a}{b r}$ and the initial condition $y(0)=x_0/b$. Likely in this form the size of the single parameter $A$ is less of a numerical issue. – Roman Dec 30 '18 at 19:51
• @Roman: See addition to my answer where no reparametrization is used. – user64494 Dec 30 '18 at 20:24
• After re-parametrization, if $y_0$ turns out to be small, then you can use a series-expansion of the logarithm $ln(1+y)\approx y-y^2/2$ to get a pretty good approximation of the solution, which can now be written in closed form: DSolve[{y[s] + y'[s] + A*(y[s] - y[s]^2/2) == 0, y[0] == y0}, y[s], s] // FullSimplify – Roman Dec 30 '18 at 20:50
• @Roman: Since "you can use a series-expansion of the logarithm " is not based and no numeric example is presented, all that is built on the sand. BTW, according to the question, $x_0/b$ is big. – user64494 Dec 30 '18 at 21:02
• @user64494: the conditions on the series-expansion are $\| y_0 \| \ll 1$ and $A > -1$. You're right that the first condition is probably not satisfied, so this is meaningless in the present question. – Roman Dec 31 '18 at 7:45

It can be done as follows (l is replaced by L to avoid a possible misunderstanding).
 s=ParametricNDSolve[{r*x[t]+L*x'[t]+a*Log[1 + x[t]/b]==0,x[0]==x0},x,{t,0,2},{r,a,b,L,x0}]

x1 = x[1001, 0.02, 3*10^(-4), 10^5, 10^5] /. s;