Professional Documents
Culture Documents
MAPLE Practice Problems
MAPLE Practice Problems
Question 1
i.
We proceed by simply defining the functions and ploting them:
ii.
We repeat what we did last time:
x=-3:.05:3;
pd=makedist("Normal","mu",0,"sigma",1);
y = pdf(pd,x);
plot(x,y,'LineWidth',2);
axis([-3,3,0,0.5]);
xlabel("Population");
ylabel("Probability distribution");
iii.
We define the cumulative distribution function and plot it.
x=-2:0.05:2.5;
y=cdf("Normal",x,0.25,1);
plot(x,y,'LineWidth',2);
axis([-2,2.5,0,1]);
xlabel("Population");
ylabel("Cumulative Probability distribution");
v
We proceed as we do always:
x=-3:0.05:3;
pd=makedist("Normal");
y=cdf(pd,x);
plot(x,y,'LineWidth',2);
axis([-3,3,0,1]);
xlabel("Population");
ylabel("Cumulative Probability distribution");
vi
We define both cdfs and compare their results:
The cumulative distribution from F(x) is 0.7939 while standardized distribution gives 0.7939
Our value of standardized z lies at 0.82 giving 79.39%. From Table A-8 we receive z=0.806 for
F(z)=79% while z=0.842 for F(z)=80%. We perform interpolation to receive a value of 0.82004 for
79.39% which is close enough. On the Casio fx-991ES PLUS we integrate the Normal PDF from -
1000 to 0.82 and we get 0.7939.
vii.
fprintf("The cumulative distribution at 0.01 is %.4f, at 0.5 is %.4f," + ...
"at 2 is %.4f and at 3 is
%.4f",cdf(pd,0.01),cdf(pd,0.5),cdf(pd,2),cdf(pd,3));
The tables correspond exactly to the ones received from Table A-7 and from our calculator.
viii.
We evaluate the left hand side and right hand side separately and print them in juxtaposition:
fprintf("The left hand side of the equation is %.4f while the right hand" + ...
"side is %.4f",cdf(pd,2.12),1-cdf(pd,-2.12));
The left hand side of the equation is 0.9830 while the right handside is 0.9830
ix:
We use the inverse cumulative distribution function for verification:
x.
If 𝐷(𝑧)=Φ(𝑧)−Φ(−𝑧)=0.95 then Φ(𝑧)=0.975, we can verify by using icdf:
Question 2:
i.
As in the first question we define multiple distributions and plot them simultaneously:
ii.
We plot again:
%defining a bigger interval
x=-7:.05:7;
%defining cumulative distribution functions with loop
for i=1:6
eval("y"+i+"=tcdf(x,"+ms(i)+");");
end
plot(x,y1,'LineWidth',2,'LineStyle','--');
xlabel("Population");
ylabel("Cumulative Probability distribution");
hold on
axis([-7,7,0,1]);
linestyles=["':'","'-'","'--'","'-.'","':'"];
for i=2:6
eval("plot(x,"+"y"+i+","+"'LineWidth',2,'LineStyle',"+linestyles(i-
1)+");");
hold on
end
eval(sprintf("legend(%s)",strrt));
legend('boxoff')
hold off
iii.
We use the tcdf function we used previously:
iv.
We use the tinv function for this purpose:
The value of z for t-distribution with 2 degrees of freedom which returns 0.99 is 6.96
Question 3:
i.
As in the first question we define multiple distributions and plot them simultaneously:
iv.
We use the tinv function for this purpose:
The value of z for X2-distribution with 2 degrees of freedom which returns 0.99 is 9.21
Question 4:
We define the functions for the last time:
eval("plot(x,"+"X"+i+","+"'LineWidth',2,'LineStyle',"+linestyles(i+1)+");");
hold on
eval("plot(x,"+"t"+i+","+"'LineWidth',2,'LineStyle',"+linestyles(i+1)+");");
hold on
strr=strr+",'$\chi^2$,m="+ms(i)+"','t,m="+ms(i)+"'";
end
eval(sprintf("legend(%s,'Interpreter','latex')",strr));
legend('boxoff')