INNER CODE UNIT · Python

guess

sdv-dev/Copulas · copulas/optimize/__init__.py:30

        guess = (xmin + xmax) / 2.0
        fguess = f(guess)
        xmin[fguess <= 0] = guess[fguess <= 0]
        xmax[fguess >= 0] = guess[fguess >= 0]
        if (xmax - xmin).max() < tol:
            break

    return (xmin + xmax) / 2.0


def chandrupatla(f, xmin, xmax, eps_m=None, eps_a=None, maxiter=50):
    """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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…