lib5c.util.optimization.array_newton() is redundant with latest scipy versions

Issue #53 on hold
Thomas Gilgenast created an issue

we could drop the function from lib5c and bump the scipy dependency

Comments (9)

  1. Thomas Gilgenast reporter

    an important question for clients (who might need to update client code) is whether or not the signatures of lib5c.util.optimization.array_newton() and scipy.optimize.newton() are the same

    lib5c has:

    def array_newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50,
                     fprime2=None, failure_idx_flag=None):
    

    and returns root if failure_idx_flag is False or (root, failures, zero_der) if it is True

    while scipy has:

    def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50,
               fprime2=None, x1=None, rtol=0.0,
               full_output=False, disp=True):
    

    and returns root if full_output is False or (root, converged, zero_der) if it is True

    based on this it sounds like an “upgrade guide“ is to

    1. replace from lib5c.util.optimization import array_newton with from scipy.optimize import newton
    2. rename the function calls from array_newton() to newton()
    3. rename the kwarg from failure_idx_flag to full_output
    4. if full output was expected, capture it as (root, converged, zero_der) and then write failures = ~converged

  2. Thomas Gilgenast reporter

    the converse of this issue is to say that array_newton() provides a backport that allows us to support older scipy versions

  3. Log in to comment