How to calculate definite integral with python
J. Robertson
jr244 at kent.ac.uk
Tue May 15 04:43:42 EDT 2007
fdu.xiaojf at gmail.com wrote:
> I'm trying to do some integral calculation. I have searched the web, but
> haven't found any useful information. Will somebody point me to the
> right resources on the web for this job ?
>
> Thanks a lot.
>
> ps. Can numpy be used for this job?*
> *
It can be done with scipy (see
http://www.scipy.org/doc/api_docs/scipy.integrate.html )
for example:
>>> import scipy.integrate
>>> func = lambda x: x**2
>>> scipy.integrate.quadrature(func, 0.0, 1.0)
Took 4 points.
(0.333333333333, 0.0)
More information about the Python-list
mailing list