Using VPython program to calculate the E-field

  • #1
85
0

Homework Statement


Charge a ring of radius R=5.0cm laying in the x-y plane to 50nC.

Create a VPython program that will allow you to calculate the E-field due to the ring anywhere in space.

Homework Equations



E_ring=kQz/(R^2+z^2)^(3/2), point P above the xy-plane

The Attempt at a Solution




from visual import *

C = pi*.10 # meters
Q = 50.0*10**-9 #Coulombs
k = 8.99*10**9 # Nm^2/C^2
E = vector(0.0,0.0,0.0) # N/C

Lambda = Q/C # linear charge density
s=vector(0.025,0.0,0.025)

# we are looking for the E-field due to the ring at anywhere, I think we would have dD,
# but I don't know how to define it.

ds = vector(D/10000,D/10000,D/10000)
dq = mag(Lambda*ds)

while s.x < L+D:

rate=(10000)
dE = k*dq/(mag(s)**2)*norm(s)
E = E + dE
s = s + ds

print 'sx=',s.x,'dE=',dE,'E=',E
print 'E=',E,'N/C'[/B]
 

Answers and Replies

  • #2
robphy
Science Advisor
Homework Helper
Insights Author
Gold Member
5,968
1,296
Does your formula for the ring work everywhere? Or just on the axis?

It might better to model ring of charge as a set of equally spaced point charges on the ring.
Then at the point of interest, find the electric-field vector there as a vector sum of electric-field contributions from each point charge.

You can use your formula to check at a point where it is valid.
 
  • #3
85
0
Does your formula for the ring work everywhere? Or just on the axis?

It might better to model ring of charge as a set of equally spaced point charges on the ring.
Then at the point of interest, find the electric-field vector there as a vector sum of electric-field contributions from each point charge.

You can use your formula to check at a point where it is valid.
The formula only model on the z-axis.

I don't know how to model ring of charge as a set of equally spaced point charges on the ring?

Can you give me a hit?
 
  • #4
robphy
Science Advisor
Homework Helper
Insights Author
Gold Member
5,968
1,296
Can you draw the vertices of a regular polygon on a circle?
 
  • #5
85
0
Can you draw the vertices of a regular polygon on a circle?
I don't know how to draw it.
 
  • #6
robphy
Science Advisor
Homework Helper
Insights Author
Gold Member
5,968
1,296
If you had to draw a regular octagon, what angles would use?
 

Related Threads on Using VPython program to calculate the E-field

Replies
0
Views
5K
Replies
6
Views
2K
  • Last Post
Replies
3
Views
5K
  • Last Post
Replies
1
Views
990
  • Last Post
Replies
1
Views
1K
  • Last Post
Replies
2
Views
932
  • Last Post
Replies
5
Views
4K
Replies
2
Views
136
Top