JoyDivisionMan

30 Reputation

2 Badges

4 years, 194 days

MaplePrimes Activity


These are questions asked by JoyDivisionMan

I have constructed two Random Variables (X1 and X2).  They work the way I want.  When I take the abs(X1-X2) and ask for the PDF, I get output with Elliptic functions that seems to be in complex space. I read about the Elliptic functions, but got nowhere -- above my head.

I only want the "real" output on the 0 <= t <= 2 domain.  Does anyone know how to parse this output so that I can see a PDF as a function of t?

NULL

with(Statistics)

fx1 := piecewise(t < -1, 0, And(t >= -1, t <= 1), 2*sqrt(-t^2+1)/Pi, t > 1, 0)

fx2 := piecewise(t < -1, 0, And(t >= -1, t <= 1), 2*sqrt(-t^2+1)/Pi, t > 1, 0)

X1 := RandomVariable(Distribution(PDF = unapply(fx1, t)))

X2 := RandomVariable(Distribution(PDF = unapply(fx2, t)))

Dist := abs(X1-X2)

simplify(PDF(Dist, t))

piecewise(t <= 0, 0, t < 2, (1/3)*((-2*t^3-8*t)*EllipticE(I*t/((2+t)^(1/2)*(-t+2)^(1/2)), I*(-t^2+4)^(1/2)/t)+16*EllipticF(I*t/((2+t)^(1/2)*(-t+2)^(1/2)), I*(-t^2+4)^(1/2)/t)*t+(2*t^3+8*t)*EllipticE(I*(-t^2+4)^(1/2)/t)-16*EllipticK(I*(-t^2+4)^(1/2)/t)*t+infinity)/Pi^2, 2 <= t, 0)

(1)
 

NULL

Download AbsDiff.mw

I have one random variable as follows:  r := sqrt(RandomVariable(Uniform(0,1)))

I have another as follows:  x := cos(RandomVariable(Uniform(0, 2*Pi)));

The r variable returns a PDF of 2*t, where t<1; 0 otherwise.  The variable x returns a PDF of 1/(Pi*sqrt(1-t^2)), where |t|<1; 0 otherwise.

For both random variables, I have validated through simulated values.  I am convinced the above PDF functions are correct.  When I multiply r*x in Maple and then ask for a PDF of the resultant random variable, I fail.  Maple seems to not like this.

My question is then as follows...can anyone help me get the PDF of r*x?

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