verry.optimize.allroot#

verry.optimize.allroot(fun, domain, fprime=None, unique=False, max_iter=16)#

Find all roots of multivariate scalar-valued function.

Parameters:
  • fun (Callable) – Function to find a root of.

  • domain (IntervalMatrix) – Interval vector for which roots are searched.

  • fprime (Callable, optional) – Derivative of fun (the default is jacobian(fun)).

  • unique (bool, default=False) – If unique is True, verification continues until the number of iterations reaches max_iter or the uniqueness of the root is verified, even if its existence has been established.

  • max_iter (int, default=16) – Maximum number of iterations.

Return type:

AllRootResult

Warning

fun must be a \(C^1\)-function on domain. Futhermore, fun must neither be a constant nor contain conditional branches (cf. Common pitfalls).

Examples

>>> from verry.linalg import FloatIntervalMatrix as FIM
>>> fun = lambda x, y: (x**2 - y - 3, -x + y**2 - 3)
>>> r = allroot(fun, FIM(inf=[-3, -3], sup=[3, 3]), unique=True)
>>> len(r.unique)
4
>>> root_min = min(r.unique, key=lambda x: x[0].inf)
>>> -2 in root_min[0] and 1 in root_min[1]
True