Another thing, that @sijo has already highlighted, is that there is no need to create all those repeated arrays, where you simply have multiple copies of the same column or row many times. It is not necessary in Julia, and it is not necessary in Python. Both Julia and Numpy support broadcasting – numpy for some operations, and Julia universally through the dot operator.
So in Julia you just write
and in numpy you can write
np.arctan2(x, y)
if x
is Mx1 and y
is 1xN (it does not apparently work for vectors, only matrices).
The creation of repeated, meshgrid-like arrays are an anti-pattern that should be avoided both in Julia, Python and Matlab (yes, Matlab, too, supports broadcasting to some extent.)