Skip to main content
. 2022 May 11;16:806086. doi: 10.3389/fncom.2022.806086

Algorithm 1.

A Python version of Newton's method for a generic function f = F and its derivative fp = F′ to find the point t*such that f(t*) = 0. In our case F and F′depend on the fitted parameters τr, τf, τs, If, and Is.

    def Newton(t_in, f, fp, TOL, MaxIter)
        t = t_in;
        d = 1;
        niter = 1;
        while abs(d)>TOL && niter < =MaxIter:
            d = f(t)/fp(t)
            t -= d
            niter += 1
        return t