Rational Numbers, was Re: [Maxima-commits] CVS: maxima/src gamma.lisp, 1.44, 1.45.



Raymond Toy wrote:..
...
> Is there a fundamental reason that there should only be one (XXX simp)? 
> Was this just to save memory? 
That was the original reason.
With today's computers I suppose it will also save time because it may 
reduce memory cache activity.
>  We've probably inadvertently flushed the
> msimpind idea from Maxima anyway.  But I do see that eqtest has a check
> for msimpind.
>
>   
>> My suggestion  (I have occasionally implemented this in some 
>> experiments) is to use common lisp rational numbers for maxima rational 
>> numbers.
>> It is easy to do with a few patches, but the question remains as to 
>> whether all places have been fixed.  Note that (div 1 2) could be easily
>> fixed to return the common lisp rational number 1/2 .   finding all 
>> occurrences of  '((rat simp) 1 2)  would be more difficult.
>>
>>   
>>     
> I think using Lisp rational numbers should be done. 
OK, I agree.  (There is one argument in favor of keeping ((rat ) n d) 
that I know of.  And that is we could
in principle, have rational number-like object that are an extension of 
common lisp rationals.  These are,
in particular, ((rat) 1 0)   for  "infinity"   and ((rat) 0 0)  for 
"undefined".  It turns out that these extended rational
numbers have some nice properties and combine with the regular numbers 
neatly.  But not entirely neatly.)


>  Perhaps we can do
> this after the next release? This gives us several months to find and
> fix all of these literal occurrences of ((rat simp) 1 2) and friends.  A
> simple grep would probably catch most of them.
>   
It probably has to be done in one gulp.  Also look for occurrences of 
(numerator ..)  (denominator ...)
or similar accessors. And let's hope that no one uses  (cadr <ratnum>) 
to get the numerator etc.

RJF