[SciPy-User] Brentq

John Hassler hasslerjc@comcast....
Thu Jul 26 22:11:13 CDT 2012


On 7/26/2012 11:02 PM, Joon Ro wrote:
> On Thu 26 Jul 2012 10:00:33 PM CDT, John Hassler wrote:
>> On 7/26/2012 10:33 PM, The Helmbolds wrote:
>>> The user guide says the algorithm for brentq should be obvious from
>>> inspecting the code.
>>> Unfortunately, I can't find the code.
>>> The entire code in the definition of the brentq function (located in
>>> the zeros section of scipy.optimize) reads:
>>>      if type(args) != type(()) :
>>>      args = (args,)
>>> r = _zeros._brentq(f,a,b,xtol,maxiter,args,full_output,disp)
>>>
>>> So it just calls _zeros._brentq.
>>> The module in which the brentq function is defined imports _zeros.
>>> I searched but the only _zeros file I could find in scipy.optimize is
>>> a _zeros.pyd file,
>>> and that's a DLL file, not a Python code object.
>>> So I'm at a loss as to where the brentq code is located.
> It seems the c source code is here:
>
> https://github.com/scipy/scipy/blob/master/scipy/optimize/Zeros/brentq.c
>
> -Joon
> _______________________________________________
>
Wikipedia has a nice exposition - also with a c-code example:
http://en.wikipedia.org/wiki/Brent%27s_method
john




More information about the SciPy-User mailing list