title: Julia BoundsError with less information - don't know why
body: <p>I have the following code:</p>
  <pre><code># package for ploting functions
  using Plots
  # use GR
  gr()
  
  
  # nb points to plot
  nbPts = 22
  
  # define polar coordinates of a 30 degree (pi/6) rotation
  sine = sin(pi/6)
  cosine = cos(pi/6)
  
  # scale factor
  scale_factor = 0.9
  
  
  
  
  #---------------------------------------
  # 1. PLOT POINTS USING ROTATION MATRIX
  #---------------------------------------
  
  
  # define Rotation matrix ( angle = pi/6, center = (0, 0) )
  R = zeros(Float64, 2, 2)
  R[1,1] = R[2,2]= cosine
  R[1,2] = -sine
  R[2,1] = sine
  
  # Scale matrix
  
          ### ...   &lt;-- EXERCISE 4(c): define a uniform scaling matrix (use scale_factor)
  
  
  # arrays of points coords
  X_mat = zeros(nbPts)
  Y_mat= zeros(nbPts)
  
  # first Point (1,0)
  X_mat[1] = 1.0
  Y_mat[1] = 0.0
  
  for i in 2:nbPts
  
      prevPoint = [X_mat[i-1], Y_mat[i-1]]
      #apply rotation to previous point to obtain new point
      newPoint = R * prevPoint
  
          ### ...   &lt;-- EXERCISE 4(c): apply scaling matrix
  
      X_mat[i] = newPoint[1]
      Y_mat[i] = newPoint[2]
  
  end
  
  # plot points in blue
  plt1 = scatter(X_mat, Y_mat, color=:blue, xlim = (-1.1, 1.1),  ylim = (-1.1, 1.1), label=false, title=&quot;Rotation using matrices&quot; );
  
  
  
  
  
  #---------------------------------------
  # 2. PLOT POINTS USING COMPLEX NUMBERS
  #---------------------------------------
  
  function ComplexProduct(z, w)
      (((z[1]*w[1])+(z[2]*w[2])),((z[1]*w[2])+(z[2]*w[1])))
  
      ### ...   &lt;-- EXERCISE 4(b): implement complex product z * w
  
  end
  
  
  # first point: z = 1 + 0 * i
  Z = ( 1.0, 0.0 )
  # second point: w = cosine( pi/6) + sine( pi/6) * i
  W = ( cosine, sine )
  
      ### ...   &lt;-- EXERCISE 4(c): apply scale_factor to W
  
  
  # arrays of points coords
  X_comp = zeros(nbPts)
  Y_comp = zeros(nbPts)
  
  # first Point (1,0)
  X_comp[1] = Z[1]
  Y_comp[1] = Z[2]
  
  for i in 2:nbPts
  
      prevPoint = (X_comp[i-1], Y_comp[i-1])
  
      newPoint = ComplexProduct(prevPoint[1], prevPoint[2])   ###  &lt;-- EXERCISE 4(b): compute newPoint by applying rotation to prevPoint (use complex product)
  
      X_comp[i] = newPoint[1]
      Y_comp[i] = newPoint[2]
  
  end
  
  # plot points in red
  plt2 = scatter(X_comp, Y_comp, color=:red, xlim = (-1.1, 1.1),  ylim = (-1.1, 1.1), label=false, title=&quot;Rotation using complex numbers&quot; );
  
  
  
  
  
  # arrange and display
  display( plot( plt1, plt2, layout = (1, 2), size=(600*2, 600) ))
  </code></pre>
  <p>The Error:
  <img src="https://i.imgur.com/PtTdK58.png" alt="Error Code" /></p>
  <p>The Thing I want:
  I have to implement a product of complex numbers and this should be used to calculate the rotation with complex numbers.</p>
  <p>Should look like that:
  <img src="https://i.imgur.com/PRPZExu.png" alt="rotaion" /></p>
  <p>What do I have to change so that the BoundsError is fixed?
  Don't know what exactly i do wrong because of the poorly information i get from this error log.</p>
  <p>Greetings and thanks for the help.</p>