About the function LaguerreL[n,a,x]
, the helping documents in Mathematica only say that this function satisfies equation $xy^{\prime\prime}+(a+1-x)y^\prime+ny=0$. Is there an integral expression for this function? And how does Mathematica calculate the value of LaguerreL[n,a,x]
when n
is not a integer or when n < 0
?
-
$\begingroup$ From my recollection, the orthogonal polynomials in Mathematica are evaluated using the three-term recurrence for integer order, and the hypergeometric form (as shown in Bob's answer) for arbitrary orders. $\endgroup$– J. M.'s missing motivation ♦Commented Aug 9, 2015 at 0:17
2 Answers
From Wolfram MathWorld,
EDIT : added definition using Hypergeometric1F1Regularized
based on comment by @ilian and his reference
LaguerreL[n, a, x] ==
Pochhammer[a + 1, n]/n! Hypergeometric1F1[-n, a + 1, x] ==
Gamma[a + n + 1]/Gamma[n + 1] Hypergeometric1F1Regularized[-n, a + 1,
x] // FullSimplify
True
One of these definitions may be how it is implemented.
EDIT 2: To address a question in the comments about LaguerreL[-1, -1, x]
Clear[a, n]
With[{n = -1, a = -1}, LaguerreL[n, a, x] // FunctionExpand]
(-E^x)*x
The Hypergeometric1F1Regularized
representation gives the same expression for (a == -1) and in the limit as (n -> -1)
With[{a = -1},
Limit[Gamma[a + n + 1]/Gamma[n + 1] Hypergeometric1F1Regularized[-n, a + 1,
x] // FunctionExpand, n -> -1]]
(-E^x)*x
Visually comparing plots of LaguerreL[-1, -1, x]
with -x E^x
Plot[{LaguerreL[-1, -1, x], -x E^x}, {x, -2, 1.25}, PlotStyle -> {
Directive[Red, AbsoluteDashing[{10, 7}]],
Directive[Blue, AbsoluteDashing[{5, 10}]]},
PlotLegends -> "Expressions"]
However, taking the limit along different paths gives different results. Presumably, the internal Mathematica imlementation for LaguerreL[n, a, x]
effectively uses the limit above.
-
$\begingroup$ Correct, you can also see it by evaluating
Needs["GeneralUtilities`"]; PrintDefinitions[LaguerreL]
+1 $\endgroup$– C. E. ♦Commented Aug 8, 2015 at 16:31 -
1$\begingroup$ @Pickett I am surprised
PrintDefinitions
would give anything since the implementation is inC
and not top level. +1 from me too, I believe the general case is computed in terms ofGamma
/Pochhammer
andHypergeometric1F1Regularized
as in this definition $\endgroup$– ilianCommented Aug 8, 2015 at 16:37 -
$\begingroup$ @Pickett Oh, I see now, it also has a few top level definitions attached related to
Series
. $\endgroup$– ilianCommented Aug 8, 2015 at 16:52 -
$\begingroup$ To simplify even further, you can replace the
Pochhammer
symbol byBinomial[a + n, n]
. $\endgroup$– JensCommented Aug 8, 2015 at 22:28 -
$\begingroup$ Thanks a lot! But I still have a question: run the following codes in Mathematica n = -1 a = -1 LaguerreL[n, a, x] // FunctionExpand Gamma[a + n + 1]/Gamma[n + 1] Hypergeometric1F1Regularized[-n, a + 1, x] // FunctionExpand You will find that the LaguerreL turns out to be -x*Exp[x], but the latter function is not convergent. In this condition, how does Mathematica calculate LaguerreL? $\endgroup$ Commented Aug 9, 2015 at 1:27
Here is an example that shows that a generic LaguerreL
function is not automatically computed using the confluent hypergeometric function as suggested by MathWorld.
First I'll define the rule that would amount to just such a replacement. Then I'll show that this replacement allows a particular integral of the LaguerreL
function to be computed without any assumptions. Finally, I omit the replacement rule and leave LaguerreL
to be evaluated by Mathematica internally.
The result is that the integral is returned unevaluated if you don't make the replacement manually. This means that the generic LaguerreL
was not internally replaced by the hypergeometric function:
laguerreReplacement =
LaguerreL[n_, k_, x_] :>
Binomial[k + n, n] Hypergeometric1F1[-n, 1 + k, x];
FullSimplify[(LaguerreL[n, k, x] /. laguerreReplacement) ==
LaguerreL[n, k, x]]
(* ==> True *)
Clear[n];
Integrate[
E^(-r - r/(n + 2)) LaguerreL[n, 3, (2 r)/(n + 2)] r^3 /.
laguerreReplacement, {r, 0, Infinity}]
$(-n-1)^n (n+1) \left(-\frac{1}{n+2}\right)^n (n+3)^2 \left(\frac{n+3}{n+2}\right)^{-n-5}$
Integrate[
E^(-r - r/(n + 2)) LaguerreL[n, 3, (2 r)/(n + 2)] r^3, {r, 0, Infinity}]
$\int_0^{\infty } e^{-r-\frac{r}{n+2}} L_n^3\left(\frac{2 r}{n+2}\right) r^3 \, dr$
There are many similar integrals where this happens. What this means is that the answer to the question of how the Laguerre function is evaluated internally seems to depend on the context. Here, it's not even a matter of assuming that the index is integer or positive. The above test involved only a generic n
. Still the hypergeometric function was apparently not automatically introduced, even though it would have allowed the integral to be solved.
Edit: testing alternative representation
The replacement above is the one suggested by MathWorld as copied in Bob Hanlon's answer. The other representation mentioned by the function reference is tested below for the same integral:
laguerreReplacement =
LaguerreL[n_, k_, x_] :>
Gamma[k + n + 1]/Gamma[n + 1] Hypergeometric1F1Regularized[-n,
k + 1, x];
FullSimplify[(LaguerreL[n, k, x] /. laguerreReplacement) ==
LaguerreL[n, k, x]]
(* ==> True *)
Integrate[
E^(-r - r/(n + 2)) LaguerreL[n, 3, (2 r)/(n + 2)] r^3 /.
laguerreReplacement, {r, 0, Infinity}]
$\text{ConditionalExpression}\left[(-1-n)^n (1+n) \left(-\frac{1}{2+n}\right)^n (2+n) (3+n) \left(1+\frac{1}{2+n}\right)^{-4-n},\Re\left(\frac{1 }{2+n}\right)>-1\right]$
Again, with the alternative manual replacement, Mathematica is able to do the integral. This means that this is also not the representation chosen automatically by Mathematica inside the integral (because whatever it is, it doesn't allow computation of the integral, as shown above).
Clearly, I don't have a definitive answer as to what Mathematica does internally. Instead, I am just eliminating some possibilities that could be generically valid.
-
$\begingroup$ Well, the Laguerre function can be represented through either the Kummer or Tricomi confluent hypergeometric function; I suppose it will use the Tricomi representation in the case that one would need to take a limit with the Kummer representation. $\endgroup$ Commented Aug 9, 2015 at 4:09
-
1