Fix finite difference gradient test.
Implement finite difference Jacobian.