Question: - P 6 6 Start with the program in Section 1 5 . 9 that calculates the electric field of a uniformly charged rod, modeled

-P66 Start with the program in Section 15.9 that calculates the electric field of a uniformly charged rod, modeled as 10 point charges, at multiple observation locations in a circle around the rod. (a) Add more arrows to the list named "observation," so that the electric field of the rod is displayed with 5 rings of
arrows centered on the rod, at different locations. (b) Increase the number of point charges used to model the rod to increase the accuracy of the calculation. Explain your criteria for determining an appropriate number of point charges.
STARTER CODE:
from vpython import *
scene.height =800
oofpez =9e9
Qtot=1e-9
L =1
N =10
dy = L / N
## Create a list of point charges
slices =[] ## an empty list
i =0
y0=-L /2+ dy /2 ## center of bottom slice
while i N:
a = sphere (pos = vector (0, y0+ i * dy,0), radius = dy /2,
color = color.red, q = Qtot / N)
slices.append(a) ## add sphere to list
i = i +1
## Print index and position
i =0
while i len(slices):
print(i, slices[i].pos)
i = i +1
## Calculate E at observation location
r_obs = vector (0.05,0,0) ## to test calculation
E_net = vector (0,0,0)
i =0
while i N:
rate (100)
r = r_obs - slices[i].pos
rhat = r/mag(r)
E =(oofpez * slices[i].q / mag(r)**2)* rhat
E_net = E_net + E
i = i +1
print(E_net)
## Create a list of arrows
observation =[]
yobs =0.4
dtheta =2* pi /12 # Divide the circle into 12 parts
theta =0
R =0.15 ## radius of circle
while theta 2* pi:
a = arrow(pos = vector(R * cos(theta), yobs, R * sin(theta)),
color = color.orange,
axis = vector (0,0,0))
observation.append(a)
theta = theta + dtheta
## Calculate E at observation location
sf =0.002 ## arrow scale factor
for earrow in observation:
## Add E of all slices for this obs. loc.
E_net = vector(0,0,0) # Reset E_net for each arrow
for i in range(N):
r = earrow.pos - slices[i].pos
rhat = r / mag(r)
E =(oofpez * slices[i].q / mag(r)**2)* rhat
E_net = E_net + E
earrow.axis = sf * E_net
- P 6 6 Start with the program in Section 1 5 . 9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!