Newton Raphson System Solver Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
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
Newton | Constructs a new NewtonRaphsonSystemSolver object. |
Newton | Constructs a new NewtonRaphsonSystemSolver object. |
Newton | Constructs a new NewtonRaphsonSystemSolver object. |
Newton | Constructs a new NewtonRaphsonSystemSolver object. |
Newton | Constructs a new NewtonRaphsonSystemSolver object. |
Properties
Convergence |
Gets the collection of convergence tests for the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Current |
Gets or sets the current best approximation to the solution.
(Inherited from EquationSystemSolver) |
Current |
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) |
Estimated |
Gets a value indicating the size of the absolute
error of the result.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Evaluations |
Gets the number of evaluations needed to execute the algorithm.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Has |
Indicates whether the degree of parallelism is a property that is shared
across instances.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Initial |
Gets or sets the initial value for the Newton-Raphson
iteration.
(Inherited from EquationSystemSolver) |
Initialize |
Gets or sets whether the Jacobian should be initialized to an all zero matrix.
(Inherited from EquationSystemSolver) |
Iterations |
Gets the number of iterations needed by the
algorithm to reach the desired accuracy.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Jacobian |
Gets or sets the Jacobian for the EquationSystemSolver.
(Inherited from EquationSystemSolver) |
Max |
Gets or sets the maximum degree of parallelism enabled by this instance.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Max |
Gets or sets the maximum number of evaluations during the calculation.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Max | Gets or sets the maximum number of iterations
to use when approximating the roots of the target
function.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Min |
Gets or sets the minimum iterations that have to be performed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Parallel |
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) |
Right |
Gets or sets the right-hand side of the system of equations.
(Inherited from EquationSystemSolver) |
Solution |
Gets the result of an algorithm after it has executed.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Solution |
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>) |
Target |
Gets or sets the target function for the EquationSystemSolver.
(Inherited from EquationSystemSolver) |
Throw |
Gets or sets whether to throw an
exception when the algorithm fails to converge.
(Inherited from ManagedIterativeAlgorithm<T, TError, TReport>) |
Value |
Gets the VectorConvergenceTest<T> that uses the value of the target functions.
(Inherited from EquationSystemSolver) |
Methods
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get | Serves as the default hash function. (Inherited from Object) |
Get | Gets the Type of the current instance. (Inherited from Object) |
Set |
Sets the target functions.
(Inherited from EquationSystemSolver) |
Set |
Sets the target functions.
(Inherited from EquationSystemSolver) |
Set |
Defines the left hand sides of the equations to solve as a set of lambda expressions.
(Inherited from EquationSystemSolver) |
Set |
Sets the target functions.
(Inherited from EquationSystemSolver) |
Solve() |
Attempts to find a root or zero of the target function.
(Inherited from EquationSystemSolver) |
Solve( |
Attempts to find the point where the target function equals the specified value.
(Inherited from EquationSystemSolver) |
ToString | Returns a string that represents the current object. (Inherited from Object) |