This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import warnings | |
from typing import Callable, Iterable | |
import numpy as np | |
from scipy.optimize import root_scalar | |
def multi_root(f: Callable, bracket: Iterable[float], args: Iterable = (), n: int = 30) -> np.ndarray: | |
""" Find all roots of f in `bracket`, given that resolution `n` covers the sign change. | |
Fine-grained root finding is performed with `scipy.optimize.root_scalar`. |