Re: [Numpy-discussion] ENH: ratio function to mimic diff

2017-07-29 Thread Joseph Fox-Rabinovitz
On Jul 29, 2017 12:55, "Nathaniel Smith" wrote: I'd also like to see a more detailed motivation for this. And, if it is useful, then that would make 3 operations that have special case pairwise moving window variants (subtract, floor_divide, true_divide). 3 is a lot of special cases. Should ther

Re: [Numpy-discussion] ENH: ratio function to mimic diff

2017-07-29 Thread Joseph Fox-Rabinovitz
On Jul 29, 2017 12:23, "Stephan Hoyer" wrote: This is an interesting idea, but I don't understand the use cases for this function. In particular, what would you use n-th order ratios for? There is no good use case for the nth order differences that I am aware of. I just added that to mimic the

Re: [Numpy-discussion] ENH: ratio function to mimic diff

2017-07-29 Thread Nathaniel Smith
I'd also like to see a more detailed motivation for this. And, if it is useful, then that would make 3 operations that have special case pairwise moving window variants (subtract, floor_divide, true_divide). 3 is a lot of special cases. Should there instead be a generic mechanism for doing this fo

Re: [Numpy-discussion] ENH: ratio function to mimic diff

2017-07-29 Thread Stephan Hoyer
This is an interesting idea, but I don't understand the use cases for this function. In particular, what would you use n-th order ratios for? One use case I can think of is estimating the slope of a log-scaled plot. But here exp(diff(log(x))) is an easy substitute. I guess ratio() would work in c

[Numpy-discussion] ENH: ratio function to mimic diff

2017-07-28 Thread Joseph Fox-Rabinovitz
I have created PR#9481 to introduce a `ratio` function that behaves very similarly to `diff`, except that it divides successive elements instead of subtracting them. It has some handling built in for zero division, as well as the ability to select between `/` and `//` operators. There is currently