- labels: --> Lisp Core - Assume
limit(r^(b-2)*(x-r)^2,r,0)
Is b - 2 positive, negative, or zero?
neg;
Is x zero or nonzero?
zero;
Is b an integer?
yes;
Is 2 - b an even number?
no;
Is 2 - b an even number? <== redundant question
no;
At first again the example of this bug report with the current Maxima 5.20post:
(%i2) limit(r^(b-2)*(x-r)^2,r,0);
Is b-2 positive, negative, or zero?
n;
Is b positive, negative, or zero?
z;
Is 2-b an even number?
n;
Is 2-b an even number?
n;
Is 2-b an even number?
n;
(%o2) 'limit(r^(b-2)*(x-r)^2,r,0)
After the second question Maxima knows that b=0. Therefore, the expression 2-b is even. But Maxima does not recognize this. The answer is in contradiction to the known facts and Maxima asks the same question three times.
The reason is that the function evod which is called from askinteger does not look into the database for facts like equal(b,0). We had the same problem with maxima-integerp and introduced the extension check-integer-facts.
We can extend the routine check-integer-facts to look for facts which are related to even or odd integers. With such an extension we will get:
(%i4) limit(r^(b-2)*(x-r)^2,r,0);
Is b-2 positive, negative, or zero?
n;
Is b positive, negative, or zero?
z;
(%o4) 'limit(r^(b-2)*(x-r)^2,r,0)
Maxima no longer ask the quesition "Is 2-b an even number?" because this fact is deduced from the database.
This is another simple example. We assume n equal to 2. Therefore n is even, but Maxima does not know it:
(%i1) assume(equal(n,2))$
(%i3) askinteger(n,even);
Is n an even number?
y;
With the extension of check-integer-facts we get:
(%i5) assume(equal(n,2))$
(%i6) assume(equal(m,3))$
(%i7) askinteger(n,even);
(%o7) yes
(%i8) askinteger(m,odd);
(%o8) yes
Dieter Kaiser
Fixed in compar.lisp revision 1.69. We no longer get the redundant questions:
(%i3) limit(r^(b-2)*(x-r)^2,r,0);
Is b-2 positive, negative, or zero?
n;
Is b positive, negative, or zero?
z;
(%o3) 'limit(r^(b-2)*(x-r)^2,r,0)
Closing this bug report as fixed.
Dieter Kaiser
Log in to post a comment.