essos.util

Functions

newton(f, x0)

Newton's method for root-finding.

roots(x, y[, shift])

Outputs all unique roots of an interpolated function y(x) = y, where y is a scalar

roots_scipy(x, y[, shift])

Finds roots using scipy.interpolate

Module Contents

essos.util.newton(f, x0)

Newton’s method for root-finding.

essos.util.roots(x, y, shift=0)

Outputs all unique roots of an interpolated function y(x) = y, where y is a scalar and x is a vector. Removes repeated trailing values.

Parameters:
  • x (array-like) – A vector of x values.

  • y (array-like) – A vector of y values corresponding to x.

  • shift (float, optional) – A value to shift the y values by. Defaults to 0.

Returns:

An array of unique roots where the interpolated function crosses the shifted y value.

Return type:

jnp.ndarray

essos.util.roots_scipy(x, y, shift=0)

Finds roots using scipy.interpolate

Parameters:
  • x (array-like) – 1D array of independent values, must be strictly increasing (e.g., Time).

  • y (array-like) – 1D array of dependent values (e.g., X, Y, Z, B, or V).

  • shift (float, optional) – Value to shift y to find roots at a non-zero value. Default is 0.

Returns:

Array of root values.

Return type:

array-like