def multiplicity(ctx, f, root, tol=None, maxsteps=10, **kwargs):
    if tol is None:
        tol = ctx.eps ** 0.8
    kwargs['d0f'] = f
    for i in xrange(maxsteps):
        dfstr = 'd' + str(i) + 'f'
        if dfstr in kwargs:
            df = kwargs[dfstr]
        else:
            df = lambda x: ctx.diff(f, x, i)
        if not abs(df(root)) < tol:
            break
    return i
Return the multiplicity of a given root of f.
dataset/ETHPy150Open fredrik-johansson/mpmath/mpmath/calculus/optimization.py/multiplicity