pythonsympy

Numerical method used by sympy nsolve


How does sympy's nsolve do what it does?


Solution

  • As @hpaulj mentioned in the comment, SymPy's nsolve uses mpmath.findroot. This is what happens (roughly speaking) when you execute nsolve(equations, variables, initial_guess) (I'm using SymPy 1.13.3 at the time of writing this answer):

    Note that we can force nsolve to use the multidimensional Newton method also for a single equation by wrapping the arguments in lists, like this: nsolve([single_equation], [variable], [initial_guess]). This trick can be used when the secant method fails to find a solution.