> 2. This one works fine with some parameter set but makes error with other > parameter sets ( gsl: newton.c:88: ERROR: function value is not finite) and > make an exit. > > 3. I'd like to set the value of "x (root)" as 0 when it make error with > certain parameters and proceed to next iteration without make an exit. > > How can I solve this problem.
You'll need to register a custom error handler. See the Error handling section of the manual [1] and in particular the section on custom error handlers [2]. You'll probably want to create an error handler that records the error code in a static location and then returns. Then call gsl_root_fdfsolver_newton as you do now. When an infinite value is encountered GSL will invoke your error handler. Your error handler will record the infinite value and return. Then gsl_root_fdfsolver_newton will return. Now your code can check if the infinite condition was encountered and replace the "root" returned by gsl_root_fdfsolver_newton with 0. [1] http://www.gnu.org/software/gsl/manual/html_node/Error-Handling.html [2] http://www.gnu.org/software/gsl/manual/html_node/Error-Handlers.html Hope that helps, Rhys
