From looking at the photographs below, you can see that the first option for the VPython experiment was chosen. Here, two bars of electrical charge were created and four points were placed in between these charges. The net electrical potentials were calculated for each point below. The code is also shown below. Two loops had to be created in order to create the bars of electrons, as well as the charges flowing through them.

Net electric potential at the following points:
a.
(-.3, .1. 0) = -5.82
b.
(.2, .1, 0) = 3.68
c. (-.2, -.1, 0) = -3.68
Code Used:
from visual import *
k = 8.988e9
#Charge 1
c1 = sphere(pos=(-1,0,0), radius=0.2,color=color.blue)
q1= -1e-9 #charge of Charge 1
#Charge 2
c2 = sphere(pos=(1,0,0), radius=0.2,color=color.red)
q2= 1e-9 #charge of charge 2
r = vector (-1,-1,0)
s = vector (1,-1,0)
loc1= sphere(pos=(-0.3,0.1,0), radius = 0.1,color=color.red)
loc2= sphere(pos=(0.2,0.1,0), radius = 0.1,color=color.white)
loc3= sphere(pos=(-0.2,-0.1,0), radius = 0.1,color=color.orange)
loc4= sphere(pos=(0.1,-0.1,0), radius = 0.1,color=color.yellow)
L1 = label(pos=loc1.pos,xoffset=-20,yoffset=20,text= "")
L2 = label(pos=loc2.pos,xoffset=20,yoffset=20,text= "")
L3 = label(pos=loc3.pos,xoffset=-20,yoffset=-20,text= "")
L4 = label(pos=loc4.pos,xoffset=20,yoffset=-20,text= "")
while r.y < 1:
rate(30)
S1=sphere(pos=r, radius=0.2,color=color.blue)
r.y = r.y + 0.1
rc1= mag(S1.pos-c1.pos)
rc2= mag(S1.pos-c2.pos)
Vc1= k*q1/rc1
Vc2=k*q2/rc2
V1net= Vc1 + Vc2
L1.text = "V=%1.2f" % V1net
L2.text = "V=%1.2f" % V1net
L3.text = "V=%1.2f" % V1net
L4.text = "V=%1.2f" % V1net
while s.y < 1:
rate(30)
S2=sphere(pos=s, radius=0.2,color=color.red)
s.y = s.y + 0.1
rc1= mag(S2.pos-c1.pos)
rc2= mag(S2.pos-c2.pos)
Vc1= k*q1/rc1
Vc2=k*q2/rc2
V2net= Vc1 + Vc2
L1.text = "V=%1.2f" % V2net
L2.text = "V=%1.2f" % V2net
L3.text = "V=%1.2f" % V2net
L4.text = "V=%1.2f" % V2net

No comments:
Post a Comment