nitrogen.special

Special math and basis functions implemented as differentiable DFun objects.

Function

Description

SinCosDFun

Real sine-cosine basis.

LegendreLMCos

Associated Legendre functions with cosine argument.

RealSphericalH

Real spherical harmonics.

LaguerreL

Generalized Laguerre polynomials, \(L^{(\alpha)}_n(x)\).

RadialHO

Radial harmonic oscillator eigenfunctions in \(d\) dimensions.

BesselJ

Bessel functions of the first kind, \(J_{\nu}(x)\).

Real2DHO

Real 2-D isotropic harmonic oscillator wavefunctions.

Sin

Sine.

Monomial

A monomial \(x^p y^q z^r \cdots\).

ChebyshevT

Chebyshev polynomials of the first kind, \(T_n(x)\).

ChebyshevU

Chebyshev polynomials of the second kind, \(U_n(x)\).

class nitrogen.special.BesselJ(v)

Bases: nitrogen.dfun.DFun

Bessel functions of the first kind.

Bessel function of the first kind, \(J_{\nu}(x)\).

Parameters

v (float) – The real order parameter.

class nitrogen.special.ChebyshevT(nmax)

Bases: nitrogen.dfun.DFun

Chebyshev polynomials of the first kind, \(T_n(x)\).

nmax

The maximum degree.

Type

int

Create Chebyshev polynomial basis.

Parameters

nmax (int) – The maximum degree.

class nitrogen.special.ChebyshevU(nmax)

Bases: nitrogen.dfun.DFun

Chebyshev polynomials of the second kind, \(U_n(x)\).

nmax

The maximum degree.

Type

int

Create Chebyshev polynomial basis.

Parameters

nmax (int) – The maximum degree.

class nitrogen.special.LaguerreL(alpha, nmax)

Bases: nitrogen.dfun.DFun

Generalized Laguerre polynomials of a given order, \(\alpha\).

\[L_n^{(\alpha)}(x)\]
nmax

The maximum degree.

Type

int

alpha

The associated Legendre function order index.

Type

float

Create associated Legendre basis DFuns

Parameters
  • m (float) – The real order parameter.

  • nmax (int) – The maximum degree.

class nitrogen.special.LegendreLMCos(m, lmax)

Bases: nitrogen.dfun.DFun

Associated Legendre polynomials of a given order, \(m\), with \(\cos \theta\) argument for \(\theta \in [0,\pi]\).

\[F_\ell^m(\theta) = N^m_l P_l^{|m|}(\cos \theta),\]

with \(m = 0, 1, 2, \ldots\) and \(\ell = |m|, |m|+1, \ldots, \ell_\text{max}\). (Negative \(m\) is defined, but just equal to \(m = |m|\)).

The normalization coefficient is

\[N_\ell^m = \left( \frac{2}{2\ell+1} \frac{(l+|m|)!}{(l-|m|)!} \right) ^{-1/2}\]
l

A list of the l-index of each basis function

Type

ndarray

m

The associated Legendre function order index.

Type

int

Create associated Legendre basis DFuns

Parameters
  • m (int) – The Legendre order.

  • lmax (int) – The maximum value of \(\ell\). This must be greater than or equal to \(|m|\).

class nitrogen.special.Monomial(pows)

Bases: nitrogen.dfun.DFun

The monominal in multiple variables

Parameters

pows (array_like) – A list of non-negative integer exponents.

class nitrogen.special.RadialHO(nmax, ell, d=2, alpha=1.0)

Bases: nitrogen.dfun.DFun

Radial eigenfunctions for a \(d\)-dimensional isotropic harmonic oscillator.

\[R_n^{(\ell)}(r) = (-1)^n \alpha^{d/4} \left[ \frac{2 \Gamma(n+1) } {\Gamma(n+\ell + d/2)} \right] ^{1/2} e^{-\alpha r^2/2} (\alpha^{1/2} r)^\ell L_n^{(\ell + d/2 - 1)} (\alpha r^2)\]
nmax

The maximum Laguerre index.

Type

int

ell

The generalized angular momentum quantum number.

Type

int

d

The dimensionality

Type

int

alpha

The radial scaling parameter \(\alpha\) with units inverse-length-squared.

Type

float

Notes

These wavefunctions are orthonormal with respect to an integration volume element of \(r^{d-1} dr\) over \(r = [0,\infty)\). An isotropic harmonic oscillator of mass \(m\) and frequency \(\omega\) has \(\alpha = m \omega / \hbar\). The conventional vibrational quantum number \(v\) is related to the Laguerre polynomial degree parameter as \(v = 2n + \ell\), and the energy eigenvalue is \(E /\hbar \omega = v + d/2 = 2n + \ell + d/2\).

For a given \(\ell\) and \(d\), the matrix elements of \(r^2\) are tri-diagonal,

\[\begin{split}\langle n \vert r^2 \vert n \rangle &= \alpha^{-1}(2n + \ell + d/2) \\ \langle n+1 \vert r^2 \vert n\rangle = \langle n \vert r^2 \vert n + 1 \rangle &= \alpha^{-1}\sqrt{(n+1)(n+\ell + d/2)}.\end{split}\]

The differential operator,

\[\hat{D}^2 \equiv \partial_r^2 + \frac{d-1}{r} \partial_r - \frac{\ell(\ell + d - 2)}{r^2},\]

is also tri-diagonal with matrix elements,

\[\begin{split}\langle n \vert \hat{D}^2 \vert n \rangle &= -\alpha(2n + \ell + d/2) \\ \langle n+1 \vert \hat{D}^2\vert n\rangle = \langle n \vert \hat{D}^2 \vert n + 1 \rangle &= \alpha\sqrt{(n+1)(n+\ell + d/2)}.\end{split}\]

By inspection, we can now see that the Hamiltonian operator

\[\hat{H}/\hbar\omega = -\frac{1}{2}\alpha^{-1} \hat{D}^2 + \frac{1}{2}\alpha r^2\]

is diagonal, with eigenvalue \(2n + \ell + d/2 = v + d/2\).

Create radial harmonic oscillator wavefunctions.

Parameters
  • nmax (int) – The maximum Laguerre index.

  • ell (int) – The generalized angular momentum quantum number.

  • d (int, optional) – The dimensionality. The default is 2.

  • alpha (float, optional) – The radial scaling parameter, \(\alpha\), with units inverse-length-squared. The default is 1.

class nitrogen.special.Real2DHO(vmax, alpha, ell=None, angle='rad')

Bases: nitrogen.dfun.DFun

Real-valued eigenfunctions of 2-D isotropic harmonic oscillator in cylindrical coordinates.

\[\chi_n^{\ell}(r, \phi) = R_n^{|\ell|}(r) f_{\ell} (\phi)\]

For definitions of the radial wavefunctions \(R_n^{\ell}\) and sine-cosine functions \(f_{\ell}\), see RadialHO and SinCosDFun.

v

The \(v\) quantum numbers, where \(v = 2n + \vert \ell \vert\).

Type

ndarray

ell

The \(\ell\) quantum numbers.

Type

ndarray

n

The \(n\) Laguerre degree.

Type

ndarray

vmax

The initial vmax parameter.

Type

int

alpha

The radial scaling parameter, \(\alpha\).

Type

float

angle

The angular unit.

Type

{‘rad’, ‘deg’}

Create a 2D harmonic oscillator basis.

Parameters
  • vmax (int) – The maximum vibrational quantum number \(v\), in the conventional sum-of-modes sense.

  • alpha (float) – The radial scaling parameter, \(\alpha\).

  • ell (scalar or 1-D array_like, optional) – The angular momentum quantum number. If scalar, then all \(\ell\) with \(|\ell| \leq\) abs(ell) will be included. If array_like, then ell lists all (signed) \(\ell\) values to be included. A value of None is equivalent to ell = vmax. The default is None.

  • angle ({'rad', 'deg'}) – The cylindrical angle unit. The default is ‘rad’.

class nitrogen.special.RealSphericalH(m, lmax)

Bases: nitrogen.dfun.DFun

Real-valued spherical harmonics,

\[\Phi_\ell^m(\theta, \phi) = F_\ell^m(\theta) f_m (\phi)\]

For definitions of the associated Legendre polynomials \(F_\ell^m\) and sine-cosine functions \(f_m\), see LegendreLMCos and SinCosDFun.

l

The \(\ell\) quantum numbers.

Type

ndarray

m

The \(m\) quantum numbers.

Type

ndarray

Create a real spherical harmonic basis.

Parameters
  • m (scalar or 1-D array_like) – The projection quantum number. If scalar, then all \(m\) with \(|m| \leq\) m will be included. If array_like, then m lists all \(m\) to be included.

  • lmax (int) – The maximum value of \(\ell\), the angular momentum (or azimuthal) quantum number.

class nitrogen.special.Sin(nx=1)

Bases: nitrogen.dfun.DFun

The function sin(theta). (Used for Legendre Basis weight function)

Parameters

nx (int, optional) – The total number of input variables. The argument of sine is always the first. The rest are dummies. The default is 1.

class nitrogen.special.SinCosDFun(m, angle='rad')

Bases: nitrogen.dfun.DFun

A real sine/cosine basis set,

\[\begin{split}f_m(\phi) &= 1/\sqrt{\pi} \sin(|m|\phi) &\ldots m < 0\\ &= 1/\sqrt{2\pi} &\ldots m = 0\\ &= 1/\sqrt{\pi} \cos(m \phi) &\ldots m > 0\end{split}\]

If degree units are used, then the functions are renomalized over \([0^\circ, 360^\circ]\).

m

The m-index of each basis function (i.e. each output value).

Type

ndarray

angle

The angular units.

Type

{‘rad’, ‘deg’}

Create sine-cosine basis functions.

Parameters
  • m (scalar or 1-D array_like) – If scalar, the \(2|m|+1\) basis functions with index \(\leq |m|\) will be included. If array_like, then m lists all m-indices to be included.

  • angle ({'rad', 'deg'}) – The angle unit. The default is ‘rad’.