j0 (and y0) in the range 2 <= x < (p/2)*log(2)

Bruce Evans brde at optusnet.com.au
Thu Sep 6 16:02:32 UTC 2018

On Wed, 5 Sep 2018, Steve Kargl wrote:

> On Thu, Sep 06, 2018 at 04:09:05AM +1000, Bruce Evans wrote:
>> On Wed, 5 Sep 2018, Steve Kargl wrote:
>>> I've scoured the literature and web for methods of computing
>>> Bessel functions.  These functions are important to my real
>>> work.  I have not found any paper, webpage, documentation, etc.
>>> that describes what "the related functions" are.
>> They are just the functions in the asymptotic expansion with errors corrected
>> as I discussed.
> And as I noted, there is no documentation stating the approximations
> pzero(x) and qzero(x) aren't approximations for the asymptotic series
> P0(x) and Q0(x).  If you are correct, then pzero(x) and qzero(x) are
> approximations to fudge*P0(x) and fudge*Q0(x).  What fudge is and how
> it is determined is not documented.

The documentation (comments in the source code) is indeed deficient.  It
is too verbose about routine general methods but says little about non-
routine things.

I now think that no single fudge factor works for both P0 and Q0.  P0
and Q0 have very different characteristics.  Merely choosing the
truncation point for the asymptotic expansion makes them very different.
One thing that can go wrong is that if you truncate to more than about
5 terms, a zero point for one or both of P0 and Q0 ends up in the
subinterval being handled.  The fudge factor would need to be nearly
infinite to compensate for the zero, and since P0 and Q0 won't have
the zero at the same place, the compensation for one would destroy the

The infinities show up in attempts to calculate the fudge factor near the

When P0 is truncated after the s^14 term, then on [2, 2.857] P0 (1/x)
is strictly increasing from -5.61 to 0.95, with the zero in the middle
giving singularities, but pzero is strictly increasing from 1 - 0.013 to
1 - 0.007.  However, when P0 is truncated after the s^6 term, it is
similar to pzero (strictly increasing from 1 - 0.019 to 1 - 0.009).
pzero is apparently based on the latter P0.

To find different fudge factors, I would try starting with a common one
and then iteratively adjust to different ones.

j0 has a zero in the middle of at least the first subinterval, and the
relative error should be minimized for this.  I think the choice of
subintervals is related to this.  With only one zero per subinterval,
the relative error near it can be minimized without messing up the
relative error near other zeros.  The adjustment for this is absolutely
tiny, so it is easier to arrange that it doesn't mess up the absolute
error too much.


More information about the freebsd-numerics mailing list