Hello James,
I had this problem as well, and modified the GSL iterate function
for this purpose. My code is in c++, but the structure is very similar
to the original GSL and so may be helpful for you. See line 713 of
http://sourceforge.net/p/o2scl/code/497/tree/trunk/src/root/gsl_mroot_hybrids.h
shrink_step==false is the usual GSL behavior, but when it's true
it automatically halves the step (up to 20 times) in order to avoid
venturing into regions where the function is undefined.
Take care,
Andrew
(http://o2scl.sourceforge.net)
On Sun, Sep 23, 2012 at 8:38 PM, James Strother <[email protected]> wrote:
> Hello,
>
> I am trying to use the multiroot solver for a small scientific
> program, but I having a little trouble. The function I would like to
> solve is only well-defined for positive inputs, but the solver is
> taking sufficiently large steps that it is producing negative inputs.
> It seems like I should be able to return an error code to indicate to
> the solver that the step was too large, and that it should cut the
> step length and re-try. I couldn't find something like this
> documented, did I just miss it or is there another way to go about
> this?
>
> Thanks,
> James
>