[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] acosh, getting consistent results from GSL and Guile
From: |
Marco Maggi |
Subject: |
[Help-gsl] acosh, getting consistent results from GSL and Guile |
Date: |
Sat, 12 Aug 2006 08:37:12 +0200 |
Ciao,
for some values of the operand I get different results
from 'acosh' when using GSL (1.8), Guile (1.8) and GNU
Octave (2.1.63). Other functions give me different results,
too. Below is the output of my tests. I am not at all a
math expert.
Browsing Wikipedia for acosh formulas it seems to me that
GSL is using an equivalent of:
(log (- x (sqrt (- (* x x) 1))))
while the others are using an equivalent of:
(log (+ x (sqrt (- (* x x) 1))))
I'm interested in having equal results from GSL and Guile,
specifically I would like GSL to yield the same results of
Guile, not vice versa. I am writing a Guile interface to
GSL (do not criticise me on this, please).
I am thinking about replacing 'gsl_complex_arccosh()' (and
some other functions) with my own implementation, but I
would like to know if there is a specific reason for the
different choice in GSL.
Thank You.
*** GSL test of function acosh
acosh(1.000000+0.000000i) = -0.000000+0.000000i
acosh(1.234000+1.234000i) = 1.259714+0.865731i
acosh(0.000000+1.000000i) = 0.881374+1.570796i
acosh(-1.234000+1.234000i) = 1.259714+2.275862i
acosh(-1.000000+0.000000i) = -0.000000+3.141593i
acosh(-1.234000+-1.234000i) = 1.259714+-2.275862i
acosh(0.000000+-1.000000i) = 0.881374+-1.570796i
acosh(1.234000+-1.234000i) = 1.259714+-0.865731i
acosh(-5.000000+0.000000i) = 2.292432+3.141593i
acosh(-10.000000+0.000000i) = 2.993223+3.141593i
*** Guile test of function acosh
acosh(1.000000+0.000000i) = 0.000000+0.000000i
acosh(1.234000+1.234000i) = 1.259714+0.865731i
acosh(0.000000+1.000000i) = 0.881374+1.570796i
acosh(-1.234000+1.234000i) = -1.259714-2.275862i
acosh(-1.000000+0.000000i) = 0.000000+3.141593i
acosh(-1.234000-1.234000i) = -1.259714+2.275862i
acosh(0.000000-1.000000i) = -0.881374+1.570796i
acosh(1.234000-1.234000i) = 1.259714-0.865731i
acosh(-5.000000+0.000000i) = -2.292432+3.141593i
acosh(-10.000000+0.000000i) = -2.993223+3.141593i
With formulas from www.wikipedia.org, acosh(-5):
-2.29243166956117+3.14159265358979i plus version
2.29243166956118+3.14159265358979i minus version
*** Octave test of function acosh
acosh(1.000000+0.000000i) = 0.000000+0.000000i
acosh(1.234000+1.234000i) = 1.259714+0.865731i
acosh(0.000000+1.000000i) = 0.881374+1.570796i
acosh(-1.234000+1.234000i) = -1.259714+-2.275862i
acosh(-1.000000+0.000000i) = 0.000000+3.141593i
acosh(-1.234000+-1.234000i) = -1.259714+2.275862i
acosh(-0.000000+-1.000000i) = -0.881374+1.570796i
acosh(1.234000+-1.234000i) = 1.259714+-0.865731i
acosh(-5.000000+0.000000i) = -2.292432+3.141593i
acosh(-10.000000+0.000000i) = -2.993223+3.141593i
--
Marco Maggi
"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"
- [Help-gsl] acosh, getting consistent results from GSL and Guile,
Marco Maggi <=