# ulab.approx¶

Numerical approximation methods

ulab.approx.bisect(fun, a, b, *, xtol=2.4e-07, maxiter=100) → float
Parameters: f (callable) – The function to bisect a (float) – The left side of the interval b (float) – The right side of the interval xtol (float) – The tolerance value maxiter (float) – The maximum number of iterations to perform

Find a solution (zero) of the function f(x) on the interval (a..b) using the bisection method. The result is accurate to within xtol unless more than maxiter steps are required.

ulab.approx.newton(fun, x0, *, xtol=2.4e-07, rtol=0.0, maxiter=50) → float
Parameters: f (callable) – The function to bisect x0 (float) – The initial x value xtol (float) – The absolute tolerance value rtol (float) – The relative tolerance value maxiter (float) – The maximum number of iterations to perform

Find a solution (zero) of the function f(x) using Newton’s Method. The result is accurate to within xtol * rtol * |f(x)| unless more than maxiter steps are requried.

ulab.approx.fmin(fun, x0, *, xatol=2.4e-07, fatol=2.4e-07, maxiter=200) → float
Parameters: f (callable) – The function to bisect x0 (float) – The initial x value xatol (float) – The absolute tolerance value fatol (float) – The relative tolerance value

Find a minimum of the function f(x) using the downhill simplex method. The located x is within fxtol of the actual minimum, and f(x) is within fatol of the actual minimum unless more than maxiter steps are requried.

ulab.approx.interp(x: ulab.array, xp: ulab.array, fp: ulab.array, *, left=None, right=None) → ulab.array
Parameters: x (ulab.array) – The x-coordinates at which to evaluate the interpolated values. xp (ulab.array) – The x-coordinates of the data points, must be increasing fp (ulab.array) – The y-coordinates of the data points, same length as xp left – Value to return for x < xp, default is fp. right – Value to return for x > xp[-1], default is fp[-1].

Returns the one-dimensional piecewise linear interpolant to a function with given discrete data points (xp, fp), evaluated at x.