Question: Density Plot Not as expected

November 10 2012 PatrickT 1993
Maple

0

To plot the density function of the continuous uniform distribution on [-1,1], my initial attempt was: 

plot(Statistics:-PDF(Statistics:-RandomVariable(Uniform(-1,1)),x), x = -1.1 .. 1.1);

See plot below.


But I wanted something more like the wikipedia image (without the labels, naturally):

See plot below.

In words, I expected a horizontal line on the left of x=-1 and on the right of x=1 (at y=0), and I expected no vertical line at the x=-1 and x=1 points (I would have accepted a dashed line, like in the wikipedia image). 

I thought Maple would have a built-in tool. I expected DensityPlot from the Statistics package to do the job. But it doesn't, it merely replicates the top graph above.

Statistics:-DensityPlot( Statistics:-RandomVariable(Uniform(-1,1)), range = -1.1 .. 1.1);



Remark: The output of the command below is even stranger because the vertical line is truncated at x=-1 but visible at x=1.

Statistics:-DensityPlot( Statistics:-RandomVariable(Uniform(-1,1)), range = -1 .. 1);

@ Maple 16.01, Standard Worksheet, Windows 7 x64.


Remark: Impossible to paste the plots within the text today, so I'm pasting them together.

Please Wait...