D
danfan1981
Hi, I am learning Numpy and using it for a course project.
Suppose x = [0, 1, 2, 3, 4], I know that x[0:2] would give [0,1], and
x[-1] give [4], is there a way that I can get [4,0,1]. I try x[-1:2],
but it returns an empty array.
I am doing convolution (e.g. convolve [0, 1, 2, 3, 4] with [1,-2,1])
with wrap-around boundary condition, so sometimes the indices would
wrap around the boundaries, and sometimes not. I would like to find a
generic expression for both cases.
Suppose x = [0, 1, 2, 3, 4], I know that x[0:2] would give [0,1], and
x[-1] give [4], is there a way that I can get [4,0,1]. I try x[-1:2],
but it returns an empty array.
I am doing convolution (e.g. convolve [0, 1, 2, 3, 4] with [1,-2,1])
with wrap-around boundary condition, so sometimes the indices would
wrap around the boundaries, and sometimes not. I would like to find a
generic expression for both cases.