# Maple and Mathematica disagree using dsolve for system of ODE initial value problem

I'm trying to solve a system of ODEs, symbolically, using Maple and Mathematica. I'm actually comparing the analytic solution with a numerical one (this is for a large simulation project, of which this is a part), and what I find is that the Mathematica solution appears to follow the numerical solutions I'm running, whereas the Maple solution does not. The solutions in this case are too long to be computationally feasible when compared with a numerical solution anyway, so I won't be using either answer, but I'm very curious as to why there is a disagreement. The system of equations is not complex:

$$y_1=A(e^{-at}-e^{-bt})$$ $$\dot{y_2}=a_1y_1-a_2y_2$$ $$\dot{y_3}=a_2y_2-a_3y_3$$

The solution to $y_2$ is the same between Maple and Mathematica, but $y_3$ is very different. I'm aware that sometimes approximate solutions are used, but no warnings came up for this. Is there some other uniqueness in how the two packages handle symbolic solutions that I'm missing?

For completeness, my Mathematica code is: (https://i.stack.imgur.com/3qcr9.png)

And for Maple: (https://i.stack.imgur.com/pjAiS.png)

Any thoughts? Many thanks!

EDIT: While the initial values in general are variables, for purposes of comparison, I set them all to 0.

EDIT 2: Even though the form of the equations are very different, I know they could be mathematically identical. I think they are different, though, because I substituted values for all the parameters and get two different numbers as output.

• Are you sure that the expressions represent different functions? Oct 26, 2017 at 18:45
• Moo - Using FullSimplify makes it a much smaller result, to be sure. However, I'm totally confident that the equation itself is different because I compare it by substituting in the various parameters and solving it at a given t. I compare this to the Maple, Mathematica, and the numerical solutions. Maple was the outlier here. Oct 26, 2017 at 19:55
• Maple,Mathematica give correct answer numericall or analytical.See imgur.com/a/UA2HC Oct 26, 2017 at 21:11
• Thank you Mariusz. When I copied your code it worked, eventually leading me to find a bug. I thought I had checked it all. Appreciate it. Oct 26, 2017 at 22:31

This is not an answer, just an extended comment. I have not look at your codes, but if you want to find an analytic form of the solution it is quite easy to do by hand. The system you are considering is $$\begin{bmatrix}\dot y_2\\\dot y_3\end{bmatrix}= \begin{bmatrix}-a_2 & 0\\a_2 & -a_3\end{bmatrix}\begin{bmatrix} y_2\\y_3\end{bmatrix}+\begin{bmatrix}a_1\\0\end{bmatrix}y_1.$$ It takes the form of linear equation $$\dot x=Ax+Bu$$ with the general solution being $$x(t)=e^{At}x(0)+e^{At}\int_0^te^{-As}Bu(s)\,ds.$$ In your case, $u(s)=y_1(s)$ is a scalar function of exponentials, so the integral can be easily calculated. For example, $$\int_0^te^{-As}Be^{-as}\,ds=\int_0^te^{-(A+aI)s}\,ds\cdot B=(A+aI)^{-1}(I-e^{-(A+aI)t})\cdot B.$$
• Thanks for the comment! I started using Laplace integrals and got $y_2$ but then it got much harder. Using this method to solve $y_3$ looks interesting. However, the full question actually goes analogously up to $y_5$, which is a bit bonkers of a solution. A numerical solution is probably a necessity here. Oct 26, 2017 at 20:00