# Solutions of ODE from Mathematica and Laplace transform differ

The equation is $$p'(t)=k_1s_0{e}^{-k_1t}-k_2p(t)$$

The solution with Mathematica

DSolve[p'[t] == k1*s0*E^(-k1*t) - k2*p[t], p[t], t]


$$p(t) = -(k_1/(k_1-k_2)) s_0 (e^{-k_1t}) + p(0) e^{-k_2t}$$

but when I applied Laplace transform the result is

$$p(t) = (k_1/(k_1-k_2)) s_0 (e^{-k_1t}–e ^{-k_2t}) + p(0) e^{-k_2t}$$

I followed this Laplace transform mentioned in the appendix from this paper: enter link description here

I am wondering where is the mistake.

Thanks a lot!

• Please, always post the code that produced the results (please, in copyable form). Otherwise, we cannot tell what went wrong. Commented Jul 25, 2019 at 17:52
• The code from Mathematica is DSolve[p'[t] == k1*s0*E^(-k1*t) - k2*p[t], p[t], t] I am wondering could that solution be wrong? Commented Jul 25, 2019 at 17:54
• Please post the original code in correct markdown (not in $\LaTeX$!) and put that into your original post. Moreover, the code for the result from the Laplace transform is still missing. Commented Jul 25, 2019 at 17:58

Possible typo/initial value not given in DSolve? (note the $$c_1$$ returned by DSolve may not necessarily be p[0]). The two agree for me:

eqn = p'[t] == k1*s0*E^(-k1*t) - k2*p[t]
dsol = DSolve[{eqn, p[0] == p0}, p[t], t]
leqn = ApplySides[LaplaceTransform[#, t, s] &, eqn]
lsol = Solve[leqn, LaplaceTransform[p[t], t, s]]
ilsol = InverseLaplaceTransform[
LaplaceTransform[p[t], t, s] /. lsol[[1]], s, t] // FullSimplify
s1 = p[t] /. {dsol[[1, 1]]} /. {p0 -> p[0]}
s1 == ilsol // FullSimplify


Returns True

• I expected something the like. Good job! (+1) Commented Jul 25, 2019 at 18:37
• So @egwene sedai do you mean that the second solution is correct? And why simple DSolve doesn't solve the equation? Thanks. Commented Jul 25, 2019 at 18:50
• @Ксения Цочева Your call of DSolve did solve the ODE, but the general one with one integration constant that does not coincide with $p(0)$. Note that the ODE has infinitely many solutions when you do not specify its initial condition. Commented Jul 25, 2019 at 18:55
• Thanks a lot! I understood the problem. Commented Jul 25, 2019 at 19:02