Thursday, March 26, 2015

Dipole Moments, Torque, Electric Fields, and Flux (3/26/2015)

Prediction of the path an electron will take when shot through two oppositely charged layers.






Work and calculations for the electric dipole moment and calculating work done by torque between two oppositely charged particles.


Prediction for the 3D representation of the electric field of a dipole.


3D representations of the electric field of a dipole. The code for which is shown below:
from __future__ import division
from visual import *
 
## constants
k = 9e9 # stands for One Over Four Pi Epsilon-Zero
qe = 1.6e-19  # proton charge
s = 4e-11    # charge separation
R = 3e-10  # display Enet on a circle of radius R
V = 2e-10
scalefactor = 1e-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
theta = 0
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=R*vector(cos(theta),sin(theta),0), axis=vector(1e-10,0,0), color=color.orange)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12

theta = 0
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=R*vector(cos(theta),0,sin(theta)), axis=vector(1e-10,0,0), color=color.orange)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12

theta = 0
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=R*vector(0,cos(theta),sin(theta)), axis=vector(1e-10,0,0), color=color.orange)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12




theta = 0
scalefactor= 1*(10**(-20.5))
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=V*vector(cos(theta),sin(theta),0), axis=vector(1e-10,0,0), color=color.red)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12

theta = 0
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=V*vector(cos(theta),0,sin(theta)), axis=vector(1e-10,0,0), color=color.red)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12

theta = 0
while theta < 2*pi:
    rate(50)   # tell computer to go through loop slowly
    ## Calculate observation location (tail of arrow) using current value of theta:
    Earrow1 = arrow(pos=V*vector(0,cos(theta),sin(theta)), axis=vector(1e-10,0,0), color=color.red)
    
    R1= Earrow1.pos-plus.pos
    R2= Earrow1.pos-neg.pos
    Ef1=((k*qplus)/(mag(R1)**3))
    Ef2=((k*qneg)/(mag(R2)**3))
    Earrow1.axis= ((Ef1*R1)+(Ef2*R2))*scalefactor
    print "Ef1: ", Ef1
    
    ## write instructions below to tell the computer how to calculate the correct
    ## net electric field Enet at the observation location (the position of Earrow):
 
    ## change the axis of Earrow to point in the direction of the electric field at that location
    ## and scale it so it looks reasonable
 
    ## Assign a new value to theta
    theta = theta + pi/12



Depictions for the electric field lines and flux activity.


Flux demonstration. The nails are the electric field lines, and the wire hoop is used to show how position affects the amount of field lines that are able to pass through a given surface.


Calculations for the mathematical representation of flux.



Calculations and work done for flux through a cube.

No comments:

Post a Comment