From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: acosh, getting consistent results from GSL and Guile Date: Fri, 18 Aug 2006 14:55:27 +0100 Message-ID: <878xlm2lo0.fsf@ossau.uklinux.net> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1155909482 27612 80.91.229.2 (18 Aug 2006 13:58:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 18 Aug 2006 13:58:02 +0000 (UTC) Cc: guile-user Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Fri Aug 18 15:58:01 2006 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GE4qa-00068N-G9 for guile-user@m.gmane.org; Fri, 18 Aug 2006 15:57:16 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GE4qZ-0003tY-VR for guile-user@m.gmane.org; Fri, 18 Aug 2006 09:57:16 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GE4pv-0003d9-D2 for guile-user@gnu.org; Fri, 18 Aug 2006 09:56:35 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GE4pt-0003c0-De for guile-user@gnu.org; Fri, 18 Aug 2006 09:56:34 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GE4ps-0003bi-Uk for guile-user@gnu.org; Fri, 18 Aug 2006 09:56:32 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GE4wb-00011X-Fm for guile-user@gnu.org; Fri, 18 Aug 2006 10:03:29 -0400 Original-Received: from laruns (host86-129-125-104.range86-129.btcentralplus.com [86.129.125.104]) by mail3.uklinux.net (Postfix) with ESMTP id E113540A7A6; Fri, 18 Aug 2006 13:56:23 +0000 (UTC) Original-Received: from laruns (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 8EF386FF59; Fri, 18 Aug 2006 14:55:28 +0100 (BST) Original-To: "Marco Maggi" In-Reply-To: (Marco Maggi's message of "Fri, 18 Aug 2006 07:53:00 +0200") User-Agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:5455 Archived-At: "Marco Maggi" 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