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'