from pylab import *
from numpy import *
def integral(f,a,b,N):  # toto je definicia funkcie pocitajucej integral z inej funkcie f
						#od a po b rozsekanim na N obdlznickov
	delta=(b-a)/N
	s=0.
	for i in range(N):
		x=a+i*delta;
		s=s+f(x)*delta
	return (s)
def fun(x):   # toto je definicia funkcie, z ktorej sa bude pocitat integral
	return x*x
print(integral(fun,1.,2.,10000))
