+
Separation of Variables in Spherical Coordinates
Developed by Jordan McDonnell  Published July 16, 2016
This set of exercises will guide the student through solving Laplace's equation for the electric potential in spherical coordinates via separation of variables. They will perform numerical integration and produce plots of the electric potential for situations with nontrivial boundary conditions.
Subject Areas  Electricity & Magnetism and Mathematical/Numerical Methods 

Level  Beyond the First Year 
Available Implementation  IPython/Jupyter Notebook 
Learning Objectives 
Students who complete this set of exercises will
 be able to use separation of variables to solve Laplace's equation in spherical coordinates for a boundary sphere with given potential (**Exercise 1**),
 be able to use separation of variables to solve Laplace's equation in spherical coordinates for a boundary sphere with given surface charge density (**Exercise 2**),
 gain familiarity with the Legendre polynomials and their usefulness in physical problems (**Exercises 1 and 2**),
 be able to supplement an analytical solution with numerical methods, such as numerical integration (**Exercises 1 and 2**),
 and be able to produce and analyze visualizations for the electric potential (**Exercises 1 and 2**).

Time to Complete  90 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
### Exercise 1: A Sphere with Given Potential
Consider a sphere of radius $R$. On the surface of this sphere, a potential $V_0(\theta)$ will be specified.
1. Solve Laplace's equation in spherical coordinates. Remember that the series solution will have one form inside the sphere, and a different form outside the sphere.
2. Set up a numerical integral to find the coefficients $A_\ell$ and $B_\ell$ in terms of the surface potential $V_0(\theta)$.
3. Produce a plot of $V(r, \theta)$ for all $r$ and $\theta$, for each of the following surface potentials $V_0(\theta)$:
 $V_0(\theta) = \cos\theta$. **Note**: This case can be solved exactly as a convenient check.
 $V_0(\theta) = \sqrt{\cos\frac{\theta}{2}}$.
 $V_0(\theta) = \theta^2$.
### Exercise 2: A Sphere with Given Surface Charge Density
Consider a sphere of radius $R$. On the surface of this sphere, a *surface charge density* $\sigma_0(\theta)$ will be specified.
1. Solve Laplace's equation in spherical coordinates. Remember that the series solution will have one form inside the sphere, and a different form outside the sphere. Due to the charge on the surface of the sphere, the boundary condition at $r=R$ must be handled differently.
2. Set up a numerical integral to find the undetermined coefficients in terms of the surface charge density $\sigma_0(\theta)$.
3. Produce a plot of $V(r, \theta)$ for all $r$ and $\theta$, for each of the following surface charge densities $\sigma_0(\theta)$:
 $\sigma_0(\theta) = \cos\theta$. **Note**: Again, this case can be solved exactly as a convenient check.
 $\sigma_0(\theta) = \cos^3 \theta$. **Note**: This case can also be solved by hand.
 $\sigma_0(\theta) = \cosh(\cos\theta)$.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Jordan McDonnell, "Separation of Variables in Spherical Coordinates," Published in the PICUP Collection, July 2016.
The instructor materials are ©2016 Jordan McDonnell.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license