Source code for civpy.math.optimize

"""
Copyright (c) 2019, Matt Pewsey
"""

import scipy.optimize

__all__ = ['fsolve']


[docs]def fsolve(*args, **kwargs): """ Finds the roots of a function. If the function fails to find a solution, an exception is raised. See :func:`scipy.optimize.fsolve` for list of parameters. """ kwargs['full_output'] = True x, infodict, ier, mesg = scipy.optimize.fsolve(*args, **kwargs) if ier != 1: raise ValueError('{}\n{}'.format(mesg, infodict)) return x