Mikhail Drugov

128 Reputation

5 Badges

15 years, 214 days

MaplePrimes Activity


These are questions asked by Mikhail Drugov

Hello,

Is it possible to have a common legend for different figures? I can plot them as Array of Plots (below) but then they each have a legend. 

Is it possible to have the two figures side by side and a common legend in the middle?

Thank you!

restart:
with(plots):
A := Array(1 .. 2):
A[1] := plot([2*sin(x), 3*sin(x)], x = -Pi .. Pi, labels = [x, b*sin(x)], color = [blue, red], legend = ["Case of b=2", "Case of b=3"]):
A[2] := plot([2*cos(x), 3*cos(x)], x = -Pi .. Pi, labels = [x, b*cos(x)], color = [blue, red], legend = ["Case of b=2", "Case of b=3"]):
display(A);

Hello,

I have lists of points of different ranges that I want to plot on the same graph. I would not want to manually cut the list for the range I want to see (there are many lists) so I thought about the view option. But there seems to be a strange behaviour of pointplot combined with view:

restart;
with(plots);
pointplot([[0.1, 0.5], [0.7, 0.7]], view = [0 .. 1, 0 .. 0.1]);

 

Hello,

HazardRate seems not to work for a convolution - it always returns zero.

restart;
with(plots);
with(Statistics);
X1 := RandomVariable(Uniform(0, 1));
X2 := RandomVariable(Uniform(0, 1));
HazardRate(1/2*X1 + 1/2*X2, 0.4); #returns zero
plot(HazardRate(1/2*X1 + 1/2*X2, t), t = 0 .. 0.9, legend = "Hazard Rate"); #plots zero
#writing hazard rate explicitly works fine
plot(PDF(1/2*X1 + 1/2*X2, t)/(1 - CDF(1/2*X1 + 1/2*X2, t)), t = 0 .. 0.9, legend = "Hazard Rate explicitly");

Thank you!

 

Hello,

I plot a pdf of the average of two iid random variables, and get that it is negative. What am I doing wrong?

Here is an example:

restart;
with(plots);
with(Statistics);
X1 := RandomVariable(BetaDistribution(4, 4));
X2 := RandomVariable(BetaDistribution(4, 4));
plot([PDF(X1, t), PDF(0.5*X1 + 0.5*X2, t)], t = 0 .. 1, color = [red, blue], legend = ["PDF X1", "PDF average"]);

Hello,

I need a bimodal distribution. Since I could not find any among the ones provided by Maple, I created a simple one:

with(Statistics):
U := Distribution(PDF = (proc (t) options operator, arrow; piecewise(t < -5, 0, t < 5, -(1/2000)*t^4+(9/1000)*t^2+7/80, 0) end proc)):
X := RandomVariable(U):

#Plotting PDF and CDF works fine:
plot(PDF(X, t), t = -infinity .. infinity);

plot(CDF(X, t), t = -infinity .. infinity)

However, plotting the quantile function does not work:

plot(Quantile(X, z), z = 0 .. 1);

it has a decreasing part for z<1/2 and a discontinuity at z=1/2.
I can plot it correctly as
plot('Quantile'(X, z), z = 0 .. 1);

but I wonder why the first option does not work for such a simple distribution.

 

 

1 2 3 Page 1 of 3