NewtonRaphsonSystemSolver Class

Represents a root finder based on the Newton-Raphson algorithm.

Definition

Namespace: Extreme.Mathematics.EquationSolvers
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public sealed class NewtonRaphsonSystemSolver : EquationSystemSolver
Inheritance
Object  →  ManagedIterativeAlgorithm<Object, Double, SolutionReport<Object, Double>>  →  ManagedIterativeAlgorithm<Object>  →  ManagedIterativeAlgorithm  →  EquationSystemSolver  →  NewtonRaphsonSystemSolver

Remarks

Use the NewtonRaphsonSystemSolver class to solve a system of nonlinear equations using the Newton-Raphson method in multiple dimensions. This algorithm is suitable for 'easy' target functions. For most general applications, the DoglegSystemSolver class offers a more reliable solution.

The target functions are set in one of two ways. The TargetFunction property is a delegate that represents a multivariate function returning a vector in its second argument. This is a function that returns a vector containing the values each target function. Alternatively, the SetTargetFunctions(Func<Vector<Double>, Double>[]) method can be used to provide the target functions as an array of multivariate function delegates.

Similarly, the gradients of the target functions can be set in two ways. The JacobianFunction property is a delegate that represents a multivariate function returning a matrix in its second argument that calculates the Jacobian of the system of equations. The Jacobian is a matrix whose rows are the gradients of the target functions. Alternatively, the SetGradientFunctions(Func<Vector<Double>, Vector<Double>>[]) method lets you supply the gradients of individual target functions as an array of either multivariate function returning a vector or multivariate function returning a vector in its second argument delegates.

The starting point for the iteration is set through the InitialGuess property. This property must be set to a valid Vector before the algorithm is run. The AbsoluteTolerance and RelativeTolerance properties set the desired precision as specified by the ConvergenceCriterion property. The default value for both tolerances is SqrtEpsilon (roughly 10-8). MaxIterations sets the maximum number of iterations, while MaxEvaluations sets the maximum number of function evaluations.

The Solve() method performs the actual approximation of the solution. This method returns the best approximation that was found. The Status property indicates whether the algorithm was successful.

The algorithm has two convergence tests. By default, the algorithm terminates when either of these is satisfied. You can deactivate either test by setting its Enabled property to false. If both tests are deactivated, then the algorithm always terminates when the maximum number of iterations or function evaluations is reached.

The first test is based on the uncertainty in the location of the approximate solution. The SolutionTest property returns a VectorConvergenceTest<T> object that allows you to specify the desired Tolerance and specific ConvergenceCriterion. See the VectorConvergenceTest<T> class for details on how to further customize this test.

The second test is based on the value of the target functions at the approximate solution. The ValueTest property returns a VectorConvergenceTest<T> object that can be used to customize the test. By default, the error is set to the component with the largest absolute value.

Constructors

Properties

ConvergenceTests Gets the collection of convergence tests for the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
CurrentPoint Gets or sets the current best approximation to the solution.
(Inherited from EquationSystemSolver)
CurrentValue Gets or sets the value of the target functions at the current point.
(Inherited from EquationSystemSolver)
Dimensions Gets or sets the number of dimensions of the optimization problem.
(Inherited from EquationSystemSolver)
EstimatedError Gets a value indicating the size of the absolute error of the result.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
EvaluationsNeeded Gets the number of evaluations needed to execute the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
HasSharedDegreeOfParallelism Indicates whether the degree of parallelism is a property that is shared across instances.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
InitialGuess Gets or sets the initial value for the Newton-Raphson iteration.
(Inherited from EquationSystemSolver)
InitializeJacobian Gets or sets whether the Jacobian should be initialized to an all zero matrix.
(Inherited from EquationSystemSolver)
IterationsNeeded Gets the number of iterations needed by the algorithm to reach the desired accuracy.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
JacobianFunction Gets or sets the Jacobian for the EquationSystemSolver.
(Inherited from EquationSystemSolver)
MaxDegreeOfParallelism Gets or sets the maximum degree of parallelism enabled by this instance.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MaxEvaluations Gets or sets the maximum number of evaluations during the calculation.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MaxIterationsGets or sets the maximum number of iterations to use when approximating the roots of the target function.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
MinIterations Gets or sets the minimum iterations that have to be performed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
ParallelOptions Gets or sets the configuration for the parallel behavior of the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
Result Gets the result of an algorithm after it has executed.
(Inherited from EquationSystemSolver)
RightHandSide Gets or sets the right-hand side of the system of equations.
(Inherited from EquationSystemSolver)
SolutionReport Gets the result of an algorithm after it has executed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
SolutionTest Gets the VectorConvergenceTest<T> that uses the approximate solution.
(Inherited from EquationSystemSolver)
Status Gets the AlgorithmStatus following an execution of the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
TargetFunction Gets or sets the target function for the EquationSystemSolver.
(Inherited from EquationSystemSolver)
ThrowExceptionOnFailure Gets or sets a value indicating whether to throw an exception when the algorithm fails to converge.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>)
ValueTest Gets the VectorConvergenceTest<T> that uses the value of the target functions.
(Inherited from EquationSystemSolver)

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
SetGradientFunctions(Func<Vector<Double>, Vector<Double>>[]) Sets the target functions.
(Inherited from EquationSystemSolver)
SetGradientFunctions(Func<Vector<Double>, Vector<Double>, Vector<Double>>[]) Sets the target functions.
(Inherited from EquationSystemSolver)
SetSymbolicTargetFunctions Defines the left hand sides of the equations to solve as a set of lambda expressions.
(Inherited from EquationSystemSolver)
SetTargetFunctions Sets the target functions.
(Inherited from EquationSystemSolver)
Solve() Attempts to find a root or zero of the target function.
(Inherited from EquationSystemSolver)
Solve(Vector<Double>) Attempts to find the point where the target function equals the specified value.
(Inherited from EquationSystemSolver)
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also