[SciPy-user] root finding

Travis Oliphant oliphant at ee.byu.edu
Tue Aug 9 10:32:37 CDT 2005

Howey, David A wrote:

>I am pondering the best way to do some root finding. I have a function which I give a mass flow value to and it returns a pressure. I need to iterate the mass flow value until a specific pressure is reached. As long as sensible initial guess are chosen, the function produces a pretty smooth curve with a unique root.
>Initially I had a rough and ready algorithm which shoved a range of mass flows (in an array) through the function and looked for a zero crossing, and then fine tuned the result a few times. This works, but I'm wondering whether something like Newton-Raphson would be better, although I don't directly know the derivative, so I would be using a numerical approximation (I think this is called the secant method). Does scipy 
>have an implementation of this? Any tips for use?

Chuck Harris contributed some fantastic 1-dimensional root finding 
algorithms based on the secant method (as you correctly identified).

I recommend trying out


and friends.

See the docstring for scipy.optimize under the  "scalar function 
solvers"  heading



More information about the SciPy-user mailing list