 % Quelques graphiques pour faire joli 
 clear; clf;  hold on;  a=100; b=1000; step=20;
 for k=1:step
  n=a+b*k;  
  D(k)=n;  
  X1(k)=mean(4*(ones(1,n)-rand(1,n).^2).^(1/2));
  X2=2*rand(1,n)-1;
  Y2=2*rand(1,n)-1;
  Z2(k)=mean(4*(X2.^2+Y2.^2<=1));
  X3=2*rand(1,n)-1;
  Y3=2*rand(1,n)-1;
  Z3=2*rand(1,n)-1;
  T3(k)=mean(3*2*(X3.^2+Y3.^2+Z3.^2<=1));
 end
 PI=pi*ones(1,k);
 plot(D,PI,'k-')
 plot(D,X1,'r-+')
 plot(D,Z2,'g-.')
 plot(D,T3,'b-*')
 title('Convergence de la methode de MC vers Pi')
 legend('Valeur de Pi','Methode 1','Methode 2','Methode 3')
