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:


Sols1 = DSolve[Eqs1,{P1,Q1},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?

  • $\begingroup$ You should include your try... $\endgroup$
    – zhk
    Apr 14, 2018 at 14:13
  • $\begingroup$ 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. $\endgroup$ Apr 14, 2018 at 15:39
  • $\begingroup$ Because Mathematica was not solving for the original system. I also omitted the absolute value signs to solve for a less complicated system. $\endgroup$
    – E4M2227601
    Apr 14, 2018 at 15:52

1 Answer 1


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}]
  • $\begingroup$ 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. $\endgroup$
    – E4M2227601
    Apr 14, 2018 at 16:54
  • $\begingroup$ 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)$. $\endgroup$
    – E4M2227601
    Apr 14, 2018 at 21:24
  • $\begingroup$ @E4M2227601 You should accept this is an answer. Ask your second question in a new post. $\endgroup$
    – zhk
    Apr 15, 2018 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.