Extreme Optimization™: Complexity made simple.

Math and Statistics
Libraries for .NET

  • Home
  • Features
    • Math Library
    • Vector and Matrix Library
    • Statistics Library
    • Performance
    • Usability
  • Documentation
    • Introduction
    • Math Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Reference
  • Resources
    • Downloads
    • QuickStart Samples
    • Sample Applications
    • Frequently Asked Questions
    • Technical Support
  • Blog
  • Order
  • Company
    • About us
    • Testimonials
    • Customers
    • Press Releases
    • Careers
    • Partners
    • Contact us
Introduction
Deployment Guide
Nuget packages
Configuration
Using Parallelism
Expand Mathematics Library User's GuideMathematics Library User's Guide
Expand Vector and Matrix Library User's GuideVector and Matrix Library User's Guide
Expand Data Analysis Library User's GuideData Analysis Library User's Guide
Expand Statistics Library User's GuideStatistics Library User's Guide
Expand Data Access Library User's GuideData Access Library User's Guide
Expand ReferenceReference
  • Extreme Optimization
    • Features
    • Solutions
    • Documentation
    • QuickStart Samples
    • Sample Applications
    • Downloads
    • Technical Support
    • Download trial
    • How to buy
    • Blog
    • Company
    • Resources
  • Documentation
    • Introduction
    • Deployment Guide
    • Nuget packages
    • Configuration
    • Using Parallelism
    • Mathematics Library User's Guide
    • Vector and Matrix Library User's Guide
    • Data Analysis Library User's Guide
    • Statistics Library User's Guide
    • Data Access Library User's Guide
    • Reference
  • Mathematics Library User's Guide
    • General Classes
    • Mathematical Functions
    • Complex Numbers
    • Arbitrary Precision Arithmetic
    • Automatic Differentiation
    • Curves and Interpolation
    • Curve Fitting
    • Solving Equations
    • Optimization
    • Calculus
    • Fast Fourier Transforms
    • Random Numbers
    • Generic Arithmetic
    • Appendices
  • Solving Equations
    • The EquationSolver Class
    • Methods that use the Derivative
    • Methods that do not use the derivative
    • Solving Systems of Non-Linear Equations
  • The EquationSolver Class

The EquationSolver Class

Extreme Optimization Numerical Libraries for .NET Professional

The EquationSolver class is the abstract base class for all root finder classes. Each root finding algorithm is implemented by a different class, derived from EquationSolver.

EquationSolver inherits from the IterativeAlgorithm class. 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. The default value for this property depends on the algorithm used. IterationsNeeded returns the actual number of iterations performed after the algorithm has completed.

The function to solve is passed as a FuncT, TResult delegate to a constructor, or it can be set later using the TargetFunction property.

The Solve method does the actual work of solving the equation. When called without parameters, it returns the approximation to the zero of the target function. When called with a single Double argument, it attempts to find a point where the target function equals the specified value.

Verifying the result

The Solve method always returns the best estimate for the root of the target function. Successive calls to the Result property will also return this value, until the next call to Solve. An optional parameter lets you specify the right-hand side of the equation TargetFunction(x) = rightHandSide that is to be solved. The default is zero.

If the ThrowExceptionOnFailure property is set to true, an exception is thrown if the algorithm has failed to converge to a solution within the desired accuracy. If false, the Solve method returns the best approximation to the zero, regardless of whether it is within the requested tolerance.

The Status property indicates how the algorithm terminated. Its possible values and their meaning are listed below.

Value

Description

The algorithm has not been executed.

The algorithm ended normally. The desired accuracy has been achieved.

IterationLimitExceeded

The number of iterations needed to achieve the desired accuracy is greater than MaxIterations.

Round-off prevented the algorithm from achieving the desired accuracy.

Bad behavior of the target function prevented the algorithm from achieving the desired accuracy.

Doesn't apply.

Equation solvers fall in two basic categories: those that use root bracketing, and those that use the derivative of the target function. Root bracketing solvers require an interval that is known to contain a zero of the target function. The interval is reduced in successive iterations until it is within the desired tolerance. Other algorithms require only a single starting value, but require the derivative of the function.

References

Chabert, J.-L. (Ed.). A History of Algorithms: From the Pebble to the Microchip. New York: Springer-Verlag, 1999.

Copyright (c) 2004-2021 ExoAnalytics Inc.

Send comments on this topic to support@extremeoptimization.com

Copyright © 2004-2021, Extreme Optimization. All rights reserved.
Extreme Optimization, Complexity made simple, M#, and M Sharp are trademarks of ExoAnalytics Inc.
Microsoft, Visual C#, Visual Basic, Visual Studio, Visual Studio.NET, and the Optimized for Visual Studio logo
are registered trademarks of Microsoft Corporation.