Skip to content

num::roots::debug::verify_derivative

Defined in header <roots/debug.hpp>

template <class F, class D, class T = real>
requires differentiable_function<F, D, T>
void verify_derivative(F &&f, D &&df, T x, T tol = T(1e-5), call_site site = {});

Verify a supplied derivative against a central difference.

A wrong derivative makes Newton's method converge slowly, to the wrong point, or not at all, and none of those report an error on their own.