5. Lagrangians and Hamiltonians

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.1  Point Charges, Multipoles, and Image Problems

Problem 3:  Point Charges and a Grounded Sphere

Consider a point charge q a distance d from the center of a grounded conducting sphere of radius a.

Part (a)   Find the potential outside the sphere.  Expand it in powers of 1/r and find the leading-order term.  Find the electric field to the same order.

eq1={  q/(d+a) + q1/(d1+a) == 0
      ,q/(d-a) + q1/(a-d1) == 0}

imageRule=Solve[eq1,{d1,q1}]//Flatten

potential=(Monopole[q,{0,0,d}]
+Monopole[q1,{0,0,d1}])//.imageRule//ExpandAll//PowerExpand

x2rRule=Thread[{x,y,z}->CoordinatesToCartesian[{r,θ,ϕ},Spherical]]

potentialR =
potential//.x2rRule//Simplify

potentialR//.r->a//Simplify//PowerExpand

potentialR//PotentialExpansion//TrigReduce//PowerExpand//Simplify

vals={a->.2,d->.4,q->1,y->0,z->y};

VEPlot[potential/.vals];

chargedensity=(-1/(4 π) D[potentialR,r]/.{r->a})//Simplify//Together//PowerExpand//Simplify

totalcharge=2 π a^2 Integrate[chargedensity Sin[θ],{θ,0,π}]/.{1/Sqrt[(a-d)^2]->1/(d-a)
,1/Sqrt[(a+d)^2]->1/(d+a)}//Simplify

vals={a->1,q->1,d->2}

θMin=+(FindMinimum[+chargedensity/.vals,{θ,0,π}]//First)

θMax=-(FindMinimum[-chargedensity/.vals,{θ,0,π}]//First)

gray=((chargedensity-θMin)/(θMax-θMin)/.vals)

rad=1;
ParametricPlot3D[{Abs[rad]Sin[θ]Cos[ϕ]
                 ,Abs[rad]Sin[θ]Sin[ϕ]
                 ,Abs[rad]Cos[θ]
                 ,GrayLevel[gray]}
          ,{θ,0,π},{ϕ,0,2π}
          ,Lighting->False
          ,Axes->False
          ,Boxed->False];

rad=1;
ParametricPlot3D[{Abs[rad]Sin[θ]Cos[ϕ]
                 ,Abs[rad]Sin[θ]Sin[ϕ]
                 ,Abs[rad]Cos[θ]
                 ,Hue[(1-gray)/1.2]}
          ,{θ,0,π},{ϕ,0,2π}
          ,Lighting->False
          ,Axes->False
          ,Boxed->False];