Is %i an integer? - Adding more facts to the database
Subject: Is %i an integer? - Adding more facts to the database
From: Richard Fateman
Date: Tue, 30 Jun 2009 08:29:34 -0700
There seem to be two issues, perhaps confused in Maxima, apparently in
common lisp...
1. The data layout used for storing a value
2. The mathematical domain to which the value belongs.
For example,
(a) 3 is an integer and can be stored in a box for integers.
(b) 3 can also be stored in a box for complex numbers, with imaginary
part 0.
(c) 3 can be stored in a box for rationals (numerator 3, denominator 1),
In some situations (b) and (c) will be coerced to be (a).
In common lisp, (complex 3 0) returns 3. (complex 3 0.0) returns
#c(3.0 0.0)
(/ 3 1) returns 3.
(complexp (complex 3 0.0)) returns t
(complexp (complex 3 0)) returns nil.
But the predicate rationalp does not require that the box be a
"rational: box since
(rationalp 3) returns t
...................
2. From the math perspective it seems that we have another set of
questions to be asked.
Is a symbol restricted to having values in a particular domain?
Is an explicit constant a member of a particular domain?
From this perspective, integers are a subset of rational are a subset
of real [and also a subset of complex, with imaginary part = 0]
Since the complex numbers are not ordered, assume(a<b) means that a, b
are real.
At least for it to be true. Do we want to say a<b is false because a,b
are complex??
Also someone could use "<" for some other ordering, not unusual in
mathematical discourse.
Similarly assume(evenp(x)) probably means that x is an integer. Again,
do we want to say that 3.14 is "not even"?
There are lots of other possible domains and towers of domains, as well
as features.
RJF
though perhaps Robert Dodier wrote:
> On 6/28/09, Dieter Kaiser <drdieterkaiser at web.de> wrote:
>
>
>> I have added the following facts to the database:
>>
>> (kind $%i $imaginary)
>> (kind $%pi $real)
>> (kind $%gamma $real)
>> (kind $%phi $real)
>>
>
> OK by me. But in addition perhaps %pi, %gamma, and %phi
> should be declared irrational. (Or maybe transcendental for
> %pi and %gamma, but I don't remember if featurep and kindp
> handle that correctly.)
>
>
>> Next I have improved the function NONINTEGERP.
>>
>> ; ((atom e) (kindp e '$noninteger))
>> ((atom e) (or (kindp e '$noninteger)
>> (kindp e '$rational)
>> (kindp e '$real)
>> (kindp e '$complex)))
>>
>
> I don't think this is right. NONINTEGERP should return T when
> E is demonstrably noninteger. Some rationals, reals, and
> complex numbers are integers, right? So it can't use those
> declarations to determine noninteger-ness.
>
> I think testing for noninteger, irrational, imaginary, and
> transcendental would be OK.
>
> Thanks for working on this problem. I think handling declarations
> correctly is very important.
>
> best
>
> Robert Dodier
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>