Re:20M digits of pi in 1 minute using Julia
by Max_Limelihood on Saturday March 04, 2023 @02:24PM
(#35023666)
I feel like you’re misunderstanding how Julia syntax works. Julia syntax is Python syntax, for the most part. They’re not identical, but the differences are very small, and typically favor Julia—for example, compare:
x*(y.^2)
To the Python equivalent:
np.matmul(x, map(lambda x : x^2, y))
Note also that the first will be much faster because it can fuse the matrix multiplication with the exponentiation. That’s because Julia is a single language, and the whole thing is compiled at the same time. Python can’t fix the above code because NumPy is written in C, not Python.
x*(y.^2)
To the Python equivalent:
np.matmul(x, map(lambda x : x^2, y))
Note also that the first will be much faster because it can fuse the matrix multiplication with the exponentiation. That’s because Julia is a single language, and the whole thing is compiled at the same time. Python can’t fix the above code because NumPy is written in C, not Python.
Julia is just Python but fast.