TITLE 'Two Point Charges' SELECT VectorGrid=50 DEFINITIONS Lx=1 Ly=1 r0=Ly/10 q1=1 q2=1 d0=Ly/3 { Two charges separated by d0 } eps0=8.854e-12 c=1/(4*pi*eps0) Phi= q1*c/sqrt(x^2+(y+d0)^2)+ q2*c/sqrt(x^2+(y-d0)^2) { Potential of two charges } E=-grad(Phi) Em=magnitude(E) { field calculation } BOUNDARIES region 'domain' start(-Lx,-Ly) line to (Lx,-Ly) to (Lx,Ly) to (-Lx,Ly) to finish start(r0,d0) arc( center=0,d0) angle=360 { Exclude circle of radius r0 around charge #2 } start(r0,-d0) arc( center=0,-d0) angle=360 { Exclude circle of radius r0 around charge #1 } PLOTS contour( Phi) contour( Em) log vector(E) END