Message Boards Message Boards

0
|
6424 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Using Nest for Convolution of n Uniform Distributions

Posted 9 years ago

I want to define the pdf function that is the convolution of n uniform [0,1] pdfs using the Nest function/process. I realize I can use a for-like loop to accomplish this, but I am trying to expand my horizons and understand Mathematica and programming better... I want to use Nest but cannot figure out what I am doing wrong (probably something simply, but I have spent 2+ hours trying to get below to work):

ClearAll[U, UConv];

U[x_] = PDF[UniformDistribution[], x];

Convolve[U[x], U[x], x, y]

UConv[w_] := {Convolve[U[x], w[[1]][x], x, w[[2]]], w[[2]]};

Nest[UConv, {U, y}, 2]

I was hoping/expecting that Nest[UConv, {U, y}, 2] gives the same result as Convolve[U[x], U[x], x, y], but it doesn't. I cannot even figure out how to interpret Nest[UConv, {U, y}, 2]'s result! Any hints, help, or suggestions would be greatly appreciated. ds

POSTED BY: David S
3 Replies

Your code has some errors. I think you want:

UConv[w_] := {Convolve[U[x], w[[1]], x, w[[2]]], w[[2]]}

Nest[UConv, {U[x], y}, 2]

POSTED BY: Sean Clarke
Posted 9 years ago
POSTED BY: Xavier Roy
Posted 9 years ago
POSTED BY: Xavier Roy
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract