[Numpy-discussion] differencing numarray arrays.

Mike Zingale zingale at ucolick.org
Tue Jul 13 13:42:02 CDT 2004


thanks, all these responses helped.  I guess I was still a little
unclear with the slicing abilities in numarray.

Mike


On Tue, 13 Jul 2004, Paul Dubois wrote:

> Two of the responses to your question, while correct, might have seemed
> mysterious to a beginner.
>
> a[1:] - a[:-1]
>
> is actually shorthand for:
>
> a[1:, :] - a[:-1, :]
>
> Or to be even more explicit:
>
> n = 8
> a[1:n, 0:n] - a[0:(n-1), 0:n]
>
> If you had wanted the difference in the second index, you have to use
> the more explicit forms.
>
>
>




More information about the Numpy-discussion mailing list