mjgpy3 mjgpy3 - 5 months ago 14x
Python Question

Does Python have a linspace function in its std lib?

Does Python have a function like matlab's

in its standard library?

If not, is there an easy way to implement it without installing an external package?

Here's a quick and easy definition of linspace in matlab terms.


I don't need a "vector result" as defined by the link, a list will do fine.


No, it doesn't. You can write your own (whicn isn't difficult), but if you are using Python to fulfil some of matlab's functionality then you definitely want to install numpy, which has numpy.linspace.

You may find NumPy for Matlab users informative.