D Programming Language 2.0

- Comments
- D
- Search
- Home

Last update Tue Jan 1 00:47:46 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;
      }
      final x = secantMethod(&f, 0f, 1f);
      assert(approxEqual(x, 0.865474));

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