Is %i an integer? - Adding more facts to the database
Subject: Is %i an integer? - Adding more facts to the database
From: Dieter Kaiser
Date: Sun, 28 Jun 2009 19:20:45 +0200
I had a look at the problem of the bug report "integrate(exp(-x^(%i)),x,0,1); =>
Is %i an integer?" - ID: 2811926.
I think at first we should give Maxima more knowledge about known facts.
I have added the following facts to the database:
(kind $%i $imaginary)
(kind $%pi $real)
(kind $%gamma $real)
(kind $%phi $real)
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)))
With this change symbols wich are declared to be rational, real, or complex are
a noninteger too.
With this changes we get:
(%i3) featurep(%i,imaginary);
(%o3) true
and
(%i4) askinteger(%i);
(%o4) no
Because we have %pi declared to be real we get:
(%i5) featurep(%pi,real);
(%o5) true
(%i6) askinteger(%pi);
(%o6) no
With this extension we no longer get the question "Is %i an integer?". Maxima
tries to give a result. I have not checked the result.
(%i7) integrate(exp(-x^(%i)),x,0,1);
(%o7) %i*(%i*('limit(%i*gamma_incomplete(-%i,-log(x+1))/2
-%i*gamma_incomplete(%i,-log(x+1))/2,x,0,minus)
+%i*gamma_incomplete(%i,1)/2-%i*gamma_incomplete(-%i,1)/2)
+'limit(-gamma_incomplete(%i,-log(x+1))/2
-gamma_incomplete(-%i,-log(x+1))/2,x,0,minus)
+gamma_incomplete(%i,1)/2+gamma_incomplete(-%i,1)/2)
Maxima gives the correct indefinite integral:
(%i8) integrate(exp(-x^(%i)),x);
(%o8) %i*gamma_incomplete(-%i,x^%i)*x*(x^%i)^%i
The testsuite and the share_testsuite has no problems with this extension. I
think we should do this extension.
Dieter Kaiser