check.dist.gradient computes the numeric derivative of
ds$log.density at x in each of its coordinates and
compares this to the value returned by ds$grad.log.density.
If the relative error is greater than \(0.001\), an error is
reported.
This function can be used when defining a distribution to ensure
that the gradient function is implemented correctly.