5. Electrostatics

Legal Notice, Disclaimer, and Book Ordering Information:

Null

Setup

\(Clear["Global`*"]; 
Off[General::spell]; 
Off[General::spell1]; 
    \)

Needs["Calculus`VectorAnalysis`"]

Needs["Graphics`PlotField`"]

Needs["Graphics`PlotField3D`"]

<< "D:\Mma\Inits\ch5init.m"

Clear["Global`*"];

5.2 Problems

5.2.3  Legendre Polynomials and Spherical Harmonics

Problem 2:  Grounded Sphere in an Electric Field

A conducting sphere of radius a, which is held at zero potential, is placed in a uniform electric field E0 directed along the z-axis.

Part (a)   Find the potential and the electric field.

pot[s_]:= (Sum[(A[i] (r/a)^i + B[i] (a/r)^(i+1) ) LegendreP[i,Cos[θ]],{i,0,s}] + O[Cos[θ]]^(s+1))

pot[2]//Expand//Collect[#,{r,1/r}]&

listAB[s_]:={Array[A,s+1,0],Array[B,s+1,0]}//Flatten

listAB[3]

boundary1[s_]:={A[0]==0,A[1]==-E0 a, Table[A[i]==0,{i,2,s}]}//Flatten

boundary1[2]

And@@boundary1[2]

boundary2[s_]:=LogicalExpand[(pot[s]/.r->a)==0]

boundary2[2]

ABrule=Solve[(And@@{boundary2[2],And@@boundary1[3]})
	,listAB[2]]//Flatten

potential=(pot[2]//.ABrule//Normal//ExpandAll)

eField=-Grad[potential,Spherical[r,θ,ϕ]]//ExpandAll

Part (b)   Plot the equipotential surfaces and electric field lines.

r2xRule=({r,θ,ϕ}->CoordinatesFromCartesian[{x,y,z},Spherical]//Thread)

values={E0->1,a->1}

sphere=Graphics[Disk[{0,0},1]];

Show[{
	VEPlot[potential//.r2xRule//.values//.{y->0}//Evaluate
	,{x,-2,2.1},{z,-2,2.1}],sphere}];