Mantis - ALGLIB
Viewing Issue Advanced Details
10 Spec.functions major always 2009-03-10 21:02 2009-07-23 12:42
SergeyB  
SergeyB  
normal  
resolved  
fixed  
none    
none 2.0  
All
0000010: FIXED: modified Besel function returns incorrect results
From: Kors van der Werf < korsvanderwerf@yahoo.com >

Hi,

Very nice, ythis ALGLib. I use the VB version for now, and it seems the Modified BesselI funtion for orders of negative half integers do not give proper results, can you have a look?

Already order = -0.5 fails, and can be compared to the well known sqrt(2/(PI x)) cosh(x)

For x=1 it should be 1.2312, I get 0.293525.

Could you ahve a look please.
Issue History
2009-03-10 21:02 SergeyB New Issue
2009-03-10 21:02 SergeyB Programming language => VBA
2009-03-10 21:50 SergeyB Status new => assigned
2009-03-10 21:50 SergeyB Assigned To => SergeyB
2009-03-10 21:54 SergeyB Assigned To SergeyB =>
2009-03-10 21:55 SergeyB Status assigned => new
2009-03-11 10:20 SergeyB Status new => assigned
2009-03-11 10:20 SergeyB Assigned To => SergeyB
2009-03-11 10:21 SergeyB Note Added: 0000006
2009-03-11 10:21 SergeyB Status assigned => confirmed
2009-03-11 10:21 SergeyB Reproducibility have not tried => always
2009-03-11 12:04 SergeyB Programming language VBA => All
2009-03-11 12:15 SergeyB Note Added: 0000007
2009-03-11 12:15 SergeyB Status confirmed => resolved
2009-03-11 12:15 SergeyB Fixed in Version => Next minor release
2009-03-11 12:15 SergeyB Resolution open => fixed
2009-03-11 12:17 SergeyB Note Edited: 0000007
2009-03-11 14:12 SergeyB Note Edited: 0000007
2009-03-11 23:36 SergeyB Note Added: 0000008
2009-03-11 23:36 SergeyB Status resolved => feedback
2009-03-11 23:36 SergeyB Resolution fixed => reopened
2009-04-19 11:07 SergeyB Note Added: 0000010
2009-04-19 11:07 SergeyB Status feedback => resolved
2009-04-19 11:07 SergeyB Resolution reopened => fixed
2009-04-20 09:42 SergeyB Summary modified Besel function returns incorrect results => FIXED: modified Besel function returns incorrect results
2009-04-20 09:47 SergeyB Target Version => Upcoming release
2009-07-23 12:42 SergeyB Category => Special functions

Notes
(0000006)
SergeyB   
2009-03-11 10:21   
Confirmed: should be 1.2312, returns 0.2935
(0000007)
SergeyB   
2009-03-11 12:15   
(edited on: 2009-03-11 14:12)
Fixed.

There was an error in original Cephes code when calculating 1F1(v,2*v,2*x) with v=0. Straightforward formula for 1F1 may return 1.0 or NAN (depending on implementation, 1.0 in Cephes), more elaborate calculations gives us 0.5*(1+exp(2*x)).

This error can only happen when v=-0.5, should be OK with other values of v.

(0000008)
SergeyB   
2009-03-11 23:36   
Other negative half-integer values should be fixed also...
(0000010)
SergeyB   
2009-04-19 11:07   
Looks like that this subroutine can't calculate modified Bessel functions of negative orders. It is not a bug - it is a limitation of formula used.

I've modified documentation...