.. include:: macros.rst Spherical Harmonics and the Schrodinger Equation ------------------------------------------------ In spherical coordinates the time-independent Schrodinger equation is .. math:: \label{eq:tisespherical} \begin{split} - \frac{\hbar^2}{2m} \frac{1}{r^2 \sin^2 \theta} \bigg( \pdv{r} \qty[ r^2 \sin(\theta) \pdv{\psi}{r}] + \pdv{\theta} \qty[ \sin \theta \pdv{\psi}{\theta}] \\ + \pdv{\phi} \qty[ \frac{1}{\sin \theta} \pdv{\psi}{\phi}] \bigg) + (V-E)\psi = 0 \end{split} Now, splitting this into the radial part and an angular part, .. math:: \label{eq:sepschrod} \psi(r, \theta, \phi) = R(r) Y(\theta, \phi) Then, substituting this in, and setting both sides of the equation equal to :math:`l(l+1)` we get two independent solutions .. math:: \begin{aligned} \dv{r} \qty[r^2 \dv[2]{R}{r}] - \frac{2m}{\hbar^2} \qty(V(r)-E) r^2 R - l(l+1) R &= 0 \\\frac{1}{\sin \theta} \pdv{\theta} \qty[ \sin \theta \pdv{Y}{\theta}] + \frac{1}{\sin^2(\theta)} \pdv[2]{Y}{\phi} +l(l+1)Y &= 0\end{aligned} The angular part is solved by spherical harmonics, .. math:: \label{eq:sphericalharmonics} Y_l^m(\theta, \phi) = N e^{im\phi} P_l^m (\cos \theta) Bessel Functions ================ Bessel functions are the solutions to Bessel’s differential equation, .. math:: \label{eq:besselde} x^2 \dv[2]{y}{x} + x \dv{y}{x} + (x^2 - \alpha^2)y = 0 with :math:`p` a constant. Bessel functions from the Generating Function --------------------------------------------- The Bessel functions can be described by a generating function, .. math:: \label{eq:besselgen} g(x,t) = \exp(\frac{x}{2t}(t^2-1)) = \sum_{\nu=-\infty}^{\infty} J_{\nu}(x) t^{\nu} So, for Bessel functions of integer order we can expand this to form a series expansion, .. math:: \label{eq:besselseriesexp} J_n(x) = \sum^{\infty}_{s=0} \frac{(-1)^s}{s! (n+s)!} \qty( \frac{x}{2} )^{n+2s} \approx \frac{x^n}{2^n n!} for small :math:`x`. Bessel functions with a negative index can be found from the relation .. math:: \label{eq:negativebessel} J_{-\nu}(x) = (-1)^{\nu} J_{\nu}(x) [ width=, height=2in, xmin=0, xmax=20, ] gnuplot[raw gnuplot, id=bess, mark=none, muted-blue, ultra thick] set xrange[0:20]; plot besj0(x); ; gnuplot[raw gnuplot, id=bess2, mark=none, muted-green, ultra thick] set xrange[0:20]; plot besj1(x); ; gnuplot[raw gnuplot, id=bess3, mark=none, muted-orange, ultra thick] set xrange[0:20]; fac(n) = (int(n)==0) ? 1.0 : int(n) \* fac(int(n)-1.0); besj\_eps = 0.1; besj(n,x) = (n==0) ? besj0(x) : (n==1) ? besj1(x) : (abs(x) T_0`, so :math:`T>T_0` everywhere, and so :math:`T_0` can be taken as a constant. The boundary condition of the curved surface at :math:`r=a` is where :math:`J_n(ka) = 0`. We now need to know the zeros of the Bessel functions, and our solution becomes .. math:: T = T_0 + \sum_{m=0}^{\infty} c_m J_0 \qty(\alpha_{0m}\frac{r}{a}) \exp(-\qty(\frac{\alpha_{0m}z}{a})) The boundary condition at :math:`z=0` is that :math:`T=T_0`, so .. math:: T_1 - T_0 = \sum_m c_m J_0 \qty( \alpha_{0m} \frac{r}{a}) and using the orthogonality condition, .. math:: \int_0^a (T_1 - T_0) J_0 \qty( \alpha_{0m} \frac{r}{a} ) r \dd{r} = c_m \frac{a^2}{2} J_1^2(\alpha_{0m}) and then, from the indefinite integral relationship :math:`\int x J_0(x) \dd{x} = x J_1(x)`, .. math:: \begin{aligned} (T_1-T_0) \frac{a}{\alpha_{0m}} \qty[ r J_1 \qty( \alpha_{0m} \frac{r}{a})]_0^a &= (T_1 - T_0) \frac{a^2}{\alpha_{0m}} J_1 (\alpha_{0m})\\ &= c_m \frac{a^2}{2} J_1^2 (\alpha_{0m})\end{aligned} with .. math:: c_m = \frac{2}{\alpha_{0m}} \frac{1}{J_1(\alpha_{0m}} (T_1-T_0) and the overarching solution is thus .. math:: T = T_0 + \sum_m \frac{2 (T_1-T_0)}{\alpha_{0m}J_1(\alpha_{0m})} J_0 \qty( \alpha_{0m} \frac{r}{a}) \exp( - \qty(\frac{\alpha_{0m}z}{a}) ) Spherical Bessel Functions -------------------------- The spherical Bessel functions are a class of Bessel function related to the half-integer order order Bessel functions by .. math:: \label{eq:sphericalbess} j_n(x) = \sqrt{\frac{\pi}{2x}} J_{n+\frac{1}{2}}(x) = x^n \qty(- \frac{1}{x} \dv{x})^n \frac{\sin(x)}{x} | *Finding energy levels of particles inside a spherical box using Schrodinger’s equation.* | Starting at .. math:: - \frac{\hbar^2}{2m} \nabla^2 \Psi = E \Psi after seperating variables .. math:: \pdv{r} \qty(r^2 \pdv{R}{r}) + \qty( \frac{2mEr^2}{\hbar^2} - l(l+1) )R=0 letting .. math:: k^2 = \frac{2mE}{\hbar^2} \quad \text{and} \quad s=kr .. math:: s^2 \pdv[2]{R}{s} + 2s \pdv{R}{s} + \qty(s^2 - l(l+1))R = 0 and letting .. math:: R = \frac{Z}{s^{\frac{1}{2}}} .. math:: s^2Z^{\prime \prime} + s Z^{\prime} + (s^2 - \qty(l + \frac{1}{2})^2 ) Z = 0 Which is Bessel’s equation of order :math:`l+\half`, so .. math:: R = j_l \qty( \frac{\sqrt{2mE}}{\hbar} r) which is a finite solution as :math:`r \to 0`. The lowest energy state will have :math:`l=0` (so no angular variation), and to satisy the boundary condition of :math:`R=0` when :math:`r=a`, we need .. math:: j_0 \qty( \frac{\sqrt{2mE}}{\hbar}a)=0 the zeros of :math:`j_0` are the same as those of :math:`\sin(x)`, since .. math:: j_0(x) = \frac{\sin(x)}{x} so .. math:: \frac{a \sqrt{2mE_{\rm min}}}{\hbar} = \pi thus .. math:: E_{\rm min} = \frac{\pi^2 \hbar^2}{2ma^2} Hermite Polynomials =================== [ width=, height=2in, xmin=-3, xmax=3, ymin=-60, ymax=50, ] gnuplot[raw gnuplot, id=bess, mark=none, muted-blue, ultra thick] set xrange[-3:3]; set yrange[-40:50]; herm(n,x) = (n==0) ? 1 : (n==1) ? 2\*x : 2\*x\*herm(n-1,x)-2\*n\*herm(n-2,x); plot herm(0,x); ; gnuplot[raw gnuplot, id=bess2, mark=none, muted-green, ultra thick] set xrange[-3:3]; set yrange[-40:50]; herm(n,x) = (n==0) ? 1 : (n==1) ? 2\*x : 2\*x\*herm(n-1,x)-2\*n\*herm(n-2,x); plot herm(1,x); ; gnuplot[raw gnuplot, id=bess3, mark=none, muted-orange, ultra thick] set xrange[-3:3]; set yrange[-40:50]; herm(n,x) = (n==0) ? 1 : (n==1) ? 2\*x : 2\*x\*herm(n-1,x)-2\*n\*herm(n-2,x); plot herm(2,x); ; gnuplot[raw gnuplot, id=bess4, mark=none, accent-purple, ultra thick] set xrange[-3:3]; set yrange[-40:50]; herm(n,x) = (n==0) ? 1 : (n==1) ? 2\*x : 2\*x\*herm(n-1,x)-2\*n\*herm(n-2,x); plot herm(3,x); ; gnuplot[raw gnuplot, id=bess5, mark=none, accent-red, ultra thick] set xrange[-3:3]; set yrange[-40:50]; herm(n,x) = (n==0) ? 1 : (n==1) ? 2\*x : 2\*x\*herm(n-1,x)-2\*n\*herm(n-2,x); plot herm(4,x); ; Hermite polynomials are the solutions to the hermite equation, .. math:: \label{eq:hermitede} \dv[2]{y}{x} - 2x \dv{y}{x} + 2n y = 0 Hermite polynomials are solutions to the radial part of the Schrodinger equation for the simple harmonic oscillator. Just like Legendre polynomials and Bessel functions we can define Hermite polynomials, :math:`H_n (x)` via a generating function: .. math:: \label{eq:hermite} g(x,t) = e^{-t^2 + 2tx} = \sum^\infty_{n=0} H_n(x) \frac{t^n}{n!} Recurrence Relations for Hermite polynomials -------------------------------------------- First we diferentiate with respect to :math:`t`, .. math:: \frac{\partial}{\partial t} g(x,t) = (-2t+2x) e^{-t^2+2tx} = \sum^{\infty}_{n=1} H_n(x) \frac{t^{n-1}}{n!} Expanding, and putting into the generating function again, .. math:: -2 \sum^{\infty}_{n=0} H_n(x) \frac{t^{n+1}}{n!} + 2x \sum^{\infty}_{n=0} H_n(x) \frac{t^n}{n!} = \sum^{\infty}_{n=1} H_n(x)\frac{t^{n-1}}{(n-1)!} Relabelling the indices, .. math:: -2 \sum^{\infty}_{n=1} nH_{n-1}(x) \frac{t^{n}}{n!} + 2x \sum^{\infty}_{n=0} H_n(x) \frac{t^n}{n!} = \sum^{\infty}_{n=1} H_{n+1}(x)\frac{t^n}{n!} and finally equating coefficients of :math:`t^n`, .. math:: \label{eq:recurrencehermite} H_{n+1}(x) = 2x H_n(x) - 2n H_{n-1}(x) \qquad (n \ge 1) If we instead differentiate with respect to :math:`x`, .. math:: \pdv{x}g(x,t) = 2t e^{-t^2+2tx} = \sum_{n=0}^{\infty} H^{\prime}_n(x) \frac{t^n}{n!} and substitute in :math:`g`, .. math:: 2 \sum_{n=0}^{\infty} H_n(x) \frac{t^{n+1}}{n!} = \sum_{n=1}^{\infty} H^{\prime}_n(x) \frac{t^n}{n!} and relabelling, .. math:: 2 \sum_{n=1}^{\infty} H_{n-1}(x) \frac{t^{n}}{(n-1)!} = \sum_{n=1}^{\infty} H^{\prime}_n(x) \frac{t^n}{n!} and then equating coeffients of :math:`t^n`, .. math:: \label{eq:recurrencehermite2} H_n^{\prime}(x) = 2n H_{n-1}(x) These can be used to derive the ordinary differential equation which motivates these polynomials, from the previous results we can find .. math:: H_{n+1}(x) = 2x H_n(x) - H^{\prime}_n(x) and then differentiate with respect to :math:`x`, .. math:: \begin{aligned} H^{\prime}_{n+1}(x) &= 2 H_n(x) + 2x H^{\prime}_n(x) - H^{\prime \prime}_n(x) \\ 2(n+1)H_{n}(x) &= 2 H_n(x) + 2x H^{\prime}_n(x) - H^{\prime \prime}_n(x) \end{aligned} and so .. math:: \dv[2]{H_n(x)}{x} - 2x \dv{H_n(x)} + 2n H_n(x) = 0 It is possible to use the recurrence relations to find the Hermite polynomials, so .. math:: \begin{aligned} H_0(x) &= 1 \\ H_1(x) &= 2x \\ H_2(x) &= 4x^2 - 2 \\ H_3(x) &= 8x^3 - 12x \\ H_4(x) &= 16x^4 - 48x^2 + 12\end{aligned} Properties of the Hermite Polynomials ------------------------------------- The Hermite polynomials are symmetric about :math:`x=0`, so .. math:: \label{eq:parityhermite} H_n(-x) = (-1)^n H_n(x) The Hermite polynomials can be described by a specific series of the form .. math:: \label{eq:hermiteseriesspef} H_n(x) = \sum_{m=0}^{\frac{n}{2}}(-1)^m (2x)^{n-2m} \frac{n!}{(n-2m)!m!} And Rodrigues’s equation for Hermite polynomials also exists *proof is an exercise* .. math:: \label{eq:rodrigueshermite} H_n(x) = (-1)^n e^{x^2} \dv[n]{x} \qty(e^{-x^2}) Orthogonality of Hermite Polynomials ------------------------------------ It is possible to show the orthogonality of the Hermite polynomials. Starting at Hermite’s equation, .. math:: \begin{aligned} H_n^{\prime \prime}(x) - 2x H^\prime_n (x) + 2n H_n (x) &= 0 \\ \dv{x} \qty( e^{-x^2} \dv{x} H_n (x) ) + 2n e^{-x^2} H_n(x) &=0 \end{aligned} then, proceeding in much the same way as with Legendre polynomials in section [sec:orthogonallegendre], .. math:: \begin{aligned} \begin{split} H_m(x) \dv{x} \qty[ e^{-x^2} \dv{x} H_n(x) ] - H_n(x) \dv{x} \qty[ e^{-x^2} \dv{x} H_m(x)] \\= -H_m(x) \cdot 2 n e^{-x^2} H_n(x) + H_n(x) \cdot 2 m e^{-x^2} H_m(x) \end{split}\end{aligned} .. math:: \begin{aligned} \begin{split} \int_{-\infty}^{\infty} H_m(x) \dv{x} \qty[ e^{-x^2} \dv{x} H_n(x)] \dd{x} \\= \qty[ H_m(x) e^{-x^2} \dv{x} H_n(x)]_{-\infty}^{\infty} - \int_{-\infty}^{\infty} \qty[ \dv{x} H_m(x)] e^{-x^2} \dv{x} H_n(x) \dd{x} \end{split}\end{aligned} .. math:: \begin{aligned} 2(m-n) \int_{-\infty}^{\infty} H_n(x) H_m(x) e^{-x^2} \dd{x} &= 0 \\ \therefore \int_{-\infty}^{\infty} H_n(x) H_m(x) e^{-x^2} \dd{x} &= 0 \text{ iff } n \neq m\end{aligned} Hermite polynomials are orthogonal on the interval :math:`[-\infty, \infty]` with a weighting of :math:`\exp(-x^2)`. .. math:: \begin{aligned} \int_{-\infty}^{\infty} g^2(x,t) e^{(-x^2)} \dd{x} &= \int_{-\infty}^{\infty} \exp(-2t^2+4tx-x^2) \dd{x} \\ &= \sum_{n=0}^{\infty} \sum_{m=0}^{\infty} \frac{t^{n+m}}{n! m!} \int_{-\infty}^{\infty} H_n(x) H_m(x) e^{(-x^2)} \dd{x} \\ &= e^{2t^2}\int_{-\infty}^{\infty} e^{-x^2} \dd{x}\\ &= e^{2t^2} \sqrt{\pi} \\ &= \sqrt{\pi} \sum_{n=0}^{\infty} \frac{2^n}{n!} t^{2n}\end{aligned} Finally, equating powers of :math:`t^{2n}` gives .. math:: \int_{-\infty}^{\infty} \qty[ H_n(x)]^2 \exp(-x^2) = 2^n \sqrt{\pi} n! so, .. math:: \label{eq:hermiteorthoweight} \int_{-\infty}^{\infty} H_n(x) H_m(x) \exp(-x^2) \dd{x} = 2^n \sqrt{\pi} n! \delta_{nm} it is also possible to remove the weighting by redefining the polynomial as .. math:: \phi_n(x) := \exp(-x^2) H_n(x) in this case .. math:: \label{eq:hermiteorthonoweight} \int_{-\infty}^{\infty} \phi_n(x) \phi_m(x) \dd{x} = 2^n \sqrt{\pi} n! \delta_{nm} these, however, are solutions not of Hermite’s equation, but of a slightly variant equation, .. math:: \label{eq:modhermiteequation} \phi^{\prime \prime}_n(x) + (1-x^2+2n) \phi_n(x) = 0 The Quantum Harmonic Oscillator ------------------------------- Returning to the one-dimensional time-independent Schrödinger equation, .. math:: \label{eq:1} - \frac{\hbar^2}{2m} \dv[2]{x} \psi(x) + V(x) \psi(x) = E \psi(x) with :math:`m` the mass of the particle, and :math:`E` its energy. For the simple harmonic oscillator, .. math:: V(x) \half m \omega^2 x^2 so .. math:: \psi^{\prime \prime} (x) + \qty( - \frac{m^2 \omega^2}{\hbar^2} x^2 + \frac{2m E}{\hbar^2} ) \psi(x) = 0 which has a form very similar to the modified Hermite equation of the previous section, and these describe the quantum harmonic oscillator. Let :math:`y = ax` with :math:`a = \sqrt{\frac{m \omega}{\hbar}}`, so .. math:: \dv[2]{\psi}{y} + \qty( -y^2 + \frac{2mE}{\hbar^2 a^2} ) \psi = 0 Comparing the two equations, we get the solutions .. math:: \label{eq:2} \psi_n (x) = \sqrt{\frac{a}{2^n \sqrt{\pi} n!}} \exp( - \frac{a^2 x^2}{2} ) H_n(ax) which includes a normalisation constant. The energy is then given by the equation .. math:: \begin{aligned} \frac{2 m E}{\hbar^2 a^2} &= 1 + 2n \nonumber\\ \frac{2E}{\hbar \omega} &= 1 + 2n \nonumber\\ E &= \hbar \omega \qty(n + \half)\end{aligned} but why does :math:`n` need to be an integer? The oscillator must have :math:`\Psi \to 0` as :math:`x \to \infty`. Taking solutions of the form .. math:: \Psi \approx \exp( - \frac{x^2}{2} ) H_n(x) only guarantees this if :math:`n` is an integer; this can be demonstrated by returning to Hermite’s equation, equation ([eq:hermitede]), and letting :math:`y = \sum_{k=0}^{\infty} c_k x^k`, so that .. math:: \sum_k c_k \qty( k(k-1) x^{k-2} - 2kx^k + 2nx^k ) = 0 This must be true for each power of :math:`x` individually, so .. math:: c_{k+2} (k+2) (k+1) - c_k(2k-2n)=0 and if the series in :math:`k` goes on *ad infinitum*, we have the behaviour .. math:: \frac{c_{k+2}}{c_k} = \frac{2k - 2n}{(k+1)(k+2)} \to \frac{2}{k} \quad \text{as} \quad k \to \infty This has the power series behaviour of :math:`\exp(x^2)`, which would imply that :math:`\Psi \approx e^{x^2} e^{-\frac{x^2}{2}} \approx e^{\frac{x^2}{2}}`, giving “bad” behaviour as :math:`x \to \infty`. If the series truncates this behaviour will not occur. This happens if :math:`2n=2k` for some :math:`k`, that is, for :math:`n \in \mathbb{Z}`. The solution of Hermite’s equation is a finite polynomial, and the solution for :math:`\Psi` must be physical, so this forces :math:`n` to be an integer. The harmonic oscillator can also be solved using ladder operators, these work due to the recurrence relation in equation ([eq:recurrencehermite2]). Writing .. math:: \psi_n(x) = \sqrt{\frac{1}{2^n \sqrt{\pi} n!}} \exp( - \frac{x^2}{2} ) H_n(x) and, for simplicity, letting :math:`a=1`, then .. math:: \begin{aligned} \frac{1}{\sqrt{2}} \qty(x + \dv{x}) \psi_n(x) &= \sqrt{\frac{1}{2^{n+1} \sqrt{\pi} n!}} \qty( x+ \dv{x}) \exp(- \frac{x^2}{2}) H_n(x) \\ %&= \sqrt{\frac{1}{2^{n+1} \sqrt{\pi} n!}} \qty( x \exp( - \frac{x^2}{2} ) H_n(x) - x \exp( - \frac{x^2}{2} ) H_n(x) + \exp( - \frac{x^2}{2}) H^{\prime}_n(x) ) \\ & = \sqrt{n} \psi_{n-1}(x)\end{aligned} This is a lowering operator, it is also possible, using either recurrence relations or the Rodrigues’ formula, that .. math:: \frac{1}{\sqrt{2}} \qty( x - \dv{x} ) is a raising operator. Laguerre Polynomials ==================== The Laguerre polynomials are the solutions to the Laguerre equation, .. math:: \label{eq:laguerrede} x L_n^{\prime \prime} (x) + (1-x) L_n^{\prime}(x) + n L_n(x) = 0 The Laguerre polynomials are generated by the function .. math:: \label{eq:3} g(x,t) = \frac{\exp( - \frac{xt}{(1-t)})}{1-t} = \sum_{n=0}^{\infty} L_n(x) t^n Recurrence Relations --------------------- .. math:: \label{eq:4} (n+1) L_{n+1}(x) = (2n +1 -x) L_n(x) - nL_{n-1}(x) .. math:: \label{eq:5} xL^{\prime}_n(x) = nL_n(x) - nL_{n-1}(x) It is possible to use these recurrence relations to find the first few Laguerre polynomials, .. math:: \begin{aligned} L_0(x) &= 1 \\ L_1(x) &= 1-x \\ L_2(x) &= \half \qty(x^2 - 4x + 2)\end{aligned} Orthogonality ------------- Using similar techniques as for other special functions, it can be demonstrated that .. math:: \label{eq:orthoglag} \int_0^{\infty} L_n(x) L_m(x) \exp(-x) \dd{x} = \delta_{nm} Properties ---------- The Laguerre polynomials have a Rodrigues’ formula .. math:: \label{eq:rodrigueslag} L_n(x) = \frac{e^x}{n!} \dv[n]{x} \qty(x^n e^{-x} ) and a series expansion .. math:: \label{eq:serieslag} L_n(x) = \sum_{s=0}^n (-1)^{n-s} \frac{n! x^{n-s}}{(n-s)!(n-s)!s!} Associate Laguerre Polynomials ------------------------------ The associate Laguerre polynomials are solutions to the associate Laguerre equation, .. math:: \label{eq:assoclag} x y^{\prime \prime} (x) + (k+1-x) L_n^{k \prime}(x) + nL_n^k(x) = 0 and are derived from the Laguerre polynomials by the expression .. math:: \label{eq:assoclagfromlag} L_n^k(x) = (-1)^n \dv[k]{x} L_{n+k}(x) They are also orthogonal, with .. math:: \label{eq:assoclagortho} \int_0^{\infty} L_n^k(x) L_m^k(x) x^k \exp(-x) \dd{x} = \frac{(n+k)!}{n!} \delta_{nm} *3D Quantum Harmonic Oscillator* Consider a quantum harmonic oscillator with a potential .. math:: V = \half m \omega^2 \qty(x^2+y^2+z^2) = \half m \omega^2 r^2 First separating Schrödinger’s equation into cartesian coordinates and then deriving the form of the wavefunction leads to the conclusion that the energies are quantised as .. math:: E = \qty( n+ \frac{3}{2}) \hbar \omega for :math:`n = n_x + n_y + n_z`. Separating Schrödinger into spherical coordinates allows the solutions to take the form .. math:: \Psi = N r^l \exp( - \half \alpha r^2) L_{\half(n-l)}^{l+\half} (\alpha^2 r^2) Y_{lm}(\theta, \phi) for .. math:: a = \sqrt{\frac{m \omega}{\hbar}} With :math:`n` a normalisation factor, and :math:`l` taking the values :math:`n, n-2, \dots, 0`. Associated Laguerre polynomials with non-integer :math:`p` are obtained. in 0,1,2,3,4 [yshift=-1.8in\*] [ title=\ :math:`k=\k`, width=, height=2in, xmin=0, xmax=5, ymin=-3, ymax=5 ] gnuplot[raw gnuplot, id=alag, mark=none, muted-blue, ultra thick] set xrange[-1:5]; lag(n,x) = (n==0) ? 1 : (n==1) ? -x+1 : ( (2\*(n-1)+1-x) \* lag(n-1,x) - (n-1) \* lag(n-2, x) ) / (n); alag(n,k,x) = (k==0) ? lag(n,x) : ( (n+k)\*alag(n, k-1, x) - (n+1)\* alag(n+1, k-1, x) ) /x; plot alag(0,,x); ; gnuplot[raw gnuplot, id=alag, mark=none, muted-green, ultra thick] set xrange[-1:5]; lag(n,x) = (n==0) ? 1 : (n==1) ? -x+1 : ( (2\*(n-1)+1-x) \* lag(n-1,x) - (n-1) \* lag(n-2, x) ) / (n); alag(n,k,x) = (k==0) ? lag(n,x) : ( (n+k)\*alag(n, k-1, x) - (n+1)\* alag(n+1, k-1, x) ) /x; plot alag(+1,,x); ; gnuplot[raw gnuplot, id=alag, mark=none, muted-orange, ultra thick] set xrange[-1:5]; lag(n,x) = (n==0) ? 1 : (n==1) ? -x+1 : ( (2\*(n-1)+1-x) \* lag(n-1,x) - (n-1) \* lag(n-2, x) ) / (n); alag(n,k,x) = (k==0) ? lag(n,x) : ( (n+k)\*alag(n, k-1, x) - (n+1)\* alag(n+1, k-1, x) ) /x; plot alag(+2,,x); ; gnuplot[raw gnuplot, id=alag, mark=none, accent-purple, ultra thick] set xrange[-1:5]; lag(n,x) = (n==0) ? 1 : (n==1) ? -x+1 : ( (2\*(n-1)+1-x) \* lag(n-1,x) - (n-1) \* lag(n-2, x) ) / (n); alag(n,k,x) = (k==0) ? lag(n,x) : ( (n+k)\*alag(n, k-1, x) - (n+1)\* alag(n+1, k-1, x) ) /x; plot alag(+3,,x); ; gnuplot[raw gnuplot, id=alag, mark=none, accent-red, ultra thick] set xrange[-1:5]; lag(n,x) = (n==0) ? 1 : (n==1) ? -x+1 : ( (2\*(n-1)+1-x) \* lag(n-1,x) - (n-1) \* lag(n-2, x) ) / (n); alag(n,k,x) = (k==0) ? lag(n,x) : ( (n+k)\*alag(n, k-1, x) - (n+1)\* alag(n+1, k-1, x) ) /x; plot alag(+4,,x); ; .. |image| image:: figures/spharmonics.png .. |image| image:: figures/spharmonics2.png