(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 4.0, MathReader 4.0, or any compatible application. 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[ 27847, 1071]*) (*NotebookOutlinePosition[ 28580, 1097]*) (* CellTagsIndexPosition[ 28536, 1093]*) (*WindowFrame->Normal*) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Calculation and conversion of hydrogen atom wavefunctions and properties Michael A. Morrison Notebook prepared for Eric Abraham et al. May 31, 2000: Version 1.0 \ \>", "Subsubtitle", FontSlant->"Plain"], Cell[TextData[{ StyleBox["Introduction", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox[":", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], "\n", StyleBox["This notebook illustrates the use of some of the commands in the \ package ", FontColor->RGBColor[0, 0, 1]], StyleBox["HydrogenicAtom.m", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox[" and associated Standard ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[" packages which are useful in atomic physics. These packages will \ be used for test calculations in our study of perturbation theory energy \ shifts to hyperfine levels of Rb and Cs resulting from a detuned external \ monochromatic electromagnetic field. It also illustrates the simplest form of \ programming in ", FontColor->RGBColor[0, 0, 1]], StyleBox["Mathematica", FontSlant->"Italic", FontColor->RGBColor[0, 0, 1]], StyleBox[": constructing a ", FontColor->RGBColor[0, 0, 1]], StyleBox["Module", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]] }], "Text"], Cell[CellGroupData[{ Cell["BookKeeping", "Subsection"], Cell[BoxData[ \(ClearAll["\"]\)], "Input"], Cell[CellGroupData[{ Cell[TextData[{ "Load ", StyleBox["Mathematica", FontSlant->"Italic"], " standard packages" }], "Subsubsection"], Cell[TextData[{ StyleBox["Note: ", FontWeight->"Bold"], "\nFor illustrative purposes, I will load, then illustrate each package one \ at a time. Ordinarily, you should load all packages you will need later in \ the notebook in the ", StyleBox["BookKeeping", FontColor->RGBColor[1, 0, 0]], " section. If, as you work, you discover that you need another package, go \ ahead and load it where you are working, but when you revise the notebook \ move the ", StyleBox["Needs", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " command to the ", StyleBox["BookKeeping", FontColor->RGBColor[1, 0, 0]], " section." }], "Text", FontColor->RGBColor[0, 0, 1]], Cell[TextData[StyleBox["To calculate values of physical constants:", FontColor->RGBColor[1, 0, 0]]], "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(BohrRadius\)], "Input"], Cell[BoxData[ \(5.29177249`*^-11\ Meter\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(ElectronMass\)], "Input"], Cell[BoxData[ \(9.1093897`*^-31\ Kilogram\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(SpeedOfLight\)], "Input"], Cell[BoxData[ \(\(299792458\ Meter\)\/Second\)], "Output"] }, Open ]], Cell[TextData[StyleBox["To convert between different systems of units:", FontColor->RGBColor[1, 0, 0]]], "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[ElectronMass, \ Gram]\)], "Input"], Cell[BoxData[ \(9.109389699999998`*^-28\ Gram\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[BohrRadius, Fermi]\)], "Input"], Cell[BoxData[ \(52917.7249`\ Fermi\)], "Output"] }, Open ]], Cell[TextData[StyleBox["To obtain information about the chemical elements:", FontColor->RGBColor[1, 0, 0]]], "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(AtomicNumber[Hydrogen]\)], "Input"], Cell[BoxData[ \(1\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Abbreviation[Helium]\)], "Input"], Cell[BoxData[ \("He"\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(AtomicWeight[Helium]\)], "Input"], Cell[BoxData[ \(4.002602`\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(ElectronConfiguration[Rb]\)], "Input"], Cell[BoxData[ \({{2}, {2, 6}, {2, 6, 10}, {2, 6}, {1}}\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(ElectronConfigurationFormat[Rb]\)], "Input"], Cell[BoxData[ InterpretationBox[ RowBox[{"\<\"1\"\>", "\[InvisibleSpace]", "\<\"s\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^2\), Superscript[ 2], Editable->False], "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "\<\"2\"\>", "\[InvisibleSpace]", "\<\"s\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^2\), Superscript[ 2], Editable->False], "\[InvisibleSpace]", "\<\"2\"\>", "\[InvisibleSpace]", "\<\"p\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^6\), Superscript[ 6], Editable->False], "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "\<\"3\"\>", "\[InvisibleSpace]", "\<\"s\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^2\), Superscript[ 2], Editable->False], "\[InvisibleSpace]", "\<\"3\"\>", "\[InvisibleSpace]", "\<\"p\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^6\), Superscript[ 6], Editable->False], "\[InvisibleSpace]", "\<\"3\"\>", "\[InvisibleSpace]", "\<\"d\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^10\), Superscript[ 10], Editable->False], "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "\<\"4\"\>", "\[InvisibleSpace]", "\<\"s\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^2\), Superscript[ 2], Editable->False], "\[InvisibleSpace]", "\<\"4\"\>", "\[InvisibleSpace]", "\<\"p\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^6\), Superscript[ 6], Editable->False], "\[InvisibleSpace]", "\<\" \"\>", "\[InvisibleSpace]", "\<\"5\"\>", "\[InvisibleSpace]", "\<\"s\"\>", "\[InvisibleSpace]", InterpretationBox[\(\[Null]\^1\), Superscript[ 1], Editable->False]}], SequenceForm[ "1", "s", Superscript[ 2], " ", "2", "s", Superscript[ 2], "2", "p", Superscript[ 6], " ", "3", "s", Superscript[ 2], "3", "p", Superscript[ 6], "3", "d", Superscript[ 10], " ", "4", "s", Superscript[ 2], "4", "p", Superscript[ 6], " ", "5", "s", Superscript[ 1]], Editable->False]], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(StableIsotopes[Rb]\)], "Input"], Cell[BoxData[ \({85}\)], "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Load ", StyleBox["HydrogenicAtom.m", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], ", my package for generating hydrogen atom wave functions and properties" }], "Subsubsection"], Cell[TextData[{ StyleBox["Note:", FontWeight->"Bold", FontColor->RGBColor[0, 0, 1]], StyleBox["\nThe package ", FontColor->RGBColor[0, 0, 1]], StyleBox["HydrogenicAtom.m", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox[" must either be in the directory that contains the notebook \ you're using or in a directory that is on your ", FontColor->RGBColor[0, 0, 1]], StyleBox["$Path", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox[". See Tip Sheets for ways to set up ", FontColor->RGBColor[0, 0, 1]], StyleBox["$Path", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox[" most conveniently.", FontColor->RGBColor[0, 0, 1]] }], "Text"], Cell[BoxData[ \(Needs["\"]\)], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(\(?HydrogenicAtom\)\)], "Input"], Cell[BoxData[ \("HydrogenicAtom.m is a package for calculating normalized radial \ function R_{n,l}(r) for the hydrogenic atom. This package uses the \ conventions of Merzbacher, Messiah, etc. to conform to Mathematica's \ definition of the associated Laguerre polynomials. The first Bohr radius a0 \ appears in wave functions, energies, and expectation values; to get rid of \ it, set a0->1. See also the command atomicUnits. To get a list of commands in \ this package, type ?HydrogenicAtom`*."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?HydrogenicAtom`*\)\)], "Input"], Cell["\<\ a0 eH l ml PhiFn \ radFnH ThetaFn uncrH AbsYlmSq HydrogenicAtom meanrH momRadFnH protected \ radFnHrho uFnH Y atomicUnits jH meanrsqH n psiH \ rctpH uncpH Z\ \>", "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?a0\)\)], "Input"], Cell[BoxData[ \("a0 is the first Bohr radius for atomic hydrogen."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?PhiFn\)\)], "Input"], Cell[BoxData[ \("PhiFn[ml][\[Phi]] is the normalized \[Phi] function in the spherical \ harmonic."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?Y\)\)], "Input"], Cell[BoxData[ \("Y[l,ml][theta,phi] is the spherical harmonic."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?Z\)\)], "Input"], Cell[BoxData[ \("Z is the nuclear charge in atomic units. The default value for Z=1, \ atomic hydrogen. If you don't want the default, feed the symbol Z or some \ value as the final argument in the function being calculated."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?uncrH\)\)], "Input"], Cell[BoxData[ \("uncrH[n,l,Z] is the position uncertainty (standard deviation) in Bohr) \ in an (n,l) stationary state. The default value for Z=1, atomic \ hydrogen."\)], "Print"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell["Generate radial functions, energies, and mean radii", "Subsection"], Cell[TextData[{ "Define a command that generates the reduced radial function for a given ", Cell[BoxData[ \(TraditionalForm\`\(\(\(|\)\(n\ \[ScriptL]\)\)\(\[RightAngleBracket]\)\ \)\)]], " state in the position representation:" }], "Text"], Cell[BoxData[{ \(Clear[radialFunction]\), "\[IndentingNewLine]", \(radialFunction[n_, \[ScriptL]_] := \ \(uFnH[n, \[ScriptL]]\)[ r]\)}], "Input"], Cell[CellGroupData[{ Cell[BoxData[ \(radialFunction[5, 4]\)], "Input"], Cell[BoxData[ \(\(2\ \@\(2\/35\)\ \((1\/a0)\)\^\(11/2\)\ \[ExponentialE]\^\(-\(r\/\(5\ \ a0\)\)\)\ r\^5\)\/140625\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(uFnH[5, 4]\)[r]\)], "Input"], Cell[BoxData[ \(\(2\ \@\(2\/35\)\ \((1\/a0)\)\^\(11/2\)\ \[ExponentialE]\^\(-\(r\/\(5\ \ a0\)\)\)\ r\^5\)\/140625\)], "Output"] }, Open ]], Cell["\<\ (I checked these and many other cases against tables in the literature during \ package development.)\ \>", "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?atomicUnits\)\)], "Input"], Cell[BoxData[ \("atomicUnits is a list of replacement rules that converts an expression \ written in terms of hbar, me, e, a0, Eh, and/or Ry to atomic units."\)], \ "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(radialFunction[5, 4]\ /. \ atomicUnits\)], "Input"], Cell[BoxData[ \(\(2\ \@\(2\/35\)\ \[ExponentialE]\^\(\(-r\)/5\)\ r\^5\)\/140625\)], \ "Output"] }, Open ]], Cell[TextData[{ "Calculate the energy of the ", Cell[BoxData[ \(TraditionalForm\`\((n\ = \ 5)\)\)]], " manifold:" }], "Text", FontColor->RGBColor[1, 0, 0]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?eH\)\)], "Input"], Cell[BoxData[ \("eH[n,Z] is the hydrogenic atom energy in Hartree. The default value \ for Z=1, atomic hydrogen."\)], "Print"] }, Open ]], Cell["\<\ Note that since the default value is what we want, we don't have to specify \ the second argument:\ \>", "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \({eH[5], eH[5, 1], \ eH[5, 2]}\)], "Input"], Cell[BoxData[ \({\(-\(1\/50\)\), \(-\(1\/50\)\), \(-\(2\/25\)\)}\)], "Output"] }, Open ]], Cell[TextData[{ "To get a decimal number, we must feed the energy into the command ", StyleBox["N", FontColor->RGBColor[1, 0, 0]] }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(eH[5] // N\)], "Input"], Cell[BoxData[ \(\(-0.02`\)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[\((2\ eH[5] // N)\)\ Rydberg, ElectronVolt]\)], "Input"], Cell[BoxData[ \(\(-0.5442343888363469`\)\ ElectronVolt\)], "Output"] }, Open ]], Cell["\<\ Note: To convert to eV we had to multiply the energy, which by default is in \ Hartree, by 2 to get it into Rydberg, since the Units` package doesn't \ recognize the unit Hartree.\ \>", "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(n2EnergyeV\ = \ Convert[\((2\ eH[1] // N)\)\ Rydberg, ElectronVolt]\)], "Input"], Cell[BoxData[ \(\(-13.605859720908672`\)\ ElectronVolt\)], "Output"] }, Open ]], Cell[TextData[{ "Generate one of the Hamiltonian eigenfunctions ", Cell[BoxData[ \(TraditionalForm\`\(\[Psi]\_n\[ScriptL]\)(r, \[Theta], \[Phi])\)]], " for the ", Cell[BoxData[ \(TraditionalForm\`\((n, \[ScriptL])\)\ = \ \((5, 4)\)\)]], " level:" }], "Text", FontColor->RGBColor[1, 0, 0]], Cell[CellGroupData[{ Cell[BoxData[ \(\(psiH[5, 4, 3]\)[r, \[Theta], \[Phi]]\)], "Input"], Cell[BoxData[ \(\(-\(\(\((1\/a0)\)\^\(11/2\)\ \[ExponentialE]\^\(\(-\(r\/\(5\ a0\)\)\) \ + 3\ \[ImaginaryI]\ \[Phi]\)\ r\^4\ Cos[\[Theta]]\ \ Sin[\[Theta]]\^3\)\/\(93750\ \@\(2\ \[Pi]\)\)\)\)\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(psiH[5, 4, 3]\)[r, \[Theta], \[Phi]]\ /. \ atomicUnits\)], "Input"], Cell[BoxData[ \(\(-\(\(\[ExponentialE]\^\(\(-\(r\/5\)\) + 3\ \[ImaginaryI]\ \[Phi]\)\ r\ \^4\ Cos[\[Theta]]\ Sin[\[Theta]]\^3\)\/\(93750\ \@\(2\ \[Pi]\)\)\)\)\)], \ "Output"] }, Open ]], Cell[TextData[{ "Calculate the mean radius of the ", Cell[BoxData[ \(TraditionalForm\`\((n, \[ScriptL])\)\ = \ \((5, 4)\)\)]], " level and convert the results to Angstroms, then to Meters:" }], "Text", FontColor->RGBColor[1, 0, 0]], Cell[CellGroupData[{ Cell[BoxData[ \(meanrH[5, 4]\ // N\)], "Input"], Cell[BoxData[ \(27.5`\ a0\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[\((meanrH[5, 4]\ // N)\)\ Bohr, \ Angstrom]\)], "Input"], Cell[BoxData[ \(Convert::"incomp" \(\(:\)\(\ \)\) "Incompatible units in \!\(27.5`\\ a0\\ Bohr\) and \!\(Angstrom\)."\)], \ "Message"], Cell[BoxData[ \(27.5`\ a0\ Bohr\)], "Output"] }, Open ]], Cell[TextData[{ StyleBox["Convert", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " doesn't recognize the unit Bohr, so we must do the conversion to Angstrom \ \"by hand\"" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(BohrRadius\)], "Input"], Cell[BoxData[ \(5.29177249`*^-11\ Meter\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(meanr54\ = \ \((meanrH[5, 4] /. atomicUnits)\)\ *\ BohrRadius\)], "Input"], Cell[BoxData[ \(1.45523743475`*^-9\ Meter\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[meanr54, \ Angstrom]\)], "Input"], Cell[BoxData[ \(14.5523743475`\ Angstrom\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell["Calculate the classical turning points for the 5g orbital", \ "Subsubsection"], Cell[CellGroupData[{ Cell[BoxData[ \(rctpH[5, 4]\)], "Input"], Cell[BoxData[ \({5\ \((5 - \@5)\)\ a0, 5\ \((5 + \@5)\)\ a0}\)], "Output"] }, Open ]], Cell[TextData[{ "There are two classical turning points, so the command ", StyleBox["rctpH", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " returns a list of two values" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(rctpH[5, 4] // N\)], "Input"], Cell[BoxData[ \({13.819660112501051`\ a0, 36.180339887498945`\ a0}\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\((rctpH[5, 4] /. atomicUnits // N)\)*BohrRadius\)], "Input"], Cell[BoxData[ \({7.313049720448337`*^-10\ Meter, 1.914581272955166`*^-9\ Meter}\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\((\((rctpH[5, 4] /. atomicUnits // N)\)* BohrRadius)\)[\([1]\)]\)], "Input"], Cell[BoxData[ \(7.313049720448337`*^-10\ Meter\)], "Output"] }, Open ]], Cell[TextData[{ StyleBox["Convert", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " only accepts one argument at a time, so we must extract each value from \ the returned list and feed it into ", StyleBox["Convert", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], "." }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[\((\((rctpH[5, 4] /. atomicUnits // N)\)* BohrRadius)\)[\([1]\)], \ Angstrom]\)], "Input"], Cell[BoxData[ \(7.313049720448337`\ Angstrom\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(Convert[\((\((rctpH[5, 4] /. atomicUnits // N)\)* BohrRadius)\)[\([2]\)], \ Angstrom]\)], "Input"], Cell[BoxData[ \(19.145812729551658`\ Angstrom\)], "Output"] }, Open ]], Cell["\<\ Showing off: Evaluate the mean radius of the 1100 p Rydberg state of atomic \ hydrogen:\ \>", "Text", FontColor->RGBColor[1, 0, 0]], Cell[CellGroupData[{ Cell[BoxData[ \(\(\(meanrH[1100, 1]\)\(\ \)\)\)], "Input"], Cell[BoxData[ \(1814999\ a0\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(meanrH[1100, 1]\ /. a0 \[Rule] 1*BohrRadius\ // ScientificForm[#] &\)], "Input"], Cell[BoxData[ TagBox[ RowBox[{ RowBox[{"(", InterpretationBox[\("9.60456"\[Times]10\^"-5"\), .000096045617775775095, AutoDelete->True], ")"}], " ", "Meter"}], ScientificForm]], "Output"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[TextData[{ "Write a command to calculate the uncertainty in the radial position in a \ particular ", Cell[BoxData[ \(TraditionalForm\`\(\((n, \[ScriptL])\)\(\ \)\)\)]], "state" }], "Subsection"], Cell[TextData[{ StyleBox["Description of the calculation:", FontWeight->"Bold"], "\nThe radial position uncertainty is calculated from the wave function ", Cell[BoxData[ \(TraditionalForm\`\(\[Psi]\_\(n\[ThinSpace]\[ScriptL]\[ThinSpace]m\_\ \[ScriptL]\)\)(r, \[Theta], \[Phi])\)]], " as\n\t\t\t\t", Cell[BoxData[ \(TraditionalForm\`\[CapitalDelta]r\ = \ \@\(\[LeftAngleBracket]r\^2\ \[RightAngleBracket]\ - \ \[LeftAngleBracket]r\[RightAngleBracket]\^2\)\)]], "\nwhere ", Cell[BoxData[ \(TraditionalForm\`\[LeftAngleBracket]r\[RightAngleBracket]\)]], " is the mean radial position, which the command ", StyleBox["meanrH ", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], StyleBox["generates. I want to write this command so that it will work not \ only for hydrogenic systems but also for other analytic wave functions. See \ accopanying notes of 6/1/00 for details", FontVariations->{"CompatibilityType"->0}] }], "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?radialFunction\)\)], "Input"], Cell[BoxData[ \("Global`radialFunction"\)], "Print"], Cell[BoxData[ InterpretationBox[GridBox[{ {GridBox[{ {\(radialFunction[n_, \[ScriptL]_] := \(uFnH[n, \[ScriptL]]\)[ r]\)} }, GridBaseline->{Baseline, {1, 1}}, ColumnWidths->0.999, ColumnAlignments->{Left}]} }, GridBaseline->{Baseline, {1, 1}}, ColumnAlignments->{Left}], Definition[ radialFunction], Editable->False]], "Print"] }, Open ]], Cell[TextData[{ " Note: I must use the ", StyleBox["atomicUnits ", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], "replacement rules to get rid of the constants which ", StyleBox["HydrogenicAtom.m", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " gives" }], "Text"], Cell[BoxData[{ \(Clear[uncertaintyIntegral]\), "\[IndentingNewLine]", \(uncertaintyIntegral[n_, \[ScriptL]_, p_]\ := \[IndentingNewLine]\t Integrate[ radialFunction[n, \[ScriptL]]\^2*\ r\^p /. atomicUnits, {r, 0, \[Infinity]}]\)}], "Input"], Cell["Check the case where we know the right answer:", "Text", FontColor->RGBColor[1, 0, 0]], Cell[CellGroupData[{ Cell[BoxData[ \(uncertaintyIntegral[1, 0, 1]\)], "Input"], Cell[BoxData[ \(3\/2\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?meanrH\)\)], "Input"], Cell[BoxData[ \("meanrH[n,l,Z] is the mean radius (in Bohr) in an (n,l) stationary \ state. The default value for Z=1, atomic hydrogen."\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(meanrH[1, 0]\)], "Input"], Cell[BoxData[ \(\(3\ a0\)\/2\)], "Output"] }, Open ]], Cell[TextData[{ "Make sure that the ", Cell[BoxData[ \(TraditionalForm\`p = 2\)]], " case executes:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(uncertaintyIntegral[1, 0, 2]\)], "Input"], Cell[BoxData[ \(3\)], "Output"] }, Open ]], Cell["Now define the command as described on the attached notes:", "Text"], Cell[BoxData[{ \(Clear[radialUncertainty]\), "\[IndentingNewLine]", \(radialUncertainty[ n_, \[ScriptL]_]\ := \ \[IndentingNewLine]\ \ \ Module[{meanRadius, meanRadiusSquared, uncertainty}, \[IndentingNewLine]\ meanRadius\ = \ uncertaintyIntegral[1, 0, 1]; \[IndentingNewLine]meanRadiusSquared\ = \ uncertaintyIntegral[1, 0, 2]; \[IndentingNewLine]uncertainty\ = \ \@\(\(meanRadiusSquared\)\(\ \)\(-\)\(\ \)\(meanRadius\^2\)\(\ \)\)\ \[IndentingNewLine]]\[IndentingNewLine]\ \ \ \ \ \)}], "Input"], Cell[TextData[{ StyleBox["Important Note", FontWeight->"Bold"], ":\nLocal variables defined in a ", StyleBox["Module", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " are known by name to ", StyleBox["Mathematica", FontSlant->"Italic"], " but have no value associated with them. " }], "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?meanRadiusSquared\)\)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \("Global`meanRadiusSquared"\)], "Print"] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ \(meanRadiusSquared\)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \(meanRadiusSquared\)], "Output"] }, Open ]], Cell[TextData[{ "This contrasts with a global variable defined during a session, such as ", StyleBox["n2EnergyeV", FontColor->RGBColor[1, 0, 0]], ", which we defined above" }], "Text", FontColor->RGBColor[0, 0, 1]], Cell[CellGroupData[{ Cell[BoxData[ \(\(?n2EnergyeV\)\)], "Input", FontColor->RGBColor[0, 0, 1]], Cell[BoxData[ \("Global`n2EnergyeV"\)], "Print"], Cell[BoxData[ InterpretationBox[GridBox[{ {GridBox[{ {\(n2EnergyeV = \(-13.605859720908672`\)\ ElectronVolt\)} }, GridBaseline->{Baseline, {1, 1}}, ColumnWidths->0.999, ColumnAlignments->{Left}]} }, GridBaseline->{Baseline, {1, 1}}, ColumnAlignments->{Left}], Definition[ n2EnergyeV], Editable->False]], "Print"] }, Open ]], Cell[TextData[{ "Now we test our command on a case where we know or can find the answer: \ the ", Cell[BoxData[ \(TraditionalForm\`\((n, \[ScriptL])\) = \((1, 0)\)\)]], " state of hydrogen:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(radialUncertainty[1, 0]\)], "Input"], Cell[BoxData[ \(\@3\/2\)], "Output"] }, Open ]], Cell[TextData[{ "Check my work using the command ", StyleBox["uncrH", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " in ", StyleBox["HydrogenicAtom.m", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " which evaluates ", Cell[BoxData[ \(TraditionalForm\`\((\[CapitalDelta]r)\)\_\(n\[ThinSpace]\[ScriptL]\)\)\ ]], " analytically for hydrogenic atoms:" }], "Text"], Cell[CellGroupData[{ Cell[BoxData[ \(uncrH[1, 0]\)], "Input"], Cell[BoxData[ \(\(\@3\ a0\)\/2\)], "Output"] }, Open ]], Cell[CellGroupData[{ Cell["Aside: practical programming in Mathematica", "Subsubsection"], Cell[TextData[{ "I wrote the above command to illustrate the use of ", StyleBox["Module", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], ". It's actually more complicated than is necessary for this simple \ calculation. In practice, I would probably define the intermediate command ", StyleBox["uncertaintyIntegral", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " as above, but I would just then define the function ", StyleBox["radialUncertainty", FontWeight->"Bold", FontColor->RGBColor[1, 0, 0]], " directly, as:" }], "Text"], Cell[BoxData[{ \(Clear[radialUncertainty]\), "\[IndentingNewLine]", \(radialUncertainty[ n_Integer?Positive, \[ScriptL]_Integer? NonNegative]\ := \ \[IndentingNewLine]\@\(uncertaintyIntegral[n, \ \[ScriptL], 2]\ - \ uncertaintyIntegral[n, \[ScriptL], 1]\^2\)\)}], "Input"], Cell["\<\ Note in the above that I have put in tests to \"idiot-proof\" the function \ commands:\ \>", "Text"], Cell[CellGroupData[{ Cell[BoxData[ \({radialUncertainty[1, 0], radialUncertainty[1, \(-1\)], \ radialUncertainty[0, 1]}\)], "Input"], Cell[BoxData[ \({\@3\/2, radialUncertainty[1, \(-1\)], radialUncertainty[0, 1]}\)], "Output"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] }, FrontEndVersion->"4.0 for Microsoft Windows", ScreenRectangle->{{0, 1152}, {0, 766}}, WindowSize->{992, 713}, WindowMargins->{{2, Automatic}, {Automatic, 2}}, PrintingCopies->1, PrintingPageRange->{Automatic, Automatic}, Magnification->1 ] (*********************************************************************** 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[1739, 51, 216, 7, 125, "Subsubtitle"], Cell[1958, 60, 1170, 33, 90, "Text"], Cell[CellGroupData[{ Cell[3153, 97, 33, 0, 47, "Subsection"], Cell[3189, 99, 57, 1, 30, "Input"], Cell[CellGroupData[{ Cell[3271, 104, 123, 5, 43, "Subsubsection"], Cell[3397, 111, 689, 19, 71, "Text"], Cell[4089, 132, 110, 1, 33, "Text"], Cell[4202, 135, 78, 1, 30, "Input"], Cell[CellGroupData[{ Cell[4305, 140, 43, 1, 30, "Input"], Cell[4351, 143, 57, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4445, 149, 45, 1, 30, "Input"], Cell[4493, 152, 59, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4589, 158, 45, 1, 30, "Input"], Cell[4637, 161, 62, 1, 42, "Output"] }, Open ]], Cell[4714, 165, 114, 1, 33, "Text"], Cell[4831, 168, 66, 1, 30, "Input"], Cell[CellGroupData[{ Cell[4922, 173, 62, 1, 30, "Input"], Cell[4987, 176, 63, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5087, 182, 59, 1, 30, "Input"], Cell[5149, 185, 52, 1, 29, "Output"] }, Open ]], Cell[5216, 189, 118, 1, 33, "Text"], Cell[5337, 192, 77, 1, 30, "Input"], Cell[CellGroupData[{ Cell[5439, 197, 55, 1, 30, "Input"], Cell[5497, 200, 35, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5569, 206, 53, 1, 30, "Input"], Cell[5625, 209, 38, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5700, 215, 53, 1, 30, "Input"], Cell[5756, 218, 43, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[5836, 224, 58, 1, 30, "Input"], Cell[5897, 227, 72, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[6006, 233, 64, 1, 30, "Input"], Cell[6073, 236, 2370, 53, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[8480, 294, 51, 1, 30, "Input"], Cell[8534, 297, 38, 1, 29, "Output"] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[8621, 304, 213, 6, 43, "Subsubsection"], Cell[8837, 312, 732, 22, 71, "Text"], Cell[9572, 336, 61, 1, 30, "Input"], Cell[CellGroupData[{ Cell[9658, 341, 52, 1, 30, "Input"], Cell[9713, 344, 514, 7, 82, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[10264, 356, 54, 1, 30, "Input"], Cell[10321, 359, 355, 7, 59, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[10713, 371, 40, 1, 30, "Input"], Cell[10756, 374, 83, 1, 25, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[10876, 380, 43, 1, 30, "Input"], Cell[10922, 383, 115, 2, 25, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[11074, 390, 39, 1, 30, "Input"], Cell[11116, 393, 80, 1, 25, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[11233, 399, 39, 1, 30, "Input"], Cell[11275, 402, 242, 3, 44, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[11554, 410, 43, 1, 30, "Input"], Cell[11600, 413, 183, 3, 44, "Print"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[11844, 423, 73, 0, 47, "Subsection"], Cell[11920, 425, 251, 6, 31, "Text"], Cell[12174, 433, 162, 3, 50, "Input"], Cell[CellGroupData[{ Cell[12361, 440, 53, 1, 30, "Input"], Cell[12417, 443, 131, 2, 67, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[12585, 450, 50, 1, 30, "Input"], Cell[12638, 453, 131, 2, 67, "Output"] }, Open ]], Cell[12784, 458, 157, 4, 33, "Text"], Cell[CellGroupData[{ Cell[12966, 466, 49, 1, 30, "Input"], Cell[13018, 469, 177, 3, 44, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[13232, 477, 72, 1, 30, "Input"], Cell[13307, 480, 99, 2, 67, "Output"] }, Open ]], Cell[13421, 485, 170, 6, 33, "Text"], Cell[CellGroupData[{ Cell[13616, 495, 40, 1, 30, "Input"], Cell[13659, 498, 130, 2, 25, "Print"] }, Open ]], Cell[13804, 503, 154, 4, 33, "Text"], Cell[CellGroupData[{ Cell[13983, 511, 62, 1, 30, "Input"], Cell[14048, 514, 82, 1, 42, "Output"] }, Open ]], Cell[14145, 518, 149, 4, 33, "Text"], Cell[CellGroupData[{ Cell[14319, 526, 43, 1, 30, "Input"], Cell[14365, 529, 44, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[14446, 535, 84, 1, 30, "Input"], Cell[14533, 538, 72, 1, 29, "Output"] }, Open ]], Cell[14620, 542, 235, 6, 52, "Text"], Cell[CellGroupData[{ Cell[14880, 552, 108, 2, 30, "Input"], Cell[14991, 556, 72, 1, 29, "Output"] }, Open ]], Cell[15078, 560, 313, 9, 33, "Text"], Cell[CellGroupData[{ Cell[15416, 573, 71, 1, 30, "Input"], Cell[15490, 576, 209, 3, 58, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[15736, 584, 90, 1, 30, "Input"], Cell[15829, 587, 178, 3, 53, "Output"] }, Open ]], Cell[16022, 593, 246, 6, 33, "Text"], Cell[CellGroupData[{ Cell[16293, 603, 52, 1, 30, "Input"], Cell[16348, 606, 43, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[16428, 612, 85, 1, 30, "Input"], Cell[16516, 615, 145, 3, 24, "Message"], Cell[16664, 620, 49, 1, 29, "Output"] }, Open ]], Cell[16728, 624, 201, 6, 33, "Text"], Cell[CellGroupData[{ Cell[16954, 634, 43, 1, 30, "Input"], Cell[17000, 637, 57, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[17094, 643, 104, 2, 30, "Input"], Cell[17201, 647, 59, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[17297, 653, 61, 1, 30, "Input"], Cell[17361, 656, 58, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[17456, 662, 84, 1, 43, "Subsubsection"], Cell[CellGroupData[{ Cell[17565, 667, 44, 1, 30, "Input"], Cell[17612, 670, 78, 1, 32, "Output"] }, Open ]], Cell[17705, 674, 201, 6, 33, "Text"], Cell[CellGroupData[{ Cell[17931, 684, 49, 1, 30, "Input"], Cell[17983, 687, 84, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[18104, 693, 81, 1, 30, "Input"], Cell[18188, 696, 104, 2, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[18329, 703, 107, 2, 30, "Input"], Cell[18439, 707, 64, 1, 29, "Output"] }, Open ]], Cell[18518, 711, 311, 10, 33, "Text"], Cell[CellGroupData[{ Cell[18854, 725, 130, 2, 30, "Input"], Cell[18987, 729, 62, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[19086, 735, 130, 2, 30, "Input"], Cell[19219, 739, 63, 1, 29, "Output"] }, Open ]], Cell[19297, 743, 143, 4, 33, "Text"], Cell[CellGroupData[{ Cell[19465, 751, 62, 1, 30, "Input"], Cell[19530, 754, 45, 1, 29, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[19612, 760, 109, 2, 30, "Input"], Cell[19724, 764, 245, 7, 43, "Output"] }, Open ]] }, Open ]] }, Open ]], Cell[CellGroupData[{ Cell[20030, 778, 211, 6, 47, "Subsection"], Cell[20244, 786, 1012, 23, 100, "Text"], Cell[CellGroupData[{ Cell[21281, 813, 52, 1, 30, "Input"], Cell[21336, 816, 56, 1, 25, "Print"], Cell[21395, 819, 475, 13, 25, "Print"] }, Open ]], Cell[21885, 835, 300, 10, 33, "Text"], Cell[22188, 847, 275, 5, 71, "Input"], Cell[22466, 854, 94, 1, 31, "Text"], Cell[CellGroupData[{ Cell[22585, 859, 61, 1, 30, "Input"], Cell[22649, 862, 38, 1, 42, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[22724, 868, 44, 1, 30, "Input"], Cell[22771, 871, 153, 2, 25, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[22961, 878, 45, 1, 30, "Input"], Cell[23009, 881, 46, 1, 42, "Output"] }, Open ]], Cell[23070, 885, 124, 5, 33, "Text"], Cell[CellGroupData[{ Cell[23219, 894, 61, 1, 30, "Input"], Cell[23283, 897, 35, 1, 29, "Output"] }, Open ]], Cell[23333, 901, 74, 0, 33, "Text"], Cell[23410, 903, 586, 11, 175, "Input"], Cell[23999, 916, 357, 12, 52, "Text"], Cell[CellGroupData[{ Cell[24381, 932, 87, 2, 30, "Input"], Cell[24471, 936, 59, 1, 25, "Print"] }, Open ]], Cell[CellGroupData[{ Cell[24567, 942, 82, 2, 30, "Input"], Cell[24652, 946, 51, 1, 29, "Output"] }, Open ]], Cell[24718, 950, 226, 6, 33, "Text"], Cell[CellGroupData[{ Cell[24969, 960, 80, 2, 30, "Input"], Cell[25052, 964, 52, 1, 25, "Print"], Cell[25107, 967, 438, 12, 25, "Print"] }, Open ]], Cell[25560, 982, 214, 6, 33, "Text"], Cell[CellGroupData[{ Cell[25799, 992, 56, 1, 30, "Input"], Cell[25858, 995, 40, 1, 47, "Output"] }, Open ]], Cell[25913, 999, 407, 14, 33, "Text"], Cell[CellGroupData[{ Cell[26345, 1017, 44, 1, 30, "Input"], Cell[26392, 1020, 48, 1, 47, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[26477, 1026, 68, 0, 43, "Subsubsection"], Cell[26548, 1028, 576, 15, 52, "Text"], Cell[27127, 1045, 301, 5, 73, "Input"], Cell[27431, 1052, 110, 3, 33, "Text"], Cell[CellGroupData[{ Cell[27566, 1059, 122, 2, 30, "Input"], Cell[27691, 1063, 104, 2, 47, "Output"] }, Open ]] }, Open ]] }, Open ]] }, Open ]] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)