Why two the same integrals give different values?
Psi[r_, n_] := (-1)^n *Exp[-1/2 *r^2] *Sqrt[2 *n!/Gamma[n + 3/2]]*
LaguerreL[n, 1/2, r^2];
KA[n1_, n2_] :=
0.0032433*Integrate[Psi[r, n2]*r^2*Psi[r, n1]*r^2, {r, 0, Infinity}]
KA[87, 12]
Out[1356]= 0.
Psi[r_, n_] := (-1)^n *Exp[-1/2 *r^2] *Sqrt[2 *n!/Gamma[n + 3/2]]*
LaguerreL[n, 1/2, r^2];
KA[n1_, n2_] :=
Integrate[Psi[r, n2]*0.0032433*r^2*Psi[r, n1]*r^2, {r, 0, Infinity}]
KA[87, 12]
Out[1352]= 6.14098*10^21
```
NIntegrate
, which uses a numerical approximation. Not sure why it fails so drastically. It is very oscillatory, but even on intervals far to the right I get absurdly large integrals. You might want to consider to send this example to Wolfram Support. $\endgroup$FindSequenceFunction
to discover exact expressions. In your case,ka[n_, n_] = 2 n + 3/2; ka[n1_, n2_] /; Abs[n1 - n2] == 1 = Sqrt[(n1 + n2 + 1) (n1 + n2 + 2)]/2; ka[_, _] = 0;
(I've left out the numerical prefactor of $0.0032433$). I know this wasn't your question; but very generally, finding such regularities is more useful than actually integrating. $\endgroup$