I noticed this when searching through numpy.gradient() customs. With numpy 1.13, the function seems to treat the input argument differently than the previous ones. Here is a simple example:
import numpy as np x=np.linspace(0,10,100) y=np.sin(x) dx=np.gradient(x) grad1=np.gradient(y,dx) print grad1 grad2=np.gradient(y,x) print grad2
I tested in numpy 1.13 and 1.11.3.
In 1.13, gradient(array1, array2) treats array2 as the coordinates (x) for array1 . But in 1.11.3 he considers array2 as a differentiation of coordinates (dx). So grad1 works in 1.11.3, and grad2 works for 1.13.
I think this is a rather strange trap, people could be mistaken if the same code runs using different versions of numpy. Or am I missing something obvious that clears this ambiguity?
source share