|
|
|
|
|
by MayeulC
1062 days ago
|
|
Hmm, I encountered or used all of these somewhere, but 4 days ago I learned something else: python natively supports complex numbers. a=1+3j
b=a+4j
I encountered this when a friend noticed some weird syntax for a numpy meshgrid (via mgrid): np.mgrid[-1:1:5j]
|
|
This one can be explained as "equivalent to np.linspace(-1, 1, 5)", i.e 5 evenly spaced points between -1 and 1. Normally the step size is an integer but with a complex "step" it switches the meaning from step size to number of equidistant points.