{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

dipolelab

# dipolelab - from_future import division f from visual...

This preview shows pages 1–2. Sign up to view the full content.

from __future__ import division from visual import * f #constants scale_factor = 3e-21 oofpez = 9e9 echarge = 1.6e-19 e #objects plus = sphere(pos=vector(-5e-11,0,0), radius=1e-11, color=color.red) minus = sphere(pos=vector(5e-11,0,0), radius=1e-11, color=color.blue) m #initial values obslocation = vector(2e-10,0,0) theta = 0 t #calculations # while theta < 2*pi: unit = vector(cos(theta), sin(theta), 0) rmag = 2e-10 obslocation = rmag*unit rplus = obslocation - plus.pos Eplus = (oofpez*echarge/(mag(rplus)**2))*(rplus/mag(rplus)) rminus = obslocation - minus.pos Eminus = (oofpez*-echarge/(mag(rminus)**2))*(rminus/mag(rminus)) Enet = Eplus + Eminus print "Enet = ",Enet print "Location = ", obslocation arrow(pos=obslocation, axis=Enet*scale_factor, color=color.orange) theta = theta + pi/6 theta = 0 while theta < 2*pi: unit = vector(sin(theta), 0, cos(theta)) rmag = 2e-10 obslocation = rmag*unit rplus = obslocation - plus.pos Eplus = (oofpez*echarge/(mag(rplus)**2))*(rplus/mag(rplus)) rminus = obslocation - minus.pos Eminus = (oofpez*-echarge/(mag(rminus)**2))*(rminus/mag(rminus)) Enet = Eplus + Eminus print "Enet = ",Enet print "Location = ", obslocation arrow(pos=obslocation, axis=Enet*scale_factor, color=color.orange)

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern