function script10
%  USING CRUDE MONTE CARLO
U=rand(1,100000);
F=U.^2.*exp(-((1./U)-1).^2);
mean(F)
var(F)/length(F)
% USING ANTITHETIC VARIATES
U=rand(1,50000);
F=.5*(U.^2.*exp(-((1./U)-1).^2)+(1-U).^2.*exp(-((1./(1-U))-1).^2));
mean(F)
var(F)/length(F)
%**********************
%GENERATE FROM P.D.F. f(x)=3x^2
U=rand(1,100000);
X=U.^(1/3);
F=(1/3)*exp(-(1./X-1).^2);
mean(F)
var(F)/length(F)


