//[]. n=5000; function y=f(x), y=cos(%pi*x)*sqrt(4-x^2); endfunction function y=g(x), y=x^2*sqrt(4-x^2); endfunction function y=h(x), y=x^4*sqrt(4-x^2); endfunction F=[]; G=[]; H=[]; for i=1:n, u=4*rand()-2; F=[F,4*f(u)]; G=[G,4*g(u)]; H=[H,4*h(u)]; end SF=sum(F)/n; SG=sum(G)/n; SH=sum(H)/n; IF=integrate('f(x)','x',-2,2); IG=integrate('g(x)','x',-2,2); IH=integrate('h(x)','x',-2,2); valeurs_exactes=[IF,IG,IH] valeurs_approchees=[SF,SG,SH]