Solving a System of Nonlinear Differential Equations

I tried to solve the following system of equations:

\begin{align*} x'(t) &= \frac{a \, |y(t)-x(t)|}{e^{\, b \, |y(t)-x(t)|}} - \frac{c}{|y(t)-x(t)|}\\ y'(t) &= - \, x'(t) \end{align*}

with initial conditions $x(0) = x_0$ and $y(0) = y_0$. There is one more constraint, namely $x(t) \neq y(t)$. Unfortunately, Mathematica calculated solutions for $x(t)$ and $y(t)$ which I am not familiar with. Furthermore, I did not manage to plot these solutions together with their corresponding vector field.

Here is my trial:

Eqs1:={P1'[t]==a*(Q1[t]-P1[t])*E^(-b*(Q1[t]-P1[t])),Q1'[t]==-P1'[t]};

Sols1 = DSolve[Eqs1,{P1,Q1},t]

Eqs2:={P2'[t]==-c/(Q2[t]-P2[t]),Q2'[t]==-P2'[t]};

Sols2 = DSolve[Eqs2,{P2,Q2},t]

Manipulate[Plot[{C[1]-InverseFunction[1/2 ExpIntegralEi[-b (-C[1]+2 #1)]&][-a t+C[2]]+C[1]+1/2 (-C[1]-Sqrt[4 c t+C[1]^2+4 C[2]]),InverseFunction[1/2 ExpIntegralEi[-b (-C[1]+2 #1)]&][-a t+C[2]]+1/2 (C[1]+Sqrt[4 c t+C[1]^2+4 C[2]])},{t,0,10},PlotRange->Automatic,ImageSize->Large],{a,0,10},{b,-5,5},{c,0,10},{C[1],0,10},{C[2],0,10}]


Basically, I tried solving the system by splitting the equations.

Is anyone able to help me out of this?

• You should include your try...
– zhk
Apr 14, 2018 at 14:13
• I have no idea why you would expect to obtain solutions anyhow related to your original, nonlinear system by solving two other, rather unrelated systems. Apr 14, 2018 at 15:39
• Because Mathematica was not solving for the original system. I also omitted the absolute value signs to solve for a less complicated system. Apr 14, 2018 at 15:52

I suspect that your system has any closed form solution. So, why not go for numerical,

Eqs := {x'[t] == a*Abs[y[t] - x[t]] E^Abs[-b (y[t] - x[t])] - c/Abs[(y[t] - x[t])],
y'[t] == -x'[t], x[0] == x0, y[0] == y0} /. {a -> 1, b -> 1, c -> 1, x0 -> 1, y0 -> 2}

Sols = NDSolve[Eqs, {x, y}, {t, 0, 10}]

Plot[Evaluate[{x[t], y[t]} /. Sols], {t, 0, 10}]

• In fact, it is a bit more complicated. I am modelling the attraction and repulsion between two objects in one dimension in the first place. So $x$ and $y$ depend on $|y(t)−x(t)|$. I tried writing it like $x'(p)=\frac{a \, |p|}{e^{b \, |p|}} − \frac{c}{|p|}$ where $p = |y(t)−x(t)|$ but I did not manage to code this embedding in Mathematica. Apr 14, 2018 at 16:54
• I succeeded in making plots thanks to you and the way described in mathematica.stackexchange.com/a/84202/57591. My next question is how I can extend this to two dimensions, i.e. $x = (x_1, x_2)$. Apr 14, 2018 at 21:24
• @E4M2227601 You should accept this is an answer. Ask your second question in a new post.
– zhk
Apr 15, 2018 at 9:01