Secant class

Implements the Secant method to find the roots of a given equation.

Characteristics:

  • The method is not guaranteed to converge to a root of f(x).

  • The secant method does not require the root to remain bracketed, like the bisection method does for example, so it doesn't always converge.

Inheritance

Constructors

Secant({required String function, required double firstGuess, required double secondGuess, double tolerance = 1.0e-10, int maxSteps = 15})
Instantiates a new object to find the root of an equation by using the Secant method. Ideally, the two guesses should be close to the root.
const

Properties

firstGuess double
The first guess
final
function String
The function f(x) for which the algorithm has to find a solution.
finalinherited
hashCode int
The hash code for this object.
no setteroverride
maxSteps int
The maximum number of iterations to be made by the algorithm.
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secondGuess double
The second guess
final
tolerance double
The accuracy of the algorithm.
finalinherited

Methods

convergence(List<double> guesses, int steps) double
In order to get a meaningful result, it makes sense to compute the rate of convergence only if the algorithm made at least 3 steps (iterations).
inherited
efficiency(List<double> guesses, int steps) double
The efficiency is evaluated only if the convergence is not double.nan. The formula is:
inherited
evaluateDerivativeOn(double x) num
Evaluates the derivative of the function on the given x value.
inherited
evaluateOn(double x) num
Evaluates the function on the given x value.
inherited
integrateOn(NumericalIntegration numericalIntegration) IntegralResults
Calculates the numerical value of the integral of this function using a NumericalIntegration algorithm.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
solve() NonlinearResults
Returns a NonlinearResults object which contains the data calculated by the root-finding algorithm.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
override