First, suppose I apply the vectorized funciton, but on a single point
Basically, just don’t do this. f.(r1)
syntactically means "apply f elementwise to r1
. If r1
is a vector, then you’re asking Julia to apply f
to each element of the vector, which isn’t what you actually want. So use f(r1)
when you have one element or f.(rvals)
when you have a vector of elements.
How do I convert between the data types?
You can just construct it directly as [x, y]
, or if you already have the N array of points, you can do [r[:, i] for i in 1:size(r, 2)]
, for example.