[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: acosh, getting consistent results from GSL and Guile
From: |
Neil Jerram |
Subject: |
Re: acosh, getting consistent results from GSL and Guile |
Date: |
Fri, 18 Aug 2006 14:55:27 +0100 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
"Marco Maggi" <address@hidden> writes:
> Ciao,
>
> on the GNU Scientific Library mailing list I asked the
> following:
>
>>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. [...]
>>
>>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, [...]
>
> and got the following reply:
>
>>There are different branch cut conventions used
>>by different programs. acosh or other inverse
>>functions are mutiple-valued functions so the
>>result is not uniquely defined.
>>
>>GSL uses one of the two common conventions
>>(W.Kahan's) because it has better consistency with
>>IEEE arithmetic. It is also used by Common
>>Lisp -- see the GSL Reference manual for details and
>>references. The others are using a different
>>convention (Abramowitz & Stegun). As such, all the
>>answers are correct.
>
> So, do you suggest me to override the GSL function to
> make it equal to the Guile one, or vice versa?
It depends on the context of the problem you are trying to solve.
It's some time since I was doing this kind of maths, but if I remember
correctly, the fact that there are multiple possible values usually
maps on to something meaningful in your problem domain.
Regards,
Neil