WhittakerW¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
WhittakerW[k, m, z]
gives the Whittaker function W_{k,m}(z).
D[WhittakerW[k,m,z],z] = (1/2-k/z) WhittakerW[k,m,z] - WhittakerW[1+k,m,z]/z.
Notes
Related to the Tricomi confluent hypergeometric function by W\_{k,m}(z) = E^(-z/2) z^(m+1/2) HypergeometricU\[m-k+1/2, 2m+1, z\]. With an inexact argument it evaluates numerically at machine or arbitrary (MPFR) precision, real or complex, through that confluent form; a real machine argument uses a shared double kernel that also drives the NDArray/packed fast path and Compile\[\]. Values at z = 0: 0 for |Re m| \< 1/2, 1/Gamma\[1-k\] for m = +-1/2, ComplexInfinity for |Re m| \> 1/2. Series (origin and Infinity) for the terminating (elementary) case via LaguerreL. Listable.Examples (13)¶
Every input below was run against the current Mathilda build and its output recorded.
Basic examples (3)¶
In[1]:= WhittakerW[2, 3, 4.5]
Out[1]= 11.3063
In[2]:= D[WhittakerW[k, m, z], z]
Out[2]= -WhittakerW[1 + k, m, z]/z + (1/2 - k/z) WhittakerW[k, m, z]
In[3]:= WhittakerW[k, 1/2, 0]
Out[3]= 1/Gamma[1 - k]
Applications (10)¶
Machine value
The same value from the defining U form
Checked against W_{0,m}(z) = √(z/π) K_m(z/2)
Arbitrary precision through HypergeometricU / arb
Complex order
Symmetry W_{k,m} = W_{k,-m}
Values at the origin, decided by 1/2 - |Re m|
In[10]:= {WhittakerW[0, 0, 0], WhittakerW[0, 1, 0], WhittakerW[k, 1/2, 0]}
Out[10]= {0, ComplexInfinity, 1/Gamma[1 - k]}
DLMF 13.14.31
In[11]:= D[WhittakerW[k, m, z], z]
Out[11]= -WhittakerW[1 + k, m, z]/z + (1/2 - k/z) WhittakerW[k, m, z]
Terminating case, via the Laguerre rewrite
Listable
Algorithm¶
Mathilda -- WhittakerM, the Whittaker M function M_{k,m}(z).
Evaluation is layered so each argument shape takes the cheapest numeric route (mirroring the LaguerreL / HermiteH confluent-hypergeometric design):
z == 0 (exact), Re(m) > -1/2 -> exact 0 (M_{k,m} ~ z^(m+1/2) near 0).
machine-precision call -> the shared double helpers
(k, m exact or machine real; sf_machine_whittaker_m (real z > 0) /
z machine real or complex) sf_machine_whittaker_m_c (complex z, or
real z < 0 on the principal branch),
bit-for-bit with the NDArray element-wise
buffer loop and the Compile[] VM.
Declines (2m+1 pole, cancellation,
overflow) -> template.
some inexact argument -> the confluent-hypergeometric form built as
e^(-z/2) z^(m+1/2) Hypergeometric1F1[...],
evaluated so it inherits 1F1's machine +
MPFR, real + complex numerics. Kept only
if it collapses to a number.
everything else (symbolic) -> stays symbolic (return NULL).
WhittakerM is a single growing PRODUCT (prefactor * 1F1), not a difference, so it adds no cancellation over 1F1 itself and needs no guard digits (unlike HermiteH): bad 1F1 cancellation is declined inside sf_machine_pfq / re-summed in MPFR by the 1F1 evaluator.
Attributes: Listable, NumericFunction, Protected.
Deferred / best-effort, as the sibling special functions: tight Interval enclosures (the generic NumericFunction + D[] interval threading in eval.c declines here because D[WhittakerM,z] mentions WhittakerM itself -- the self-referential-derivative guard), the general asymptotic Series at infinity (a two-scale Stokes transseries; only the terminating/elementary case is emitted, in calculus/series.c), symbolic FunctionExpand, and general-n SeriesCoefficient. The D[] rule and the origin Series live in src/calculus/deriv.c and src/calculus/series.c respectively.
Implementation notes¶
Algorithm. builtin_whittaker_w uses the same three stages as WhittakerM, with the U kernels in place of the 1F1 kernels.
whit_ndarraythreads the kernels over a buffer z.whit_machinehandles a scalar machine call withsf_machine_whittaker_w. That kernel folds m to |m|, which is valid because W is even in m, and so b = 2|m|+1 ≥ 1. It then returnse^(−z/2) z^(|m|+1/2) · sf_machine_hyperu(|m|−k+1/2, 2|m|+1, z), withsf_machine_whittaker_w_cfor z off the positive axis.whittaker_w_evalsettles z = 0 from the leading exponent1/2 − |Re m|: the value is0below 1/2,ComplexInfinityabove it, and1/Gamma[1−k]for a real m = ±1/2. Any other inexact input is evaluated through the templateExp[−z/2] z^(m+1/2) HypergeometricU[m−k+1/2, 2m+1, z], so it inherits the HypergeometricU arb path.
In the common case of integer or half-integer m, the U kernel's log series advances its three digammas by recurrence instead of calling digamma at every term. D comes from DLMF 13.14.31. The origin and infinity series in series.c cover only the terminating case U(−n, b, z) = (−1)^n n! LaguerreL[n, b−1, z].
Data structures. The machine scalar and buffer drivers are shared with WhittakerM through the WhitReal and WhitCplx function pointers. Buffers stay real when every point is real and are promoted to complex otherwise. REG_N(WhittakerW) registers the kernel for the Compile VM.
Complexity / limits. Machine cost is one sf_machine_hyperu call plus the prefactor. The docs report the packed path running about 1.8× faster than SciPy's exp·z^(m+½)·hyperu. Compile[] lowers the scalar shape but not rank-1 arrays: CompileDiagnostics[{{v,_Real,1}}, WhittakerW[1,1/2,v]] reports Compiled -> False. The general two-branch origin series and the general asymptotic are not produced. The HypergeometricU terminating-case defect carries over: WhittakerW[2, 1/2, 1.] returns 0.0, while the correct value, −e^(−1/2) = −0.606531, is obtained with N[WhittakerW[2, 1/2, 1]].
Attributes: Listable, NumericFunction, Protected.
References¶
See also: HypergeometricU, WhittakerM
- DLMF §13.14 — Whittaker functions, W_{k,m}(z) = e^(−z/2) z^(m+1/2) U(m−k+1/2, 1+2m, z) (§13.14.3).
- DLMF §13.14.31 (the derivative used for D); §13.2.9 (the integer-b log series behind the machine kernel).
- Source:
src/special_functions/whittaker.c - Specification:
docs/spec/builtins/special-functions.md - Tests:
tests/test_sf_machine_hyper.c - Tests:
tests/test_whittaker.c
Notes & additional examples¶
Notes¶
Listable,NumericFunction,Protected. The definition isW_{k,m}(z) = e^(−z/2) z^(m+1/2) U(m−k+1/2, 2m+1, z), which is even in m. The machine kernel folds m to |m|.- Exact values at z = 0 depend on the leading exponent 1/2 − |Re m|: the result is
0,ComplexInfinity, or1/Gamma[1−k]when m = ±1/2. Other exact input stays symbolic. - Machine input runs
sf_machine_whittaker_w, which is theHypergeometricUdouble kernel with the e^(−z/2) z^(m+1/2) prefactor. Buffers share it. Complex orders and precision above machine go throughHypergeometricU, which uses arb. Din z follows DLMF 13.14.31.Seriescovers the terminating case only, at 0 and atInfinity, throughU(−n, b, z) = (−1)^n n! LaguerreL[n, b−1, z].- See also:
WhittakerM,HypergeometricU.