Why does Julia require a . for broadcasting?

There is a well defined function usually called “exponential” of a matrix. It is not equal generally to the exponential of each element of the matrix. You can see this:

julia> a = rand(10,10)
julia> exp(a) == exp.(a)
false

If exp(a) did the exponential of every element of the matrix, how would you express the matrix exponentiation? You would then have to define some mat_exp which would lose many of the advantages that multiple dispatch brings us.

Oh! @Satvik is a much faster typer!

13 Likes