I have a set of data points (x,y) where y=f(x). Samples are equally spaced with respect to x. I am trying to get SciPy to approximate the integral
I had a go using this:
data = np.genfromtxt('data', delimiter=";")
y = data[:,1]
x = data[:,0]
def f(x, y):
return (x**2)*(np.exp(np.negative(1.6886*y)))
integral = integrate.simps(f, x)
The results I'm getting make no sense and there's probably some huuuge point I'm missing but would really appreciate any help.
integrate.simps is intended for evaluate an integral using samples, but no to evaluate by itself the function. I think you should use:
e.g.