(************** Content-type: application/mathematica ************** CreatedBy='Mathematica 5.2' Mathematica-Compatible Notebook This notebook can be used with any Mathematica-compatible application, such as Mathematica, MathReader or Publicon. The data for the notebook starts with the line containing stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. *******************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 7651, 270]*) (*NotebookOutlinePosition[ 8356, 294]*) (* CellTagsIndexPosition[ 8312, 290]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Variational Solution to the Dirichlet BVP for Possion's Equation in \ Cylindrical Coordinates given in Chapter 1 of Jackson. \ \>", "Section"], Cell[CellGroupData[{ Cell["Variational Approximation", "Subsection"], Cell[TextData[{ "We want to solve the Poisson equation ", Cell[BoxData[ \(TraditionalForm\`\[EmptyDownTriangle]\^2\)]], "\[Phi] = -g[r] in cylindrical coordinates subject to the Dirichlet \ boundary condition \[Phi][1] = 0. As a first step, we set up a variational \ function \[Phi][r,a,b,c] that has a polynomial dependence on r and vanishes \ at r=1. Since the electric field must vanish at r=0 for a cylindrically \ symmetric charge distribution (by Gauss's law), we also must require ", Cell[BoxData[ \(TraditionalForm\`d\[Phi]\/dr\)]], "=0 at r=0. To achieve this, we omit the linear term in the polynomial. \ Here is our ansatz for the potential." }], "Text"], Cell[BoxData[ \(\[Phi][r_] = \ a\ r^2\ + b\ r^3\ + \ c\ r^4\ - \((a + b + c)\)\)], "Input", CellLabel->"In[2]:="], Cell["\<\ As a second step, we evaluate the gradient term that occurs in the action \ integral\ \>", "Text"], Cell[BoxData[ \(d\[Phi][x_]\ = \ \ D[\[Phi][x], x]\)], "Input", CellLabel->"In[3]:="], Cell["Now, we form the first part of the \"action\" integral", "Text"], Cell[BoxData[ \(kin = \ Integrate[r\ d\[Phi][r]^2/2, {r, 0, 1}]\)], "Input", CellLabel->"In[5]:="], Cell[TextData[{ "Next, we form the second term in the action integral. In the equation \ below, we adopt the notation\n en = ", Cell[BoxData[ \(TraditionalForm\`\[Integral]g[ r]\ \((r\^n - 1)\)\ r \[DifferentialD]r\)]], "." }], "Text"], Cell[BoxData[ \(pot\ = \ a\ e2\ + \ b\ e3\ + \ c\ e4\)], "Input", CellLabel->"In[6]:="], Cell["Here is the complete action integral", "Text"], Cell[BoxData[ \(S\ = \ kin - pot\)], "Input", CellLabel->"In[7]:="], Cell["Now find the derivatives of S with respect to a, b, and c.", "Text"], Cell[BoxData[ \(da\ = \ D[S, a]\)], "Input", CellLabel->"In[8]:="], Cell[BoxData[ \(db\ = \ D[S, b]\)], "Input", CellLabel->"In[9]:="], Cell[BoxData[ \(dc\ = \ D[S, c]\)], "Input", CellLabel->"In[10]:="], Cell["\<\ Now, we solve the system of equations dS/da =0, dS/db=0, dS/dc=0.\ \>", "Text"], Cell[BoxData[ \(Solve[{da \[Equal] 0, db \[Equal] 0, dc \[Equal] 0}, {a, b, c}] // First\)], "Input", CellLabel->"In[11]:="], Cell[BoxData[ \(a\ = \ a /. \ %\)], "Input", CellLabel->"In[12]:="], Cell[BoxData[ \(b\ = \ b /. \ %%\)], "Input", CellLabel->"In[13]:="], Cell[BoxData[ \(c\ \ = \ c\ /. \ %%%\)], "Input", CellLabel->"In[14]:="], Cell["\<\ Now, lets examine the solution with a specific choice for the inhomogeneous \ term g[r]\ \>", "Text"], Cell[BoxData[ \(g[r_] = \ \(-5\) \((1 - r)\)\ + \ 10^4\ r^5\ \((1 - r)\)^5\)], "Input",\ CellLabel->"In[15]:="], Cell["With this choice, we can evaluate e2, e3, e4 explicitly", "Text"], Cell[BoxData[ \(e2 = \ Integrate[\((r^2 - 1)\) r\ g[r], {r, 0, 1}]\)], "Input", CellLabel->"In[16]:="], Cell[BoxData[ \(e3 = \ Integrate[\((r^3 - 1)\) r\ g[r], {r, 0, 1}]\)], "Input", CellLabel->"In[17]:="], Cell[BoxData[ \(e4 = \ Integrate[\((r^4 - 1)\) r\ g[r], {r, 0, 1}]\)], "Input", CellLabel->"In[18]:="], Cell["\<\ What is the final result for \[Phi][r]?\ \>", "Text"], Cell[BoxData[ \(\[Phi][r]\)], "Input", CellLabel->"In[19]:="], Cell["\<\ Let's take a look! In the figure below, \[Phi][r] is in red and g[r]/20 is \ in cyan.\ \>", "Text"], Cell[BoxData[ \(Plot[{\[Phi][r], g[r]/20}, {r, 0, 1}, PlotRange -> {\(-0.3\), 0.7}, PlotStyle \[Rule] \ {{Thickness[0.007], RGBColor[1, 0, 0]}, {Thickness[0.01], RGBColor[0, 1, 1]}}]\)], "Input", CellLabel->"In[20]:="] }, Open ]], Cell[CellGroupData[{ Cell["Exact Answer", "Subsection"], Cell[TextData[{ "In this case, we can easily determine the exact answer \[Psi][r] by \ solving the radial dfferential equation\n ", Cell[BoxData[ \(TraditionalForm\`1\/r\)]], Cell[BoxData[ \(TraditionalForm\`d\/dr\)]], "r ", Cell[BoxData[ \(TraditionalForm\`d\[Psi]\/dr\)]], "= -g[r] \n subject to boundary conditions ", Cell[BoxData[ \(TraditionalForm\`d\[Psi]\/dr\)]], "[0] = 0 and \[Psi][1] = 0. A first integral gives \[Psi]' = ", Cell[BoxData[ \(TraditionalForm\`d\[Psi]\/dr\)]] }], "Text"], Cell[BoxData[ \(\(\[Psi]'\)[ r_]\ = \ \(-Expand[Integrate[x\ g[x], {x, 0, r}]/r]\)\)], "Input", CellLabel->"In[21]:="], Cell["A second integral gives \[Psi][r]", "Text"], Cell[BoxData[ \(\[Psi][r_]\ = \ Integrate[\(\[Psi]'\)[x], {x, 1, r}]\)], "Input", CellLabel->"In[22]:="], Cell["Are the boundary conditions satisfied?", "Text"], Cell[BoxData[ \(\[Psi][1]\)], "Input", CellLabel->"In[23]:="], Cell[BoxData[ \(D[\[Psi][r], r]\ /. \ r \[Rule] \ 0\)], "Input", CellLabel->"In[24]:="], Cell["\<\ Let's compare the exact solution (black) with the vatiational approximation \ (red)\ \>", "Text"], Cell[BoxData[ \(Plot[{\[Psi][r], \[Phi][r], g[r]/20}, {r, 0, 1}, PlotRange -> {\(-0.3\), 0.7}, PlotStyle \[Rule] \ {{Thickness[0.007], RGBColor[0, 0, 0]}, {Thickness[0.007], RGBColor[1, 0, 0]}, {Thickness[0.01], RGBColor[0, 1, 1]}}]\)], "Input", CellLabel->"In[25]:="], Cell["\<\ Let's now take a look at the difference between the \[Phi][r] and \[Psi][r]\ \>", "Text"], Cell[BoxData[ \(Plot[\((\[Phi][r] - \[Psi][r])\), {r, 0, 1}, PlotRange \[Rule] \ {\(-0.015\), 0.015}, PlotStyle \[Rule] {Thickness[0.01], Hue[0.94]}]\)], "Input"], Cell[BoxData[ RowBox[{ StyleBox[\(Clear["\<`*\>"]\), "MR"], " "}]], "Input", CellLabel->"In[26]:="] }, Open ]] }, Open ]] }, FrontEndVersion->"5.2 for Microsoft Windows", ScreenRectangle->{{0, 1024}, {0, 685}}, WindowSize->{874, 615}, WindowMargins->{{24, Automatic}, {Automatic, -5}}, Magnification->1.5, StyleDefinitions -> "ArticleModern.nb" ] (******************************************************************* Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. *******************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[1776, 53, 152, 3, 162, "Section"], Cell[CellGroupData[{ Cell[1953, 60, 47, 0, 80, "Subsection"], Cell[2003, 62, 689, 13, 147, "Text"], Cell[2695, 77, 129, 3, 64, "Input"], Cell[2827, 82, 108, 3, 38, "Text"], Cell[2938, 87, 92, 2, 64, "Input"], Cell[3033, 91, 70, 0, 38, "Text"], Cell[3106, 93, 104, 2, 64, "Input"], Cell[3213, 97, 259, 7, 64, "Text"], Cell[3475, 106, 96, 2, 64, "Input"], Cell[3574, 110, 52, 0, 38, "Text"], Cell[3629, 112, 74, 2, 64, "Input"], Cell[3706, 116, 74, 0, 38, "Text"], Cell[3783, 118, 73, 2, 64, "Input"], Cell[3859, 122, 73, 2, 64, "Input"], Cell[3935, 126, 74, 2, 64, "Input"], Cell[4012, 130, 89, 2, 38, "Text"], Cell[4104, 134, 137, 3, 64, "Input"], Cell[4244, 139, 74, 2, 64, "Input"], Cell[4321, 143, 75, 2, 64, "Input"], Cell[4399, 147, 80, 2, 64, "Input"], Cell[4482, 151, 111, 3, 38, "Text"], Cell[4596, 156, 119, 3, 64, "Input"], Cell[4718, 161, 71, 0, 38, "Text"], Cell[4792, 163, 108, 2, 64, "Input"], Cell[4903, 167, 108, 2, 64, "Input"], Cell[5014, 171, 108, 2, 64, "Input"], Cell[5125, 175, 63, 2, 38, "Text"], Cell[5191, 179, 67, 2, 64, "Input"], Cell[5261, 183, 110, 3, 38, "Text"], Cell[5374, 188, 257, 5, 116, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[5668, 198, 34, 0, 80, "Subsection"], Cell[5705, 200, 545, 16, 100, "Text"], Cell[6253, 218, 133, 3, 64, "Input"], Cell[6389, 223, 49, 0, 38, "Text"], Cell[6441, 225, 111, 2, 64, "Input"], Cell[6555, 229, 54, 0, 38, "Text"], Cell[6612, 231, 67, 2, 64, "Input"], Cell[6682, 235, 94, 2, 64, "Input"], Cell[6779, 239, 107, 3, 38, "Text"], Cell[6889, 244, 327, 7, 142, "Input"], Cell[7219, 253, 99, 2, 38, "Text"], Cell[7321, 257, 180, 3, 90, "Input"], Cell[7504, 262, 119, 4, 64, "Input"] }, Open ]] }, Open ]] } ] *) (******************************************************************* End of Mathematica Notebook file. *******************************************************************)