I know how to integrate a function with Scipy. I do it in this way:
from scipy import *
from scipy import integrate
integral = integrate.simps(y,x)
In this way I integrate with the Simpsons' rule the function y(x), but what if I want to integrate this function in cylindrical coordinates? I mean, instead of the integral \int y(x)dx I want to solve the integral \int y(x)*2*pi*x*dx.
I tried with
integral = integrate.simps(y,x**2.*pi)
But it doesn't seem to return the correct result.
I am integrating data points, not functions!
You should try
integral = integrate.simps(y*x*2*pi,x)
where y
should be an array of function values at the positions x
. Note that 2*pi*x
is the necessary factor to add to your integrand (as you pointed out yourself).