### 38.4 Finite Difference Jacobian

For the algorithms which require a Jacobian matrix of derivatives of the fit functions, there are times when an analytic Jacobian may be unavailable or too expensive to compute. Therefore GSL supports approximating the Jacobian numerically using finite differences of the fit functions. This is typically done by setting the relevant function pointers of the gsl_multifit_function_fdf data type to NULL, however the following functions allow the user to access the approximate Jacobian directly if needed.

Function: int gsl_multifit_fdfsolver_dif_df (const gsl_vector * x, gsl_multifit_function_fdf * fdf, const gsl_vector * f, gsl_matrix * J)

This function takes as input the current position x with the function values computed at the current position f, along with fdf which specifies the fit function and parameters and approximates the n-by-p Jacobian J using forward finite differences: J_ij = d f_i(x,params) / d x_j = (f_i(x^*,params) - f_i(x,params)) / d x_j. where x^* has the jth element perturbed by \Delta x_j and \Delta x_j = \epsilon |x_j|, where \epsilon is the square root of the machine precision GSL_DBL_EPSILON.

Function: int gsl_multifit_fdfsolver_dif_fdf (const gsl_vector * x, gsl_multifit_function_fdf * fdf, gsl_vector * f, gsl_matrix * J)

This function computes the vector of function values f and the approximate Jacobian J at the position vector x using the system described in fdf. See gsl_multifit_fdfsolver_dif_df for a description of how the Jacobian is computed.