When I pass two arrays the function returns: type: non-boolean (BitArray{1}) used in boolean context while loading In[10], in expression starting on line 1
I have modified the function to address the element wise operation as follows: inside_disc(x,y,radius) = sqrt(x.^2 .+ y.^2) .< radius ? 1 : 0 seems to me that the error is being thrown by .< operation. What am I missing? On Friday, 6 June 2014 20:34:22 UTC-4, Miguel Bazdresch wrote: > > I'm not sure I understand the question. Do you mean something like this? > > inside_disc(x,y,radius) = sqrt(x^2+y^2)<radius ? 1 : 0 > > -- mb > > > On Fri, Jun 6, 2014 at 8:28 PM, Zahirul ALAM <zahiru...@gmail.com > <javascript:>> wrote: > >> I guess one can do a for loop. But how do I vectorize the code? >> >> >> On Friday, 6 June 2014 20:27:46 UTC-4, Zahirul ALAM wrote: >>> >>> How would one implement a step function like behaviour in julia? In >>> mathematica one can write the following to create a circle with value of 1 >>> within the radius and 0 outside >>> >>> UnitBox[Sqrt[X^2 + Y^2]*0.5/radius]; >>> >>> X and Y are the coordinates. >>> >> >