comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » IDL's BESELJ returns NAN for small argument and large order
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: IDL's BESELJ returns NAN for small argument and large order [message #88112 is a reply to message #88072] Thu, 20 March 2014 17:27 Go to previous message
dg86 is currently offline  dg86
Messages: 118
Registered: September 2012
Senior Member
On Tuesday, March 18, 2014 7:47:28 PM UTC-4, Phillip Bitzer wrote:
> "That's not a bug, it's a feature" :-)
>
>
>
> The reason you get a NaN can be found in the help:
>
>
>
> ITER
>
> Set this keyword equal to a named variable that will contain the number of iterations performed. If the routine converged, the stored value will be equal to the order N. If X or N are arrays, ITER will contain a scalar representing the maximum number of iterations.
>
> Note: If the routine did not converge for an element of X, the corresponding element of the Result array will be set to the IEEE floating-point value NaN, and ITER will contain the largest order that would have converged for that X value.
>
>
>
> So,
>
> IDL> print,beselj(0.1d,103.d, ITER=n)
>
> IDL> print, n ;get n=102
>
>
>
> So, the algorithm properly converges for order 102, but not 103+. This is why get a number for your second example.

This is a pretty crummy feature, even if it is documented. IDL's implementation of Bessel functions is not nearly so comprehensive as python's (using the mpmath package) or Mathematica's. Even if the bad behavior is documented, it's still bad. These seemingly extreme cases come up regularly in light-scattering calculations, so they're not outlandish.

The developers should update IDL's special functions to bring them up to industry standards. The present Numerical Recipes implementations are not up to that level. The new versions of the Bessel functions might even be spelled correctly, leaving the oddly speled versions for backward compatibility.

Just my 2c,

David
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to cleanup an object with a non-modal widget method
Next Topic: IDLnetURL to test for files

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 20:05:02 PDT 2025

Total time taken to generate the page: 0.00918 seconds