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));