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

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

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


Type: Float

Type: Complex(Float)

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

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?

See also #333. There seems to be a fix proposed there.

From #333:

patch possible. --Francois Maltey, Fri, 05 Jan 2007 07:57:48 -0600 reply
I propose to remplace in asin x == atan (x/sqrt(1-x**2)) in trigcat.spad line 162 by

       asin x ==
         x=1  => 2<em>atan 1
         x=-1 => -2</em>atan 1

The result seems right...

Status: open => fix proposed

  Subject:   Be Bold !!
  ( 14 subscribers )  
Please rate this page: