So I recently saw a post use linspace
in Python, is this not a Matlab function? I cannot find it in the docs and was under the impression that the Python alternative for linspace
is range
. Is it part of some module/library/package?
Asked
Active
Viewed 91 times
-2

Luis Mendo
- 110,752
- 13
- 76
- 147
-
Typing "python linspace" in google gives you the answer....... – BillBokeey Sep 09 '22 at 08:17
1 Answers
-1
As Bylal said it's a numpy thing. Numpy mostly exists for greater easy of use and performance in mathematical functions. While you can achieve the same thing as linspace
with a list comprehension of a range linspace
is less verbose and much faster (plus for mathematical/scientific applications numpy's arrays are far easier to work with than python's lists and sets).
Most of what numpy does is relatively easily done in regular python code but numpy is far faster and much easier to work with.

Pioneer_11
- 670
- 4
- 19