Package: mit-scheme
Version: 9.0.1-1
For small values of z, real or complex,
atan(z) = z + O(z^2)
because atan(0)=0 and atan'(0)=1 and atan is analytic.
However, small *imaginary* components of z are suffering from drastic
loss of precision.
$ mit-scheme
Image saved on Tuesday March 9, 2010 at 6:59:21 PM
Release 9.0.1 || Microcode 15.1 || Runtime 15.7 || SF 4.41 ||
LIAR/x86-64 4.118 || Edwin 3.116
1 ]=> (atan +1e-80)
;Value: 1e-80
1 ]=> (atan +1e-17i)
;Value: +0.i
1 ]=> (atan +1e-16i)
;Value: +5.551115123125783e-17i
1 ]=> (atan +1e-15i)
;Value: +1.0547118733938987e-15i
1 ]=> (atan +1e-10i)
;Value: +1.000000082740371e-10i
1 ]=> (atan +1e-5i)
;Value: +1.0000000000343332e-5i
1 ]=> (atan +1e-80+1e-18i)
;Value: 1e-80+0.i
I have not examined the source code, but one common cause of this
problem is the imaginary component of z being extracted and added to 1
before being passed to log. Something like
... (log (+ 1 (imag-part z))) ...
If that is the issue here, I would suggest using the C math library
function log1p(3), which avoids this such loss of precision.
--Barak.
--
Barak A. Pearlmutter
Hamilton Institute & Dept Comp Sci, NUI Maynooth, Co. Kildare, Ireland
http://www.bcl.hamilton.ie/~barak/
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]