Newton constructor

const Newton({
  1. required String function,
  2. required double x0,
  3. double tolerance = 1.0e-10,
  4. int maxSteps = 10,
})

Creates a Newton object object to find the root of an equation using Newton's method.

  • function: the function f(x);
  • x0: the initial guess x0;
  • tolerance: how accurate the algorithm has to be;
  • maxSteps: how many iterations at most the algorithm has to do.

Implementation

const Newton({
  required super.function,
  required this.x0,
  super.tolerance = 1.0e-10,
  super.maxSteps = 10,
});