[Numpy-discussion] partial_sum/adj_difference?

Stefan van der Walt stefan@sun.ac...
Tue Feb 19 13:41:42 CST 2008


Hi Neal

On Tue, Feb 19, 2008 at 01:38:06PM -0500, Neal Becker wrote:
> Does numpy/scipy have a partial_sum and adj_difference function?
> 
> partial_sum[i] = \sum_{j=0}^{i} x[j]

numpy.cumsum

Yikes, the docstring contains "Blah, blah".  I'll fix that
immediately.

> adj_diff[i] = x[i] - x[i-1] : i > 1, x[i] otherwise

numpy.diff

Regards
Stéfan


More information about the Numpy-discussion mailing list