thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

Add step parameter to linspace (or endpoint parameter to arange) (Trac #2176) #5966

Open numpy-gitbot opened 12 years ago

numpy-gitbot commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/2176 on 2012-06-28 by atmention:endolith, assigned to unknown.

There's no simple way to make a sequence based on step size that includes both endpoints. For instance, to produce the sequence [1.0, 1.1, 1.2, 1.3, 1.4, 1.5], you'd have to do something clunky like:

linspace(1.0, 1.5, (1.5-1.0)/0.1+1)

or

arange(1.0, 1.5+0.01, 0.1)

it would be more convenient if you could just say

linspace(1.0, 1.5, step=0.1)

or maybe

arange(1.0, 1.5, 0.1, endpoint=True)

Of course, step could not be specified at the same time as num.