[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Besseli Function
From: 
John W. Eaton 
Subject: 
Re: Besseli Function 
Date: 
Tue, 9 Sep 2003 11:31:54 0500 
On 9Sep2003, David Bateman <address@hidden> wrote:
 My question is then, why not just used the scaled calculation always? A quick
 test with the unpatched code shows that there seems to be little speed
 difference.
 octave:1> x = 20*rand(100,100)10; tic; y0 = airy(0,x); toc
 ans = 0.14151
 octave:2> x = 20*rand(100,100)10; tic; y1 = exp(  2. / 3. .* x .*
sqrt(x)).*airy(0,x,true); toc
 ans = 0.13462

 Is there possibly a problem with precision?
Perhaps. It would help if someone could do some checking. I did a
spot check of besseli (0, x) and found that for some numbers in the
range x = 79.5:0.0001:80, one method was off from the other by 1e+17,
but the result value is on the order of 1e+33, so the relative error
is less than eps, which should be OK.
 If not I propose to just used
 the scaled calculations always internally, and return the scaled or unscaled
 values depending on the the optional argument..
I think this is a good solution unless some checks reveal big
differences in the results. Then you can still get the
scaled result back if that's what you want. And we are probably doing
a reasonable job of computing the unscaled results too.
Thanks,
jwe

Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
