function monte1
% monte1 1-dim monte carlo (MCS507 Handout MCA1)
clc; clear
Exact= pi/4
fprintf('K          N     Mean        Sigma   Sig/sqrtN     Error\n')
for k=1:6
   randn('state',0);
   N(k)=10^k;
   x=rand(N(k),1);
   f=sqrt(1-x.*x);
   meanv(k)=mean(f);
   sig(k)=std(f);
   sigdrn(k)=sig(k)/sqrt(N(k));
   error(k) = (meanv(k)/Exact-1);
   fprintf('%1i  %9i  %7.4f  %10.4e %10.4e %10.4e\n',k,N(k),meanv(k),sig(k),sigdrn(k),error(k))
end
