[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Bessel functions and continued fractions
From: |
Jonny Taylor |
Subject: |
Re: [Help-gsl] Bessel functions and continued fractions |
Date: |
Fri, 6 Aug 2010 12:26:50 +0100 |
Thanks for your reply Brian.
>> Is there anybody where who knows the ins and outs of the Bessel
>> function implementation in GSL? Under certain circumstances my code
>> is spending over 90% of its time in gsl_sf_bessel_J_CF1. This occurs
>> for large x<1000 and n<50. The time taken to evaluate the continued
>> fraction grows with x.
>
> Can you send a test case where it's really bad for adding to the test
> suite (specfunc/test_bessel.c), I appreciate that it's a performance
> problem rather than an accuracy problem but it's easiest to keep track
> of it if it's in there. Are the results actually accurate? Usually
> these excessive numbers of iterations are a sign of poor convergence.
The following is demonstrates the problem:
/* Testcase demonstrating long calculation time:
Time spent in gsl_sf_bessel_J_CF1 for large x<1000 and n<5
grows in proportion to x */
TEST_SF(s, gsl_sf_bessel_Jn_e, (45, 900.0, &r), 0.02562434700634278108,
TEST_TOL0, GSL_SUCCESS);
The results do appear to be accurate (the reference value here is taken from
Mathematica) in spite of the large number of iterations.
>> Is there a reason that CF2 is not used in GSL? I don't know about
>> the reasoning behind the implementation and the regimes where each
>> of the various evaluation methods are used. Is there a reason for
>> not using CF2 in the appropriate circumstances, or is it just that
>> nobody has felt the need to implement it up to now?
>
> I do not know about the choices behind it, the original author was
> address@hidden If you can make a CF2 patch which is faster and
> passes the test suite that would be the way forward.
Unfortunately it turns out I wasn't reading things properly. Although CF2
converges faster in some cases, it cannot on its own be used to calculate Jn: I
was misunderstanding what I was reading. Sadly there does not appear to be an
obvious way of speeding things up.
Jonny