Answers for "numpy gradient vector"

0

numpy gradient vector

>>> f = np.array([1, 2, 4, 7, 11, 16], dtype=float)
>>> np.gradient(f)
array([1. , 1.5, 2.5, 3.5, 4.5, 5. ])
>>> np.gradient(f, 2)
array([0.5 ,  0.75,  1.25,  1.75,  2.25,  2.5 ])
Posted by: Guest on May-02-2020
0

numpy gradient vector

>>> x = np.arange(f.size)
>>> np.gradient(f, x)
array([1. ,  1.5,  2.5,  3.5,  4.5,  5. ])
Posted by: Guest on May-02-2020

Python Answers by Framework

Browse Popular Code Answers by Language