JoyDivisionMan

20 Reputation

2 Badges

4 years, 125 days

MaplePrimes Activity


These are questions asked by JoyDivisionMan

I am trying to calculate a probability density function for the distance between two points inside a unit circle.  I have succeeded with doing this for a few differing applications, but I am stuck on this problem.  I use uniformly distributed polar coordinates to find x and y values for two independent points.  When I ask for the PDF of the distance, I get a FAIL.

I am assuming that such a calculation is possible, I've succeeded with similar problems, but here I am stuck.  I hope my problem is rooted in my lack of knowledge, as opposed to a limitation of Maple.

Here are my Maple statements:

with(Statistics);
th1 := RandomVariable(Uniform(0, 2*Pi));
th2 := RandomVariable(Uniform(0, 2*Pi));
r1 := RandomVariable(Uniform(0, 1));
r2 := RandomVariable(Uniform(0, 1));
x1 := r1*cos(th1);
y1 := r1*sin(th1);
x2 := r2*cos(th2);
y2 := r2*sin(th2);
Dist := sqrt((x1 - x2)^2 + (y1 - y2)^2);
f := simplify(PDF(Dist, t));

Does anyone have any idea as to what I am doing wrong?  Thank you.

I am doing some work in Maple.  Specifically, I run the following commands in Maple worksheet mode:

with(Statistics);
L := abs(RandomVariable(UniformDistribution(0, 1)) - RandomVariable(UniformDistribution(0, 1)));
Export("LineDensity.jpg", DensityPlot(L));
PDF(L, x);

Everything works fine.  When I export these commands into an MPL script, I get the following:

with(Statistics);
L := abs(RandomVariable(UniformDistribution(0, 1)) - RandomVariable(UniformDistribution(0, 1)));
Export("LineDensity.jpg", DensityPlot(L));
PDF(L, x);
NULL;

When I execute this script, I get the following error message:

Warning: persistent store makes readlib obsolete
Error: (in Export) exported file LineDensity.jpg could not be created

I need to do the work in MPL script form so that I can have larger problems processed.  Does anyone know why I would be having this problem with the Export function?  

I am looking to find a distribution function (both PDF and CDF) for the distance between two points on the unit square.

Each point will be uniformly distributed on the [0,1] interval for both the x and y axes.  The distance between these points (dij) will of course be:

d[i, j] := sqrt((x[i] - x[j])^2 + (y[i] - y[j])^2)

I think that using a convolution may be required, but this is over my head.  If anybody can show me (preferably via a Maple worksheet), I would be very appreciative.

Thank you.

Page 1 of 1