bugGNU Scientific Library - Bugs: bug #45782, Feature request: Make derivative...


You are not allowed to post comments on this tracker with your current authentication level.

bug #45782: Feature request: Make derivative epsilon configurable

Submitter:  Alexander Voigt <avoigt>
Submitted:  Mon 17 Aug 2015 05:38:43 PM UTC
Category:  Accuracy problem Severity:  3 - Normal
Operating System:  all Status:  None
Assigned to:  None Open/Closed:  Open
Release:  all

Tue 08 Dec 2015 07:55:28 PM UTC, comment #3: 

Dear Bill,

many thanks for working on this feature!

From a user perspective, I think both approaches would be fine, because both are easy to use.

However, from the software design point of view, I agree with your opinion that the first option would be cleaner.  It would also allow to add further options later.  For a user it would be important to well document the new "gsl_multiroot_fsolver_params_set()" function (and maybe add a user example).


Alexander Voigt <avoigt>
Sun 29 Nov 2015 03:49:53 PM UTC, comment #2: 

I've implemented this feature and attached code here. I did this by adding a new function call as I stated in my previous post. The archive includes tests as well as a stab at changes to the Texinfo documentation.

(file #35591)

Bill Maier <ciric50>
Mon 23 Nov 2015 08:10:31 PM UTC, comment #1: 

The actual implementation of this feature is rather straightforward. The
function that numerically computes the Jacobian already has a parameter for
epsilon, so it's just a question of getting that information from the user to
the function call.

The main question I have is how to give the user a way to specify this
epsilon while maintaining backward compatibility. Right now the interface
for multiroot solvers is well-defined: alloc, set, iterate, and free. The
most obvious place to introduce an additional parameter would be in the
"set" call, gsl_multiroot_fsolver_set(), but currently there's no facility
there for another parameter. We could add another argument to the call which
would contain the epsilon value. Just tacking it on would lose backward
compatibility, but we could create an additional "set" call, something like
gsl_multiroot_fsolver_params_set(). This call would have an additional
argument, something like "fsolver_params" which would be a structure with
additional parameters for the solver including the epsilon value. We would
then have two "set" calls for fsolvers. Using a new structure allows for
future parameters to be added if needed.

Another option which leaves the current user interface intact would be
to add the epsilon parameter to the gsl_multiroot_fsolver structure. In the
function gsl_multiroot_fsolver_alloc() function the epsilon value would be
set to the current default of GSL_SQRT_DBL_EPSILON to maintain backward
compatibility. If the user wanted it to be something different, he would set
the epsilon value manually with a line of code like
    "solver->epsilon = 1.0e-4;"
at a point after the solver allocation but before the call to
gsl_multiroot_fsolver_set(). This option has the advantage of maintaining the
current user interface, but establishing a manual bypass to it doesn't seem
like a good design choice.

I am interested in hearing from other GSL developers and users which option
they think is the most appropriate for this library. Personally I think the
first option, adding a new "set" call with an additional argument, is the
cleanest way to go, though it does expand the user interface.

-Bill Maier

Bill Maier <ciric50>
Mon 17 Aug 2015 05:38:43 PM UTC, original submission:  

Dear GSL hackers,

for my research project I'm using the GSL multiroot solvers (w/o derivative).  However, I stumbled upon a numerical problem:

The function that I'm passing to the multiroot solvers cannot be evaluated very precisely.  I.e. there is a numerical imprecision in the function evaluation of the order 1e-5.

When I pass this function to the multiroot solvers (w/o providing a function for the derivative), one of the first things the solver does is to calculate the Jacobian.  For the calculation of the Jacobian matrix different derivatives of the function have to be calculated numerically.  For the calculation of these derivatives a hard-coded epsilon of GSL_SQRT_DBL_EPSILON = 1.4901161193847656e-08 is used.  This value is too small for my application, because it is smaller than the numerical imprecision of the function evaluation.  In my case 1e-4 would be optimal.

For this reason I'd like to request the following feature:  Please make the epsilon, which is used in the calculation of the Jacobian, configurable.

Best regards,
Alexander Voigt

Alexander Voigt <avoigt>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #35591:  bug45782.tar.gz added by ciric50 (18KiB - application/gzip)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by ciric50 (Posted a comment)
  • -email is unavailable- added by avoigt (Submitted the item)

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-11-29 ciric50 Attached File- Added bug45782.tar.gz, #35591

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code