Click or drag to resize
NumericalDerivatives Class
Compute the Jacobian matrix for a function f(y) with m components in n independent variables.
Inheritance Hierarchy
SystemObject
  Imsl.MathNumericalDerivatives

Namespace: Imsl.Math
Assembly: ImslCS (in ImslCS.dll) Version: 6.5.2.0
Syntax
[SerializableAttribute]
public class NumericalDerivatives

The NumericalDerivatives type exposes the following members.

Constructors
  NameDescription
Public methodNumericalDerivatives
Constructor for NumericalDerivatives.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodEvaluateF
This method is provided by the user to compute the function values at the current independent variable values y.
Public methodEvaluateJ
Evaluates the Jacobian for a system of (m) equations in (n) variables.
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetPercentageFactor
Returns the percentage factor for differencing.
Public methodGetScalingFactors
Returns the scaling factors for the y values.
Public methodGetStats
Returns status information. This information might prove useful to the user wanting to gain better control over the differencing parameters. This information can often be ignored.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSetDifferencingMethods
Sets the methods used to compute the derivatives.
Public methodSetInitialF
Set the initial function values.
Public methodSetPercentageFactor
Sets the percentage factor for differencing
Public methodSetScalingFactors
Sets the scaling factors for the y values. The user can also use scale to provide appropriate signs for the increments.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Remarks

NumericalDerivatives uses divided finite differences to compute the Jacobian. This class is designed for use in numerical methods for solving nonlinear problems where a Jacobian is evaluated repeatedly at neighboring arguments. For example, this occurs in a Gauss-Newton method for solving non-linear least squares problems or a non-linear optimization method.

NumericalDerivatives is suited for applications where the Jacobian is a dense matrix. All cases m \lt n, m = n, or m \gt n are allowed. Both one-sided and central divided differences can be used.

The design allows for computation of derivatives in a variety of contexts. Note that a gradient should be considered as the special case with m = 1, n \ge 1. A derivative of a single function of one variable is the case m = 1, n = 1. Any non-linear solving routine that optionally requests a Jacobian or gradient can use NumericalDerivatives. This should be considered if there are special properties or scaling issues associated with f(y). Use the method SetDifferencingMethods to specify different differencing options for numerical differentiation. These can be combined with some analytic subexpressions or other known relationships.

The divided differences are computed using values of the independent variables at the initial point y_e = y, and differenced points y_e = y + del \times e_j. Here the e_j, j = 1, ..., n, are the unit coordinate vectors. The value for each difference del depends on the variable j, the differencing method, and the scaling for that variable. This difference is computed internally. See SetPercentageFactor for computational details. The evaluation of f(y_e) is normally done by the user-provided method NumericalDerivatives.IFunction.F, using the values y_e. The index j and values y_e are arguments to NumericalDerivatives.IFunction.F.

The computational kernel of EvaluateJ performs the following steps: evaluate the equations at the point y using NumericalDerivatives.IFunction.F.compute the Jacobian.compute the difference at y_e.

By default, EvaluateJ uses NumericalDerivatives.IFunction.F in step 3. The user may choose to override the EvaluateF method to extend the capability of the class beyond the default.

There are six examples provided which illustrate various ways to use NumericalDerivatives. A discussion of the expected errors for these difference methods is found in A First Course in Numerical Analysis, Anthony Ralston, McGraw-Hill, NY, (1965).

See Also