(%i3) integrate(1/(x^2 + x + b)^2,x);
Is b-0.25 positive or negative?pos;
(%o3) (4*atan((2*x+1)/sqrt(4*b-1)))/(4*b-1)^(3/2)+(2*x+1)/((4*b-1)*x^2+(4*b-1)*x+4*b^2-b)
(%i4) build_info();
Maxima version: 5.20.1
Maxima build date: 21:25 12/14/2009
Host type: i686-pc-mingw32
Lisp implementation type: GNU Common Lisp (GCL)
Lisp implementation version: GCL 2.6.8
(%o4)
Some observations:
(1)
The bug has been introduced between Maxima 5.18 and Maxima 5.19.
Maxima 5.18.1 http://maxima.sourceforge.net
Using Lisp CLISP 2.44.1 (2008-02-23)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate(1/(x^2 + x + b)^2,x);
Is 4 b - 1 positive or negative?
Maxima 5.19.2 http://maxima.sourceforge.net
Using Lisp CLISP 2.44.1 (2008-02-23)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) integrate(1/(x^2 + x + b)^2,x);
Is b - 0.25 positive or negative?
(2)
The bug is not reproducible with asksign alone. We can trace $asksign to see the involved expression:
(%i1) :lisp (trace $asksign)
($ASKSIGN)
(%i1) integrate(1/(x^2 + x + b)^2,x);
0: ($ASKSIGN ((MPLUS SIMP) 1 ((MTIMES SIMP RATSIMP) -4 $B)))
Is b - 0.25 positive or negative?
That is the expression which is passed to $asksign and it works as expected:
(%i3) asksign(ratsimp(-4*b+1));
0: ($ASKSIGN ((MPLUS SIMP) 1 ((MTIMES SIMP RATSIMP) -4 $B)))
Is 4 b - 1 positive, negative, or zero?
Perhaps we have a global switch or flag which is set by the integration routines and changes the behaviour of $asksign.
Dieter Kaiser
A further oberservation:
The bug is visible when we put in addition a fact into the assume database:
(%i2) assume(notequal(4*b-1,0));
(%o2) [notequal(b,1/4)]
(%i3) asksign(4*b-1);
Is b-0.25 positive or negative?
This is done by the integration routine too. This indicates that we have a problem with the assume database alone.
As reported the bug is not present in Maxima 5.18. I have located the problem in the following revision:
Revision 1.18 - (view) (download) (annotate) - [select for diffs]
Fri Apr 3 17:27:07 2009 UTC (11 months ago) by are_muc
Branch: MAIN
Changes since 1.17: +243 -208 lines
Diff to previous 1.17
If I go back to revision 1.17 of db.lisp the bug vanishes, but it is present with revision 1.18. Unfortunately, the change seems to be very subtle and about 240 lines have changed.
Dieter Kaiser
For my part, I am inclined to revert r1.18 src/db.lisp. I am guessing the changes in that revision are largely nonfunctional. If there are revisions after 1.18, we'll have to reapply them. But db.lisp is so obscure that at this late date, we are better off avoiding any changes to it.
Again I had a look at this problem. Because it is a subtle effect, I had problems to locate the error. At last I have detetected that it is a change of dintum in revision 1.21. It is not necessary to go back to revision 1.17. If we revert the changes of revison 1.21 we get the expected behavior of asksign:
(%i1) assume(notequal(4*b-1,0));
(%o1) [notequal(b,1/4)]
(%i2) asksign(4*b-1);
Is 4*b-1 positive or negative?
I have no idea what we can do to get both, a correct answer from dcomp(1,1.0) and a correct question from asksign.
When we revert the changes of revsion 1.21 of the routine dintum we get the following failures with the testsuite:
Running tests in rtestsum:
********************** Problem 295 ***************
Input:
dcomp(1, 1.0)
Result:
pos
This differed from the expected result:
zero
********************** Problem 297 ***************
Input:
is(xx > 1)
Result:
true
This differed from the expected result:
unknown
********************** Problem 298 ***************
Input:
if xx > 1 then aa else bb
Result:
aa
This differed from the expected result:
if xx > 1 then aa else bb
********************** Problem 300 ***************
Input:
3
====
\
foo : > (if xx > 1 then aa else bb)
/
====
xx = 1
Result:
3 aa
This differed from the expected result:
3
====
\
> (if xx > 1 then aa else bb)
/
====
xx = 1
********************** Problem 301 ***************
Input:
ev(foo, nouns)
Result:
3 aa
This differed from the expected result:
bb + 2 aa
********************** Problem 302 ***************
Input:
foo : sum(if equal(xx, 1) then aa else bb, xx, 1, nn)
Result:
bb nn
This differed from the expected result:
nn
====
\
> (if equal(xx, 1) then aa else bb)
/
====
xx = 1
********************** Problem 303 ***************
Input:
ev(foo, nouns, nn = 3)
Result:
3 bb
This differed from the expected result:
2 bb + aa
296/303 tests passed (not counting 4 expected errors)
The following 7 problems failed: (295 297 298 300 301 302 303)
Running tests in rtest_sign:
********************** Problem 166 ***************
Input:
csign(log(x))
Result:
pos
This differed from the expected result:
pz
276/277 tests passed (not counting 9 expected errors)
Dieter Kaiser