I'm not sure what you mean by "suffers underflow" -- do you get an error? If so, you might look into gsl_ieee_env_setup () and mask-underflow.
Liam On Wed, Jul 16, 2008 at 8:42 AM, Jonny Taylor <[EMAIL PROTECTED]> wrote: > Please can somebody advise on using gsl_sf_bessel_Jn_array for small z? > > I need to generate Bessel functions up to some n_max (of order 50) for > arbitrary z. I run into problems for small z because the function uses a > downward recurrence to populate the array, and suffers underflow for large > n. > > It is not a problem for me if underflow occurs at high n: I am computing a > sum, and if underflow occurs for some n then that will definitely not affect > the overall result. > > What I presume I need to do is to determine what n (<= n_max) I need to pass > to gsl_sf_bessel_Jn_array in order to avoid underflow. Unfortunately that > doesn't seem to be trivial to compute (which is not really surprising). The > best strategies I can come up to are to use a lookup which gives the minimum > z which works for a given cutoff n, or to just try calling > gsl_sf_bessel_Jn_e for some trial n and then reducing n if I get an error. > That is not ideal, though, as I'll need to install an error handler and I > want to do this in threaded code. > > Can anybody suggest a better strategy to take? It seems like this should be > a relatively simple thing to ask, but I can't come up with a simple way of > achieving it... > > Thanks > Jonny > > > _______________________________________________ > Help-gsl mailing list > [email protected] > http://lists.gnu.org/mailman/listinfo/help-gsl > _______________________________________________ Help-gsl mailing list [email protected] http://lists.gnu.org/mailman/listinfo/help-gsl
