# Functions defined via inverse Laplace transform - plotting issue [closed]

I need to define a function $k(t,c_1,\alpha_1,c_2,\alpha_2)$ in the following manner:

Clear[c1, c2, a1, a2, p1, p2, q, Q] (*clearing symbol assertions - just in case*)
p1[t_, c1_, a1_] := c1 (1 - E^(-a1*t))
p2[t_, c2_, a2_] := c2 (1 - E^(-a2*t))
q[t_, c1_, a1_, c2_, a2_] := p1[t, c1, a1] + p2[t, c2, a2]
Q[s_, c1_, a1_, c2_, a2_] :=
FullSimplify[ LaplaceTransform[ q[t, c1, a1, c2, a2], t, s]]
k[t_, c1_, a1_, c2_, a2_] :=
FullSimplify[
InverseLaplaceTransform[ 2s^2 Q[s, c1, a1, c2, a2]/(1 - 2s Q[s, c1, a1, c2, a2]),
s, t]]


Now, if I execute the following code:

cmax := 1
amax := 1
tmax := 10
Manipulate[ k[t, c1, a1, c2, a2],
{t, 0, tmax}, {c1, 0, cmax}, {a1, 0, amax},
{c2, 0, cmax}, {a2, 0, amax}]


Mathematica produces proper output, in a way that a concrete numerical value is returned. However, if I execute

 Manipulate[ Plot[k[t, c1, a1, c2, a2], {t, 0, tmax}],
{c1, 0, cmax}, {a1, 0, amax}, {c2, 0, cmax}, {a2, 0, amax}]


then I get no result - only plot axes are printed, regardless of the parameters or plot range. Interestingly, if in the last expression explicit form of $k$ is inserted, everything works perfectly. What do I do wrong?

-

## closed as off-topic by ciao, Artes, m_goldberg, Michael E2, belisariusApr 6 '14 at 20:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – ciao, Artes, m_goldberg, Michael E2, belisarius
If this question can be reworded to fit the rules in the help center, please edit the question.

Try Evaluate@k –  qwerty Apr 6 '14 at 9:45
I wouldn't use := in the definition of k. This causes the simplification and invers Laplace transform to be calculated for every call of k. Use = instead. –  Sjoerd C. de Vries Apr 6 '14 at 11:53

p1[t_, c1_, a1_] := c1 (1 - E^(-a1*t))
p2[t_, c2_, a2_] := c2 (1 - E^(-a2*t))
q[t_, c1_, a1_, c2_, a2_] := p1[t, c1, a1] + p2[t, c2, a2]
Q[s_, c1_, a1_, c2_, a2_] :=
FullSimplify[LaplaceTransform[q[t, c1, a1, c2, a2], t, s]]
k[t_, c1_, a1_, c2_, a2_] =
FullSimplify[InverseLaplaceTransform[
2 s^2 Q[s, c1, a1, c2, a2]/(1 - 2 s Q[s, c1, a1, c2, a2]), s, t]]


and then

cmax = 1;amax = 1;tmax = 10
Manipulate[Plot[k[t, c1, a1, c2, a2], {t, 0, tmax}], {c1, 0, cmax}, {a1, 0, amax},
{c2, 0, cmax}, {a2, 0, amax}]


yields

-