{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

dipolelab - from_future import division f from visual...

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

View Full Document Right Arrow Icon
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)
Image of page 1

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

View Full Document Right Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern