Secant constructor

const Secant({
  1. required String function,
  2. required double a,
  3. required double b,
  4. double tolerance = 1.0e-10,
  5. int maxSteps = 15,
})

Creates a Secant object to find the root of an equation by using the secant method. Ideally, the two guesses should be close to the root.

  • function: the function f(x);
  • a: the first interval in which evaluate f(a);
  • b: the second interval in which evaluate f(b);
  • tolerance: how accurate the algorithm has to be;
  • maxSteps: how many iterations at most the algorithm has to do.

Implementation

const Secant({
  required super.function,
  required this.a,
  required this.b,
  super.tolerance = 1.0e-10,
  super.maxSteps = 15,
});