% LMex040303_4th.m
% Example 4.3.3 Pp 304 in
% Larsen & Marx (2006) Introduction to Mathematical Statistics, 4th edition
% An application of the symbolic math integration functions
% Typo in book:
% f_y(y)=y* 3*(1-y)^2 not fy(y)=3*(1-y)^2
syms y
% f_y(y)=y* 3*(1-y)^2, 0<=y,=1; Let mean y = (1/15)*Sum from 1 to 15 Yi.
int(y*3*(1-y)^2,0,1)
muy=eval(int(y*3*(1-y)^2,0,1));
% by definition of variance
int(y^2*3*(1-y)^2,0,1)-1/4^2
vary=eval(int(y^2*3*(1-y)^2,0,1)-1/4^2);
P=normcdf((3/8-muy) / (sqrt(vary)/sqrt(15)))-...
  normcdf((1/8-muy) / (sqrt(vary)/sqrt(15)))
