[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] Bug in gsl_sf_coulomb_wave_F_array

From: Hongcheng Ni
Subject: [Bug-gsl] Bug in gsl_sf_coulomb_wave_F_array
Date: Tue, 17 Nov 2015 18:14:39 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

Dear GSL developers,

I found a bug in the function gsl_sf_coulomb_wave_F_array which uses the recurrence relation to obtain F for different l's. To be short, when eta is large, and l is at least moderately large, inaccuracy occurs in the implementation of the recurrence such that F has unphysical spikes at certain x for smaller l's. My observation is that F is determined directly for the largest l, and F for smaller l's are determined from the recurrence relation. When l is large, the number of recurrence is large to obtain F for small l's. Therefore, errors in F's get accumulated as we proceed to get F for small l's.

Attached please find a test program.
The program uses two methods to obtain F for different l's and x's.
The first method obtains F directly, and the second method obtains F from recurrence relation.

Please compile it using "g++ testCoulomb.cpp -lgsl -lgslcblas".
Now run the program using "./a.out > resultCoulomb".
We can now take a look at the output of the program using gnuplot.
After launching gnuplot, just type plot "resultCoulomb" using 1:2 every ::2::2000 to see the output for l=0 at different x's using the first method. And type plot "resultCoulomb" using 1:2 every ::2002::4000 to see the output for l=0 at different x's using the second method.

Now you can find, F is fine using the first method, but F has unphysical spikes. You can see similar behaviors for other l's by "using 1:3", "using 1:4" etc in gnuplot.

I can of course always stick to the first method, but the second method is much faster.
So it would be great if you could fix this problem.

Thanks a lot!

Best regards,
Hongcheng Ni
Max-Planck-Institut für Physik komplexer Systeme
Nöthnitzer Str. 38, 01187 Dresden, Germany

Attachment: testCoulomb.cpp
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]