Skip to content

Linspace without endpoints #27097

@antoine-levitt

Description

@antoine-levitt

It would be very useful to have a variant of linspace that does not hit its endpoints: linspace(a,b,endpoint=false) rather than a:(b-a)/N:b-(b-a)/N and having to worry about reading it later, getting the math wrong, round-off errors maybe not giving me exactly N points, and evaluating a and b more than once. A typical use-case is representing periodic signals. Bonus points for inclusion/exclusion of left, right and both endpoints. With the new range-based linspace (#25896) the API would be a bit more awkward, but still worth it I think.

Requested for instance here https://discourse.julialang.org/t/proposal-of-numpy-like-endpoint-option-for-linspace/6916

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions