It is rather obvious that I am new to Wolfram language and am struggling with it. Efficiency issues aside -- can you explain why this produces wrong result for M[x]:
F[x_] := UnitStep[x-1]*UnitStep[6 - x]*1/6;
G[x_] := DiscreteConvolve[F[n], F[n], n, x];
M[x_] := DiscreteConvolve[G[n], F[n], n, x];
DiscretePlot[{F[x], G[x], M[x]}, {x, 0, 20}]
... and this:
F[x_] = UnitStep[x-1]*UnitStep[6 - x]*1/6;
G[x_] = DiscreteConvolve[F[n], F[n], n, x];
M[x_] = DiscreteConvolve[G[n], F[n], n, x];
DiscretePlot[{F[x], G[x], M[x]}, {x, 0, 20}]
is fine?
Also, I'd also appreciate any advice on improving performance of second snippet.
Thank you for help.