If I have a 1D numpy array and I want to return a 1D numpy array containing first derivatives with respect to x, then do I use np.gradient(x)? I think I am doing something wrong
This is the code that I have but it tells me my answer is incorrect.
def dfunc(x):
'''
Parameters
x: 1D numpy array
Returns
df: 1D numpy array containing first derivatives wrt x
'''
# WRITE YOUR CODE HERE
df = np.gradient(x)
return df