1

I wanted to write a recursion function to calculate the n-th convolution of a function f[x_]. I wrote the function

g[f[x_], y_, z_] := Convolve[f[x], y, x, z]

where

f[x_] := \[Lambda]*
  Exp[-\[Lambda]*x/L]/((1 - Exp[-\[Lambda]])*L) UnitStep[x]

But now I want to put an n into the g function

g[f[x_], y_, z_,n_]

wich does the same n times! With DO[...] I have the problem the there is no output. How can I do it? thanks in advanced

maniA
  • 125
  • 3

2 Answers2

2

You could also use:

cm[f_, s_, t_, n_] := 
 InverseLaplaceTransform[LaplaceTransform[f, s, t]^(n + 1), t, s]

(s>0):

e.g.

TableForm[Table[{j, cm[Exp[-a s] UnitStep[s], s, t, j]}, {j, 1, 10}], 
 TableHeadings -> {None, {"n", "n-fold Convolution"}}]

enter image description here

ubpdqn
  • 60,617
  • 3
  • 59
  • 148
  • I'm surprised InverseLaplaceTransform[] even works… :) – J. M.'s missing motivation Apr 20 '16 at 13:02
  • @J.M. Actually so was I...I am sure it is brittle but for some straight forward situations may be enough :) – ubpdqn Apr 20 '16 at 13:04
  • @ubpdqn ok your solution is more elegant :) just one question: dose it work with every function, I mean e.g. with truncated exponential too? – maniA Apr 20 '16 at 15:31
  • @maniA I am not sure how robust it is. It may not work for your purposes. It appears to work with a number of functions. Apologies for delay: time zones :) – ubpdqn Apr 21 '16 at 04:45
  • @ubpdqn no matter thanks any way :) ok I tick your response as the answer, however be warned guys that it may not work for the general case ;) then use just my proposal – maniA Apr 25 '16 at 16:50
0

Thanks to all who helped or tried to help me here, finally I found a solution. My special function was the exponential distribution but one can apply it for any arbitrary function.

f[x_] = \[Lambda]*Exp[-\[Lambda]*x] UnitStep[x];
g[x_] = \[Lambda]*Exp[-\[Lambda]*x] UnitStep[x];
convi[n_] := {Do[
    g[x[i]] = Convolve[f[x[i - 1]], g[x[i - 1]], x[i - 1], x[i]], {i, 
     1, n}], g[x[n]]}[[2]]

and if you excuse for instance

convi[4]

you get the 4-fold convolution.

maniA
  • 125
  • 3