Calculating gradient with NumPy Calculating gradient with NumPy numpy numpy