import numberdb.sage as numberdb
from sage.rings.integer_ring import ZZ
from sage.rings.polynomial.polynomial_ring_constructor import PolynomialRing
R = PolynomialRing(ZZ, names=('x', 'c'))
x, c = R.gens()
def lommel(n):
if n < 0:
raise ValueError('n must be nonnegative')
a, b = R.one(), c*x
if n == 0:
return a
for k in range(1, n):
a, b = b, (c+k)*x*b-a
return b
lommel(15)All coefficients were computed by the recurrence in exact integer polynomial arithmetic. A separately implemented finite sum from Dai, Ismail and Wang, equation (3.4), agrees with every full coefficient vector, including the entries read back from the database. Native coefficient types and deliberately inexact coefficients were checked.
Supplementary checks evaluate both Bessel connection identities at 640-bit ball precision for every stored positive degree, $c=1/2,1,3/2,2$ and $z=1/2,2,5$. All 336 residual enclosures contain zero and have radius below $10^{-110}$; finite and non-vacuous controls are included. Exact finite continued fractions were checked at every positive stored degree. Twelve normalized monic moments at $c=1,3/2$ agree by weighted Dyck paths, the $\,{}_0F_1$ quotient and the corresponding stored Rayleigh sums. These finite checks supplement the cited identities; they do not prove universal assertions. The attached generator and check code preserve the methods and negative controls.