login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for #138 asin(complex(1.0,0.0)) revision 1 of 4

1 2 3 4
Editor:
Time: 2007/11/17 21:56:50 GMT-8
Note:

changed:
-
In trigcat.spad.pamphlet:
<br/>
asin x == atan(x/sqrt(1-x**2))
<br>
\begin{axiom}
asin(1.0)
asin(complex(1.0,0.0))
\end{axiom}

Transferred from savannah.



From unknown Thu Mar 31 12:53:55 -0600 2005
From: unknown
Date: Thu, 31 Mar 2005 12:53:55 -0600
Subject: Savannah
Message-ID: <20050331125355-0600@page.axiom-developer.org>

bug #10115 (project axiom)

From unknown Fri Apr 1 16:59:14 -0600 2005
From: unknown
Date: Fri, 01 Apr 2005 16:59:14 -0600
Subject: 
Message-ID: <20050401165914-0600@page.axiom-developer.org>

This and the log(i)-log(-i) bug can be fixed by using GCL's asin and log here.  I tried:: 

     if \$ has Field and \$ has sqrt: \$ -> \$ then
--       asin x == atan(x/sqrt(1-x**2))
       asin x == ASIN(COMPLEX(real x,imag x)\$Lisp)\$Lisp

but the form of x when complex in axiom is not that of lisp, i.e. asin gets passed a non-number::

   >> System error:
   ((1 . 0) 0 . 0) is not of type NUMBER.


In general, I think it a good idea to avoid having to duplicate the functionality of the standard lisp functions in axiom, but there may be some philosophical reason for doing this due to the domain structures or some such.  If one needs the correct logic for a duplicate implementation, one can look at the gcl_numlib.lsp file in the lsp/ subdirectory.





From unknown Fri Apr 1 18:10:49 -0600 2005
From: unknown
Date: Fri, 01 Apr 2005 18:10:49 -0600
Subject: ...
Message-ID: <20050401181049-0600@page.axiom-developer.org>
In-Reply-To: <20050401165914-0600@page.axiom-developer.org>

No, here it is a Complex(Float), the implementation of float allow arbitrary precision, Common Lisp no.
Morever, it'a generic implementation (in a category)

From unknown Fri Apr 1 20:11:49 -0600 2005
From: unknown
Date: Fri, 01 Apr 2005 20:11:49 -0600
Subject: 
Message-ID: <20050401201149-0600@page.axiom-developer.org>

OK, then what we want is something like::

       asin x == - %i * log( %i * x + sqrt(1 - x*x))

but this does not appear to be used when put into trigcat.spad.pamphlet and recompiling.  Perhaps someone could explain?

Secondly, perhaps ist is of use to bring forward GMP/mpfr optimized multi-precision floating point in GCL for use by axiom here?

I understand the multi-precision argument, but is there a difference between a "generic imlementation" and the lisp one where the category of the domain coincides precisely with the lisp type?

Lastly, do we have to use this difficult interface as opposed to the developer email list?

take care,

From unknown Fri Apr 1 20:48:10 -0600 2005
From: unknown
Date: Fri, 01 Apr 2005 20:48:10 -0600
Subject: ...
Message-ID: <20050401204810-0600@page.axiom-developer.org>
In-Reply-To: <20050401201149-0600@page.axiom-developer.org>

'take care' ... Yes I think it's a good idea to add mpfr to gcl
<br />
Regards

From kratt6 Sat Apr 2 03:21:44 -0600 2005
From: kratt6
Date: Sat, 02 Apr 2005 03:21:44 -0600
Subject: 
Message-ID: <20050402032144-0600@page.axiom-developer.org>

I believe furthermore, that the problem with 'argument' as described in bug #47 will persist if we fix it this way.

I think that a lot of care has to be taken if we use Lisp functions instead of "homegrown" ones.

Concerning the place of discussion, I too think that it would be better 
to:

  - ask on axiom-developer whether it is really an issue, if this is not clear

  - signal the issue on IssueTracker

  - discuss it on axiom-developer

  - add proposed fixes on IssueTracker.

Since any change on IssueTracker will notify axiom-developer, there is no danger of missing anything.

From kratt6 Sat Apr 2 04:07:13 -0600 2005
From: kratt6
Date: Sat, 02 Apr 2005 04:07:13 -0600
Subject: 
Message-ID: <20050402040713-0600@page.axiom-developer.org>

I think that the following definition would 
work::

       asin x == if x = 1 then pi()/2::$ else atan(x/sqrt(1-x**2))

There is one thing that puzzles me, though. Also in 'TRANFUN', the following definition is given for 'pi()' ::

       pi()   == 2*asin(1)

which seems to be asking for trouble. However, I couldn't find a domain that would use this definition for 'pi()'. Maybe it should be rather defined in terms of 'atan'?

Submitted by : (unknown) at: 2007-11-17T21:56:50-08:00 (16 years ago)
Name :
Axiom Version :
Category : Severity : Status :
Optional subject :  
Optional comment :

In trigcat.spad.pamphlet:
asin x == atan(x/sqrt(1-x**2))

axiom
asin(1.0)
LatexWiki Image(1)
Type: Float
axiom
asin(complex(1.0,0.0)) >> Error detected within library code: catdef: division by zero

Transferred from savannah.

bug #10115 (project axiom)

This and the log(i)-log(-i) bug can be fixed by using GCL's asin and log here. I tried:
     if $ has Field and $ has sqrt: $ -> $ then
--       asin x == atan(x/sqrt(1-x**2))
       asin x == ASIN(COMPLEX(real x,imag x)$Lisp)$Lisp

but the form of x when complex in axiom is not that of lisp, i.e. asin gets passed a non-number:

   >> System error:
   ((1 . 0) 0 . 0) is not of type NUMBER.

In general, I think it a good idea to avoid having to duplicate the functionality of the standard lisp functions in axiom, but there may be some philosophical reason for doing this due to the domain structures or some such. If one needs the correct logic for a duplicate implementation, one can look at the gcl_numlib.lsp file in the lsp/ subdirectory.

No, here it is a Complex(Float), the implementation of float allow arbitrary precision, Common Lisp no. Morever, it'a generic implementation (in a category)

OK, then what we want is something like:
       asin x == - %i * log( %i * x + sqrt(1 - x*x))

but this does not appear to be used when put into trigcat.spad.pamphlet and recompiling. Perhaps someone could explain?

Secondly, perhaps ist is of use to bring forward GMP/mpfr optimized multi-precision floating point in GCL for use by axiom here?

I understand the multi-precision argument, but is there a difference between a "generic imlementation" and the lisp one where the category of the domain coincides precisely with the lisp type?

Lastly, do we have to use this difficult interface as opposed to the developer email list?

take care,

take care ... Yes I think it's a good idea to add mpfr to gcl
Regards

I believe furthermore, that the problem with argument as described in bug #47 will persist if we fix it this way.

I think that a lot of care has to be taken if we use Lisp functions instead of "homegrown" ones.

Concerning the place of discussion, I too think that it would be better to:

  • ask on axiom-developer whether it is really an issue, if this is not clear
  • signal the issue on IssueTracker?
  • discuss it on axiom-developer
  • add proposed fixes on IssueTracker?.

Since any change on IssueTracker? will notify axiom-developer, there is no danger of missing anything.

I think that the following definition would work:
       asin x == if x = 1 then pi()/2::$ else atan(x/sqrt(1-x**2))

There is one thing that puzzles me, though. Also in TRANFUN, the following definition is given for pi() :

       pi()   == 2*asin(1)

which seems to be asking for trouble. However, I couldn't find a domain that would use this definition for pi(). Maybe it should be rather defined in terms of atan?