Compute the gradient using the first order forward differences.
The returned gradient hence has the same shape as the input array.
- Parameters
param (np.array) – An N-dimensional array containing samples of a scalar function.
dx (float) – Spacing between param values along the axis.
axis (int) – Axis on which to compute the gradient (0=x, 1=y)
- Returns
grad – The gradient.
- Return type
NDArrayFloat