Repeated convolution of a continous uniform distribution
Subject: Repeated convolution of a continous uniform distribution
From: Richard Hennessy
Date: Thu, 18 Jun 2009 15:20:49 -0400
I get the same answer with pw.mac. I think the problem is with the definition of convolution. If you change the t to z in
make_dummy you get the right answer.
convolution(f,g,x) := block([t : make_dummy([e,x],z)], integrate(subst(x = t,f) * subst(x = x - t, g),t,minf,inf))$
and the sign is correct still using abs_integrate. If you want to try pw.mac then you can do it this way which uses both packages.
(%i1) (load("pw.mac"),load("abs_integrate.mac"))$
(%i2) convolution(f,g,x) := block([t : make_dummy([e,x],z)], pwdefint(subst(x = t,f) * subst(x = x - t, g),t,minf,inf))$
(%i3) unit_box(x) := (unit_step(x) - unit_step(x-1))$
(%i4) f1 : convolution(unit_box(x),unit_box(x),x);
(%i5) f2 : convolution(f1,f1,x)$
(%i6) f3 : convolution(f2,f2,x)$
(%i7) plot2d([f1,f2,f3],[x,0,15]);
You get the same answer and the sign is right also.
You also can get centered results with respect to the y axis with the following code.
(%i1) (load("pw.mac"),load("abs_integrate.mac"))$
(%i2) convolution(f,g,x) := block([t : make_dummy([e,x],z)], pwdefint(subst(x = t,f) * subst(x = x - t, g),t,minf,inf))$
(%i5) unit_box(x):=unit_step(x+1/2)-unit_step(x-1/2)$
(%i6) f1 : convolution(unit_box(x),unit_box(x),x)$
(%i7) f2 : convolution(f1,f1,x)$
(%i8) f3 : convolution(f2,f2,x)$
(%i9) (showtime:true, f4 : convolution(f3,f3,x))$
Evaluation took 382.6300 seconds (382.6300 elapsed)
(%i10) plot2d([f1,f2,f3,f4],[x,-5,5])$
(%i13)
You can get pw.mac from my site.
http://mysite.verizon.net/res11w2yb/id2.html
Rich
----- Original Message -----
From: "Barton Willis" <willisb at unk.edu>
To: <weaker at directbox.com>
Cc: <maxima at math.utexas.edu>
Sent: Thursday, June 18, 2009 8:03 AM
Subject: Re: [Maxima] Repeated convolution of a continous uniform distribution
There is code in share/contrib (abs_integrate) that should be able to
do this problem symbolically. If you don't know, code in share/contrib
is sometimes not as well tested as other parts of Maxima. Likely, your
problem shows a bug in abs_integrate. Try this
(%i47) load("abs_integrate.mac")$
(%i48) convolution(f,g,x) := block([t : make_dummy([e,x],t)],
integrate(subst(x = t,f) * subst(x = x - t, g),t,minf,inf))$
(%i49) unit_box(x) := (unit_step(x) - unit_step(x-1))$
(%i50) f1 : convolution(unit_box(x),unit_box(x),x);
(%o50) -(x*signum(x))/2+x*signum(x-1)-signum(x-1)-(x*signum(x-2))/2+signum
(x-2)
(%i51) f2 : convolution(f1,f1,x)$
(%i52) f3 : convolution(f2,f2,x)$
(%i53) plot2d([f1,f2,f3],[x,0,15]);
I think the signs of f1,f2, and f3 are wrong.
Two more things. First, convolution(f3,f3,x) is a large mess and
further convolutions might take a long time. Maybe you should do the
problem numerically. Second, there is another package that integrates
step functions and friends. Maybe this package can do this problem
correctly--maybe the author can comment.
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>I want to do a repeated convolution of a continous uniform distribution in
>a limited interval [-a,a].
_______________________________________________
Maxima mailing list
Maxima at math.utexas.edu
http://www.math.utexas.edu/mailman/listinfo/maxima