copulas.optimize package

Module contents

copulas.optimize.bisect(f, xmin, xmax, tol=1e-08, maxiter=50)[source]

Bisection method for finding roots.

This method implements a simple vectorized routine for identifying the root (of a monotonically increasing function) given a bracketing interval.

Parameters
  • f (Callable) – A function which takes as input a vector x and returns a vector with the same number of dimensions.

  • xmin (np.ndarray) – The minimum value for x such that f(x) <= 0.

  • xmax (np.ndarray) – The maximum value for x such that f(x) >= 0.

Returns

The value of x such that f(x) is close to 0.

Return type

numpy.ndarray

copulas.optimize.chandrupatla(f, xmin, xmax, eps_m=None, eps_a=None, maxiter=50)[source]

Chandrupatla’s algorithm.

This is adapted from [1] which implements Chandrupatla’s algorithm [2] which starts from a bracketing interval and, conditionally, swaps between bisection and inverse quadratic interpolation.

[1] https://github.com/scipy/scipy/issues/7242#issuecomment-290548427 [2] https://books.google.com/books?id=cC-8BAAAQBAJ&pg=PA95

Parameters
  • f (Callable) – A function which takes as input a vector x and returns a vector with the same number of dimensions.

  • xmin (np.ndarray) – The minimum value for x such that f(x) <= 0.

  • xmax (np.ndarray) – The maximum value for x such that f(x) >= 0.

Returns

The value of x such that f(x) is close to 0.

Return type

numpy.ndarray