April 2019
Intermediate to advanced
426 pages
11h 13m
English
The scipy.optimize module also contains multidimensional general solvers that we can use to our advantage. The root and fsolve functions are some examples with the following function properties:
The outputs are returned as dictionary objects. Using our example as input to these functions, we will get the following output:
In [ ]: import scipy.optimize as optimize y = lambda x: x**3 + 2.*x**2 - 5. dy = lambda x: 3.*x**2 + 4.*x print(optimize.fsolve(y, 5., fprime=dy))Out[ ]: [1.24189656]In [ ]: print(optimize.root(y, 5.))Out[ ]: fjac: array([[-1.]]) fun: ...