function y=f1(x)
  y=sqrt(1-x .* x)
endfunction

function I=intrectanglegauche(f,a,b,n)
h=(b-a)/n
xi = a + (0:n-1)*h
s = f(xi)*h

I = sum(s)
endfunction


function I=inttrapeze(f,a,b,n)
  h = (b-a)/n
  xi  = a + (0:n-1)*h
  xi1 = a + (1:n)*h
  s = (f(xi)+f(xi1))*(h/2)
  
  I = sum(s)
endfunction
  
function I = intsimpson(f,a,b,n)
  h = (b-a)/n
  xi = a + (0:n-1)*h
  xi12 = xi + 0.5*h
  xi1 = xi + h
  
  s = (f(xi)/6+(2/3)*f(xi12)+f(xi1)/6)*h
  
  I = sum(s)
  endfunction

2*intrectanglegauche(f1,-1,1,10000)

2*inttrapeze(f1,-1,1,10000)

2*intsimpson(f1,-1,1,10000)

