D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Thu Mar 6 15:45:44 2008

# std.numeric

This module is a port of a growing fragment of the numeric header in Alexander Stepanov's Standard Template Library, with a few additions.
Author:
Andrei Alexandrescu

template secantMethod(alias F)
  Implements the secant method for finding a root of the function f starting from points [xn_1, x_n] (ideally close to the root). Num may be float, double, or real.
  Example:

      float f(float x) {
          return cos(x) - x*x*x;
      }
      auto x = secantMethod(&f, 0f, 1f);
      assert(approxEqual(x, 0.865474));

Copyright © 1999-2008 by Digital Mars, All Rights Reserved | Page generated by Ddoc.