[SciPy-dev] genetic algorithm, number theory, filterdesign,zerofinding

Travis Oliphant oliphant at ee.byu.edu
Thu Apr 11 15:57:34 EDT 2002


>
> Root finders are pretty basic. Looks like the standard call for all of them would be:
>
> solve(f,a,b,args=(),xtol=default,maxiter=default)
>
> with a (python) float return. a,b,xtol should be double, or converted to double. maxiter is integer, and f returns double to the C routine.
>
> There is a disagreement between say, fsolve and bisection, where one has the named argument xtol, and the other tol. How should this be resolved?


We should standardize here, but the problem is the different notions of
tolerance.  xtol is some (relative) error on x while ftol is some error on
f(x)

I'm happy with those.

But, sometimes you have a tolerance that is neither xtol nor ftol, but
some combination.  Use tol in this case.

>
> I could probably just look at the wrapper for fsolve and make a few changes, eh?

If you are writing c-code, you don't have to use the extra args variable
in the C-code (that can be handled by the Python wrapper --- and is in
fact by f2py).

So, you can just have the c-function as

rootfind(void *func, double a, double b, double xtol, int maxiter)

for example.  Then, the f2py wrapper would include an (extra_args)
argument and take a Python function instead of the void *func)

f2py is really cool, you should get to know it.

-Travis





More information about the SciPy-Dev mailing list