How to apply mathematical function on arrays and vectors and multidimensional matric

Hi guys,

I am quite new to Julia, I come form matlab background. I wanted to know how can you apply any mathematical fuunction like sine, cos or besselh to a matrix or array.

for example in matlab say you have x = rand(3,4,5) and you do y=sin(x) what you get is y a 3d matrix having dimension of (3,4,5). How can you accomplish this julia ?

y = sin.(x)

For more details see “broadcast and vectorization” in:

https://docs.julialang.org/en/v1/base/arrays/index.html

and

https://docs.julialang.org/en/v1/manual/functions/index.html

1 Like

I guess you want to read Functions · The Julia Language in particular.

1 Like

Thanks so much this helps a lot :slight_smile: