1
$\begingroup$

I had the following inverse laplace transform:

InverseLaplaceTransform[(s + Subscript[k, 2] + Subscript[k, 12])/(
 Subscript[V, 
  1] (s^2 + 
    s (Subscript[k, 1] + Subscript[k, 2] + Subscript[k, 12] + 
       Subscript[k, 21]) + Subscript[k, 1] Subscript[k, 2] + 
    Subscript[k, 1] Subscript[k, 12] + 
    Subscript[k, 2] Subscript[k, 21])), s, t]

The solution is:

enter image description here

My goal is to get a compact solution like this:

$$A exp(at) + B exp(bt)$$

Thank you so much for your time.

$\endgroup$
  • 1
    $\begingroup$ What is V? Did you try FullSimplify? $\endgroup$ – David G. Stork Dec 7 '17 at 19:09
  • $\begingroup$ Hello @David G. Stork all k and V are positive constants. Your solution works also very good! $\endgroup$ – Gennaro Arguzzi Dec 7 '17 at 19:47
  • $\begingroup$ Never use an upper-case letter (e.g., V) for a function or variable as it may conflict with Mathematica's internal names. $\endgroup$ – David G. Stork Dec 7 '17 at 19:52
3
$\begingroup$

Just use Collect:

InverseLaplaceTransform[(s + Subscript[k, 2] + 
     Subscript[k, 12])/(Subscript[V, 
      1] (s^2 + 
       s (Subscript[k, 1] + Subscript[k, 2] + Subscript[k, 12] + 
          Subscript[k, 21]) + Subscript[k, 1] Subscript[k, 2] + 
       Subscript[k, 1] Subscript[k, 12] + 
       Subscript[k, 2] Subscript[k, 21])), s, t] // 
 Collect[#, Exp[__]] &

$\frac{\left(\sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)}-k_1+k_2+k_{12}-k_{21}\right)}{2 \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)} V_1}\times\\\exp \left[\left(\frac{1}{2} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)}-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}\right) t\right]+\frac{\left(\sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)}+k_1-k_2-k_{12}+k_{21}\right) }{2 \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)} V_1} \times\\ \exp \left[\left(-\frac{1}{2} \sqrt{\left(k_1+k_2+k_{12}+k_{21}\right){}^2-4 \left(k_1 k_2+k_{21} k_2+k_1 k_{12}\right)}-\frac{k_1}{2}-\frac{k_2}{2}-\frac{k_{12}}{2}-\frac{k_{21}}{2}\right) t\right]$

$\endgroup$
  • $\begingroup$ thank you very much for your extremely clear answer! $\endgroup$ – Gennaro Arguzzi Dec 7 '17 at 19:49
  • $\begingroup$ Can you tell me what is the meaning of the last & in your code please? I know its meaning only if it is followed by another argument. $\endgroup$ – Gennaro Arguzzi Dec 7 '17 at 21:11
  • 1
    $\begingroup$ You can see that Collect has an # inside. Therefore \\Collect[#,Exp[___]]& does the same as Collect[InverseLaplaceTransform[...],Exp[___]], i.e., take the previous result as its argument in #. That is why & should be after. It is a pure like Function construction $\endgroup$ – José Antonio Díaz Navas Dec 8 '17 at 11:26
  • $\begingroup$ See postfix form at Special Ways to Input Expressions $\endgroup$ – Bob Hanlon Mar 2 at 18:38

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.