【python日用】scipy.optimize.root用法及代码示例

定义

def root(fun, x0, args=(), method='hybr', jac=None, tol=None, callback=None,
         options=None):
    """
    Find a root of a vector function. 查找向量函数的根

    Parameters
    ----------
    fun : callable
        A vector function to find a root of. 查找根的向量函数
    x0 : ndarray
        Initial guess. 初步猜测。 
    args : tuple, optional
        Extra arguments passed to the objective function and its Jacobian. 额外的参数传递给目标函数及其Jacobian函数。
    method : str, optional
        Type of solver.  Should be one of

            - 'hybr'             :ref:`(see here) `
            - 'lm'               :ref:`(see here) `
            - 'broyden1'         :ref:`(see here) `
            - 'broyden2'         :ref:`(see here) `
            - 'anderson'         :ref:`(see here) `
            - 'linearmixing'     :ref:`(see here) `
            - 'diagbroyden'      :ref:`(see here) `
            - 'excitingmixing'   :ref:`(see here) `
            - 'krylov'           :ref:`(see here) `
            - 'df-sane'          :ref:`(see here) `

    jac : bool or callable, optional
        If `jac` is a Boolean and is True, `fun` is assumed to return the
        value of Jacobian along with the objective function. If False, the
        Jacobian will be estimated numerically.
        `jac` can also be a callable returning the Jacobian of `fun`. In
        this case, it must accept the same arguments as `fun`.
        bool 或 callable, 可选参数
		如果jac是布尔值且为True,则假定fun与目标函数一起返回Jacobian的值。如果为False,则		将根据数值估算雅可比行列式。杰克(jac)也可以成为回味乐趣的雅可比式的可呼唤。在这种情况		下,它必须接受与fun相同的参数。
    tol : float, optional
        Tolerance for termination. For detailed control, use solver-specific
        options.
        终止公差。要进行详细控制,请使用solver-specific选项。
    callback : function, optional
        Optional callback function. It is called on every iteration as
        ``callback(x, f)`` where `x` is the current solution and `f`
        the corresponding residual. For all methods but 'hybr' and 'lm'.
        可选的回调函数。在每次迭代中都被称为callback(x, f)其中x是当前解,f是相应的残差。对于除‘hybr’和‘lm’之外的所有方法。
    options : dict, optional
        A dictionary of solver options. E.g. `xtol` or &#

你可能感兴趣的:(python日用,python)