-- j0 and j1 against their closed forms print(" x j0(x) sin(x)/x j1(x) sin(x)/x^2-cos(x)/x") for _, x in ipairs({0.001, 0.5, 2, 10, 100}) do local j0 = math.SphericalBesselJ(0, x) local j1 = math.SphericalBesselJ(1, x) print(string.format("%7.3f %18.15f %18.15f %18.15f %18.15f", x, j0, math.sin(x)/x, j1, math.sin(x)/x^2 - math.cos(x)/x)) end print(math.SphericalBesselJ(0, 0), math.SphericalBesselJ(3, 0))