title: Vpython: property 'axis' must be a vector
body: <p>I am doing a Vpython assignment for my physics 2 class, which is asking to program the electric field of a dipole. I have written the following code:</p>
  
  <pre><code>## constants
  oofpez = 9e9 # stands for One Over Four Pi Epsilon-Zero
  qe = 1.6e-19  # postive charge value
  s = 4e-11    # charge separation
  R = 3e-10  # display Enet on a circle of radius R
  scalefactor = 3e-20 # for scaling arrows to represent electric field
  
  ## objects
  ## Represent the two charges of the dipole by red and blue spheres:
  plus = sphere(pos=vector(s/2,0,0), radius=1e-11, color=color.red)
  qplus = qe   # charge of positive particle
  neg = sphere(pos=vector(-s/2,0,0), radius=1e-11, color=color.blue)
  qneg = -qplus  # charge of negative particle
  
  
  ## calculations
  ## You will complete the lines required to make a loop calculate and display the net dipole electric field
  ## at equally spaced angles on a circle radius R around the dipole. The dipole is centered at the origin.
  theta = 0
  while theta &lt; 2*pi:
      rate(2)   # tell computer to go through loop slowly
      ## Calculate observation location (tail of arrow) using current value of theta:
      Earrow = arrow(pos=R*vector(cos(theta),sin(theta),0), axis=vector(1e-10,0,0), color=color.orange)
      ## assign the name TestLocation to be the observation location on the circle radius R
      TestLocation=R*vector(cos(theta),sin(theta),0)
      ## write instructions below to tell the computer how to calculate the correct 
      ## net electric field Enet at the observation location (the position of Earrow):
      rPlus=TestLocation-plus.pos
      rPlusMag=((R*cos(theta)-(s/2))^2+(R*sin(theta))^2)^0.5
      rPlusHat=rPlus/rPlusMag
      Eplus=oofpez*qplus/(rPlusMag)^2*rPlusHat
  
      rNeg=TestLocation-neg.pos
      rNegMag=((R*cos(theta)-(-s/2))^2+(R*sin(theta))^2)^0.5
      rNegHat=rNeg/rNegMag
      Eneg=oofpez*qneg/(rNegMag)^2*rNegHat
  
      Etotal=Eplus+Eneg
  
      Enet=arrow(pos=TestLocation,axis=Etotal*scalefactor, color=color.green)
  
      ## change the axis of Earrow to point in the direction of the electric field at that location
      ## and scale it so it looks reasonable
      ## Efield = arrow(pos=R*vector(cos(theta),sin(theta),0), axis=Etotal*scalefactor, color=color.blue)
      Earrow.axis=Etotal*scalefactor
  
      ## Assign a new value to theta
      theta = theta + pi/6
  </code></pre>
  
  <p>The assignment had a pre-made template created with the comments, the proper variables declared and said variables assigned the correct values, so in theory it should run correctly if I input the rest of the code correctly. The code I wrote starts at "rPlus=..." and ends at "Enet=..." However, when I run it (using GlowScript IDE) it gives an error message saying "Error: Property 'axis' must be a vector," which I'm sure means that there's something wrong with the value assigned to Enet.axis within that section of the code. I have looked through the code I've generated and can't seem to find the error. </p>
  
  <p>We are learning python supplementary to our regular course work so I do not have any background in python besides these assignments. I don't need help with finding the electric field, just why the error message is popping up. Any help or hint in the right direction would be appreciated!</p>
  
  <p>Thanks</p>