Fixing an issue in approx_fprime function (ticket #2993), implementing v...

Fixing an issue in approx_fprime function (ticket #2993), implementing a vectorized version of the code.