Solving a pair of ODEs

287 Views Asked by At

I'm trying to solve a pair of ODEs for which I've obtained a solution. However, my problem is that my answer is slightly different from mathematica's answer.

$$ \frac{dA}{dt} = \theta - (\mu + \gamma)A, \ \ A(0) = G$$ $$ \frac{dT}{dt} = 2 \mu A - (\mu + \gamma)T, \ \ T(0) = B$$

Using an integrating factor of $e^{(\mu + \gamma)t}$, I got the following solution to the first ODE:

$$ A(t) = \frac{\theta}{\mu + \gamma} + \left(G -\frac{\theta}{\mu + \gamma}\right)e^{-(\mu + \gamma)t}$$ For simplicity, let $\mu + \gamma = \alpha$ such that:

$$ A(t) = \frac{\theta}{\alpha} + \left(G -\frac{\theta}{\alpha}\right)e^{-\alpha t}$$

For the second ODE (again using an integrating factor of $e^{(\mu + \gamma)t}= e^{\alpha t}$ ):

$$ e^{\alpha t}\frac{dT}{dt} + e^{\alpha t}\alpha T = 2 \mu A e^{\alpha t} $$

$$ T(t)e^{\alpha t} = \int 2 \mu e^{\alpha t}\left(\frac{\theta}{\alpha} + \left(G -\frac{\theta}{\alpha}\right)e^{-\alpha t}\right)dt $$

$$ T(t) = \frac{2 \mu \theta}{\alpha^2} + \left(B - \frac{2 \mu \theta}{\alpha^2}\right)e^{-\alpha t} $$

However, when I computed these two ODEs in mathematica, it gave back the following solution:

$$ T(t) = Be^{-\alpha t} + 2G \mu te^{-\alpha t}+ \frac{2 \mu \theta}{\alpha^2} - \frac{2 \mu \theta e^{-\alpha t}}{\alpha^2} - \frac{2 \mu \theta t e^{-\alpha t}}{\alpha} $$

I've tried solving my equation over and over again but I can't seem to understand why my solution is different from mathematica's. The only I thought about was possibly in the substitution of arbitrary constant. Am I missing something obvious here?

1

There are 1 best solutions below

2
On BEST ANSWER

You forgot the integration constant. Following on from your integral for $T(t)$, we find

\begin{align} T(t)e^{\alpha t} &= \int 2 \mu e^{\alpha t}\left(\frac{\theta}{\alpha} + \left(G -\frac{\theta}{\alpha}\right)e^{-\alpha t}\right)dt \\ &= \int 2 \mu e^{\alpha t}\left(\frac{\theta}{\alpha}\right) + 2 \mu \left(G -\frac{\theta}{\alpha}\right) dt \\ &= 2 \mu e^{\alpha t}\left(\frac{\theta}{\alpha^{2}}\right) + 2 \mu \left(G -\frac{\theta}{\alpha}\right)t + C \\ \implies T(t) &= 2 \mu \left(\frac{\theta}{\alpha^{2}}\right) + 2 \mu \left(G -\frac{\theta}{\alpha}\right)t e^{-\alpha t} + Ce^{-\alpha t} \\ T(0) &= B \\ &= 2 \mu \left(\frac{\theta}{\alpha^{2}}\right) + C \\ \implies C &= B - 2 \mu \left(\frac{\theta}{\alpha^{2}}\right) \\ \implies T(t) &= 2 \mu \left(\frac{\theta}{\alpha^{2}}\right) + 2 \mu \left(G -\frac{\theta}{\alpha}\right)t e^{-\alpha t} + \bigg(B - 2 \mu \left(\frac{\theta}{\alpha^{2}}\right) \bigg)e^{-\alpha t} \\ &= \frac{2 \mu \theta}{\alpha^{2}} + 2 \mu G t e^{-\alpha t} - \frac{2 \mu G \theta}{\alpha}t e^{-\alpha t} + B e^{-\alpha t} - \frac{2 \mu \theta}{\alpha^{2}} e^{-\alpha t} \\ &= B e^{-\alpha t} + 2 \mu G t e^{-\alpha t} + \frac{2 \mu \theta}{\alpha^{2}} - \frac{2 \mu G \theta}{\alpha}t e^{-\alpha t} - \frac{2 \mu \theta}{\alpha^{2}} e^{-\alpha t} \end{align}