1. Not finding help here? Sign up for a free 30min tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Using VPython program to calculate the E-field

  1. Apr 17, 2015 #1
    1. The problem statement, all variables and given/known data
    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.

    2. Relevant equations

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

    3. 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'
     
  2. jcsd
  3. Apr 18, 2015 #2

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    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.
     
  4. Apr 18, 2015 #3
    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?
     
  5. Apr 18, 2015 #4

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    Can you draw the vertices of a regular polygon on a circle?
     
  6. Apr 18, 2015 #5
    I don't know how to draw it.
     
  7. Apr 18, 2015 #6

    robphy

    User Avatar
    Science Advisor
    Homework Helper
    Gold Member

    If you had to draw a regular octagon, what angles would use?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted



Similar Discussions: Using VPython program to calculate the E-field
Loading...