numerical_shadow() now takes a sampling function as parameter.