// ------------------------------------------------ // zif.cpp binary search // ------------------------------------------------ #include "ww.h" #include "zif.h" double zef(fun *fu, double x, double h, double ytol) { double y = fu->f(x), x1 = 1; do { x1 = x - y*h/(fu->f(x+h) - y); x = x1; y = fu->f(x); } while (fabs(y) > ytol); return x; } // ----------------------------------------------------------------------