using CL complex numbers ... was Re: Failures in share_testsuite



Dieter Kaiser wrote:
> Am Donnerstag, den 06.05.2010, 19:49 -0500 schrieb Barton Willis:
>
>   
>> It seems that some CL complex numbers sneak into Maxima:
>>     
It has been my hope for some time that CL complex numbers and CL 
rational numbers
will become standard in Maxima.  There are many positive performance 
aspects, but a
few downsides.

a+b*%i  will have a main operator of "+", and if you ask what is the 
coefficient of %i, it is b.
3+4*%i  will be a lisp numeric atom #c(3 4) and it does not have an 
operator "+" in it. 

3.0b0+4.0b0*%i  has a main operator of "+", because the lisp #c( ) 
construction does not allow bigfloats.

One possibility may be to set %i  to the CL imaginary unit,  #c(0 1) and 
see how far we can run with that.
I think it is problematical however. How exactly, I don't know, but we 
could try it by setting %i to that value,
and patching the format/display programs to set it back.

For rationals,  there is probably an easier transition because 3/4 
already is ((mrat) 3 4)  and does not
so much in common with a/b.  Even though the appearance is similar, a/b  
is internally
((mtimes simp) $a ((mexpt simp) $b -1)), which is quite different.  
Somehow we have
accomodated to this.

While I am listing downsides, here's an issue with using CL rationals:
I have, in the past, advocated using an extension of the rationals (in 
CL and/or Maxima), so that
we allow a rational infinity (1/0),  negative infinity (-1/0), undefined 
(0/0) in our number field.

The odd thing is that if we do arithmetic on these guys, noting that 
gcd(a,0)= a,  gcd(0,0)=0,  [which is standard],
and just do the normal thing, we have an arithmetic system with infinity 
in it. An interesting side effect is
that ordinary rational arithmetic possibly runs faster because we don't 
have to check for division by zero.

RJF