2
$\begingroup$

I'm trying to solve a linear differential equation as in the following code:

DSolve[x'[t] == a + b E^(g t) + (c + d E^(-g t)) x[t], x[t], t]

which yields

enter image description here

K[1] in the integral term is mysterious. I looked at here and here, but wasn't able to find a solution. I couldn't find anything in my equation that makes it uncomputable.

Thanks for your help!

$\endgroup$
  • 1
    $\begingroup$ The 1 in K[1] just means it's the first integration dummy variable needed. If you had many you'd get K[1], K[2], ... $\endgroup$ – b3m2a1 Jul 22 '19 at 20:36
  • 1
    $\begingroup$ Now that they've got the generated constant formerly known as C[1] nicely formatted, they should do something similar with the K[1]! $\endgroup$ – Chris K Jul 22 '19 at 20:50
3
$\begingroup$

This comes from integrating the ODE

The ODE to solve is \begin{align*} {\frac {\rm d}{{\rm d}t}}x \left( t \right) =a+b{{\rm e}^{gt}}+ \left( c+d{{\rm e}^{-gt}} \right) x \left( t \right) \end{align*}

In canonical form, the ODE is written as \begin{align*} x' &= F(t,x)\\ &= {{\rm e}^{-gt}}dx+b{{\rm e}^{gt}}+cx+a \end{align*}

The ODE is linear in $x$ and has the form $$ x' = x f(t) + g(t) $$ Where $f(t) = c+d{{\rm e}^{-gt}}$ and $g(t) = b{{\rm e}^{gt}}+a$.

Writing the ODE as \begin{align*} x' - \left( \left( c+d{{\rm e}^{-gt}} \right) x\right) &= b{{\rm e}^{gt}}+a\\ x' - \left( c+d{{\rm e}^{-gt}} \right) x &= b{{\rm e}^{gt}}+a \end{align*} Therefore the integrating factor $\mu$ is $$ \mu = e^{\int -c-d{{\rm e}^{-gt}}\mathop{\mathrm{d}t}} = {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}} $$ The ode becomes \begin{align*} \frac{\mathop{\mathrm{d}}}{ \mathop{\mathrm{d}t}} \mu x &= \mu \left(b{{\rm e}^{gt}}+a\right) \\ \frac{\mathop{\mathrm{d}}}{ \mathop{\mathrm{d}t}} \left(x{{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\right) &= \left( b{{\rm e}^{gt}}+a \right) {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\\ \mathrm{d} \left(x{{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\right) &= \left( \left( b{{\rm e}^{gt}}+a \right) {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\right) \mathrm{d} t \end{align*} Integrating both sides gives \begin{align*} x{{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}} &= \int \! \left( b{{\rm e}^{gt}}+a \right) {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\,{\rm d}t + C_1 \end{align*} Dividing both sides by the integrating factor $\mu={{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}$ results in $$ x = {1\int \! \left( b{{\rm e}^{gt}}+a \right) {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}}\,{\rm d}t \left( {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}} \right) ^{-1}}+{{\it \_C1} \left( {{\rm e}^{-ct+{\frac {d{{\rm e}^{-gt}}}{g}}}} \right) ^{-1}} $$ Simplifying the solution gives $$ x={{\rm e}^{{\frac {ctg-d{{\rm e}^{-gt}}}{g}}}} \left( \int \! \left( b{{\rm e}^{gt}}+a \right) {{\rm e}^{-{\frac { \left( ctg{{\rm e}^{gt}}-d \right) {{\rm e}^{-gt}}}{g}}}}\,{\rm d}t+{\it \_C1} \right) $$

Now, instead of writing $\int \!b{\mathrm{e}^{{\frac{-ctg+{g}^{2}t+d{\mathrm{% e}^{-gt}}}{g}}}}+{\mathrm{e}^{{\frac{-ctg+d{\mathrm{e}^{-gt}}}{g}}}}a\,% \mathrm{d}t$, Mathematica wrties as \begin{equation*} \int_{1}^{t}b{\mathrm{e}^{{\frac{-cKg+{g}^{2}K+d{\mathrm{e}^{-gK}}}{g}}}}+% {\mathrm{e}^{{\frac{-cKg+d{\mathrm{e}^{-gK}}}{g}}}}a\,\mathrm{d}K \end{equation*}

i.e. it uses $K[n]$ as dummy variable of integration inside the integral. That is all. The choice of 1 as lower limit vs. 0 is arbitrary. Mathematica always uses 1 for lower limit in such cases.

$\endgroup$
  • $\begingroup$ Thanks so much! So, when I Plot the solution along with parameter values assigned, I should get concrete value for $t=1,2,3,\cdots$, right? But Mathematica doesn't compute the integral for $t=1,2,3,\cdots$ but simply reproduce the integral with $t=1,2,3,\cdots$ in the output. For example, I tried x[1] and I don't get any specific value. (Of course, I assigned values for the other parameters. $\endgroup$ – ppp Jul 22 '19 at 20:54
  • $\begingroup$ @ppp you can't plot the solution as is, since there is an unknown constant of integration in it. You need to have an initial condition specified to get specific solution to plot. $\endgroup$ – Nasser Jul 22 '19 at 21:03
  • $\begingroup$ Yes, as just mentioned, I assigned specific values for all unknown constants of integration, i.e. $a$, $b$, $c$, $d$, $g$, and $C_1$. Then I should be able to plot the solution, right? But it doesn't work... $\endgroup$ – ppp Jul 22 '19 at 21:08
  • $\begingroup$ @ppp In this case, yes, it should work. I do not know why. May you are making a mistake somewhere. May be you can post a separate question on this if you want. $\endgroup$ – Nasser Jul 22 '19 at 21:11
  • $\begingroup$ I have created a new post on this here. Can you please help me once more? Thank you so much! $\endgroup$ – ppp Jul 22 '19 at 21:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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