You are on page 1of 2

Python tools

scipy.integrate.quad
Compute a definite integral. Integrate function from a to b Eg: def f(x): return x**3 Input scipy.integrate.quad(f,0,3) Output: (20.249999999999996, 2.2482016248659415e-13) Where 20.249999999999996 is value of integral and 2.2482016248659415e-13 is error.

scipy.optimize.brentq
Find a root of a function in given interval. Return float, a zero of f between a and b. f must be a continuous function, and [a,b] must be a sign changing interval. f : function Python function returning a number. f must be continuous, and f(a) and f(b) must have opposite signs. a : number One end of the bracketing interval [a,b]. b : number The other end of the bracketing interval [a,b]. ## Basically this search for the coordinate where function value becomes zero.
Eg: def f(x): return x**3 Input

scipy.optimize.brentq(f, -3.0,3.0) Output : 0.0 i.e. value of f(x) becomes zero at x = 0.0 in interval x=-3 to x=3

scipy.interpolate.UnivariateSpline
One-dimensional smoothing spline fit to a given set of data points.

x : array_like 1-D array of independent input data. Must be increasing. y : array_like 1-D array of dependent input data, of the same length as x. k : int, optional Degree of the smoothing spline. Must be <= 5 S : float or None, optional Smoothness factor of spline.

scipy.optimize.leastsq
Minimize the sum of squares of a set of equations.

scipy.optimize.leastsq(func, x0, args=())

You might also like