python - How can I isolate the result of scipy.integrate.quad function, rather than having the result and the error of the calculation? -


i'm trying create array of integral values used further in calculations. problem integrate.quad returns (answer, error). can't use in other calculations because isn't float; set of 2 numbers.

integrate.quad returns tuple of 2 values (and possibly more data in circumstances). can access answer value referring zeroth element of tuple returned. example:

# import scipy.integrate scipy import integrate  # define function wish integrate f = lambda x: x**2  # integration on f on interval [0, 10] results = integrate.quad(f, 0, 10)  # print out integral result, not error print 'the result of integration %lf' % results[0] 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -