unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* acosh, getting consistent results from GSL and Guile
@ 2006-08-18  5:53 Marco Maggi
  2006-08-18 13:55 ` Neil Jerram
  0 siblings, 1 reply; 4+ messages in thread
From: Marco Maggi @ 2006-08-18  5:53 UTC (permalink / raw)


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?


--
Marco Maggi

"They say jump!, you say how high?"
Rage Against the Machine - "Bullet in the Head"



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: acosh, getting consistent results from GSL and Guile
  2006-08-18  5:53 acosh, getting consistent results from GSL and Guile Marco Maggi
@ 2006-08-18 13:55 ` Neil Jerram
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Jerram @ 2006-08-18 13:55 UTC (permalink / raw)
  Cc: guile-user

"Marco Maggi" <marco.maggi-ipsu@poste.it> 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



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: acosh, getting consistent results from GSL and Guile
       [not found] <0J470098NBGDU4@imap0.epfl.ch>
@ 2006-08-18 16:25 ` Daniel Llorens del Río
  2006-08-18 23:18   ` Kevin Ryde
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Llorens del Río @ 2006-08-18 16:25 UTC (permalink / raw)



On 18 Aug, 2006, at 18:07, guile-user-request@gnu.org wrote:

>> 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?

Myself, I'd be happy if only things like this didn't happen:

guile> (tanh 1e3+i)
+nan.0

  - Daniel



_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: acosh, getting consistent results from GSL and Guile
  2006-08-18 16:25 ` Daniel Llorens del Río
@ 2006-08-18 23:18   ` Kevin Ryde
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Ryde @ 2006-08-18 23:18 UTC (permalink / raw)


Daniel Llorens del Río <daniel.llorensdelrio@epfl.ch> writes:
>
> Myself, I'd be happy if only things like this didn't happen:
>
> guile> (tanh 1e3+i)
> +nan.0

Perhaps the libc ctanh() etc could be used when available ... let
somebody else worry about overflows.


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-08-18 23:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-18  5:53 acosh, getting consistent results from GSL and Guile Marco Maggi
2006-08-18 13:55 ` Neil Jerram
     [not found] <0J470098NBGDU4@imap0.epfl.ch>
2006-08-18 16:25 ` Daniel Llorens del Río
2006-08-18 23:18   ` Kevin Ryde

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).