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 4:   Sphere with a given axially symmetric potential

Conside a sphere whose surface is held at a fixed potential V[θ].

Part (a)   Derive an expression for the potential outside and inside the sphere for an arbitrary surface potential V[θ].  Illustrate with the example V[θ] = V0 Cos[θ]^2 .

potIn[V_,s_]:= 
	Sum[(B[V,n] (r/r0)^n) P[n,Cos[θ]],{n,0,s}]

potOut[V_,s_]:=
	Sum[(B[V,n] (r0/r)^(n+1) ) P[n,Cos[θ]],{n,0,s}]

B[V_,n_]:=
	(2 n+1)/2 Integrate[V LegendreP[n,Cos[θ]] Sin[θ]
	,{θ,0,π}]

pIn=potIn[V0 Cos[θ]^2,2]

pOut=potOut[V0 Cos[θ]^2,2]

values={r0->1,V0->1,P->LegendreP}

p1 = CylindricalPlot3D[
	pIn//.values//Evaluate
	,{r,0,1},{θ,0,2π}
	,BoxRatios->{1,1,1}
	,ViewPoint->{-1.5,-2,2}];

p2 = CylindricalPlot3D[
	pOut//.values//Evaluate
	,{r,1,3},{θ,0,2π}
	,BoxRatios->{1,1,1}
	,ViewPoint->{-1.5,-2,2}];

Show[p1,p2];

Part (b) Finf the potential when the surface potential is V[θ] = Cos[θ] /(1.1 - Cos[θ]).   Plot the potential as a function of {r,θ}.

surfacePot=Cos[θ]/(1.1 - Cos[θ])

{pIn,pOut}=({potIn[surfacePot,4]
			,potOut[surfacePot,4]}
			//.P->LegendreP
			//.{r0->1}
			)//Simplify

p3 = CylindricalPlot3D[pIn
	,{r,0,1},{θ,0,2π}
	,BoxRatios->{1,1,1}
	,ViewPoint->{-1.5,-2,2}];

p4 = CylindricalPlot3D[pOut
	,{r,1,3},{θ,0,2π}
	,BoxRatios->{1,1,1}
	,ViewPoint->{-1.5,-2,2}];

Show[p3,p4];

Part (c)  Plot the equipotential surfaces and electric field lines for the potential found in Part (b).

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

eq1=pIn/.r2xRule/.x->0//Simplify

eq2=pOut/.r2xRule/.x->0//Simplify

pot = If[y^2 + z^2 < 1, 1/(y^2 + z^2)*
     (0.4159674557056253*y^6 + 
       y^4*(-0.9673771327086637 - 2.255251398098017*z - 
          2.911772189939377*z^2) + 
       1.109246548548334*z^2*(0.4238231002032066 + z)*
        (1.006771820412757 + z)*
        (1.425049800842731 - 0.07516953386766305*z + z^2) - 
       2.218493097096668*y^2*(-1.104358066697195 + z)*
        (0.3578075924740011 + z)*
        (0.7694072275420314 + 1.085406820910269*z + z^2)), 
    1/(y^2 + z^2)^(5/2)*(0.4159674557056253 + 
       (4.852953649898962*z^4)/(y^2 + z^2)^2 + 
       (3.758752330163361*z^3)/(y^2 + z^2) - 
       0.9673771327086637*(y^2 + z^2) + 
       0.6744873407478823*(y^2 + z^2)^2 + 
       z*(-2.255251398098017 + 2.225808224468011*y^2 + 
          2.225808224468011*z^2) + 
       (z^2*(-4.159674557056253 + 2.902131398125991*(y^2 + z^2)))/
        (y^2 + z^2))];

circle=ParametricPlot[{Cos[t],Sin[t]},{t,0,2π}
		,Axes->False
		,PlotStyle->{Thickness[0.030]}];

Show[VEPlot[pot,{y,-2,2.1},{z,-2,2.1}],circle];