Using VPython program to calculate the E-field

In summary, the homework statement asks to charge a ring of radius R=5.0cm laying in the x-y plane to 50nC. The program calculates the electric field due to the ring and displays the results.
  • #1
HaLAA
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]
 
Technology news on Phys.org
  • #2
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
robphy said:
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
Can you draw the vertices of a regular polygon on a circle?
 
  • #5
robphy said:
Can you draw the vertices of a regular polygon on a circle?
I don't know how to draw it.
 
  • #6
If you had to draw a regular octagon, what angles would use?
 

Related to Using VPython program to calculate the E-field

1. How do I use VPython to calculate the E-field?

To use VPython to calculate the E-field, you will need to first define the charges and their positions. Then, you can use the VPython function "Efield()" to calculate the electric field at any given point in space.

2. What are the units of the E-field calculated by VPython?

The units of the E-field calculated by VPython are in Newtons per Coulomb (N/C), which is the standard unit for electric field.

3. Can VPython calculate the E-field for multiple charges?

Yes, VPython has the capability to calculate the E-field for multiple charges. You can simply define the charges and their positions in the code, and then use the "Efield()" function to calculate the electric field at any point in space.

4. Is VPython accurate in calculating the E-field?

VPython is a widely used and trusted program for scientific calculations, so it is generally accurate in calculating the E-field. However, the accuracy may depend on the complexity of the system and the precision of the input parameters. It is always recommended to double check your results and make sure they align with your expectations.

5. Can VPython calculate the E-field for non-uniform charge distributions?

Yes, VPython has the ability to calculate the E-field for non-uniform charge distributions. You can define the charges and their positions in the code, and then use the "Efield()" function to calculate the electric field at any given point in space.

Similar threads

  • Introductory Physics Homework Help
Replies
6
Views
1K
Replies
8
Views
762
  • Introductory Physics Homework Help
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
1K
  • Introductory Physics Homework Help
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
687
  • Introductory Physics Homework Help
Replies
3
Views
810
  • Introductory Physics Homework Help
Replies
2
Views
1K
  • Introductory Physics Homework Help
Replies
1
Views
917
  • Calculus and Beyond Homework Help
Replies
5
Views
1K
Back
Top