template Doub dfridr(T &func, const Doub x, const Doub h, Doub &err) { const Int ntab=10; const Doub con=1.4, con2=(con*con); const Doub big=numeric_limits::max(); const Doub safe=2.0; Int i,j; Doub errt,fac,hh,ans; MatDoub a(ntab,ntab); if (h == 0.0) throw("h must be nonzero in dfridr."); hh=h; a[0][0]=(func(x+hh)-func(x-hh))/(2.0*hh); err=big; for (i=1;i= safe*err) break; } return ans; }