[Maxima] [ maxima-Bugs-541030 ] integrate(sqrt(x+1/x-2),x,0,1) wrong

Wolfgang Jenkner wjenkner@inode.at
16 Jul 2002 05:33:33 +0200


As Raymond Toy stated (in the bug tracking system), Maxima eventually
tries to solve this problem by calculating an indefinite integral.
Now, this involves INTFORM (defined in sin.lisp), which contains the
following form.  The crucial fact is that $RADEXPAND is here bound to
$ALL.

((SETQ W (RATIONALIZER (CADR EXPRES)))
    (PROG2 (SETQ EXP (LET (($RADEXPAND '$ALL))
			  (MAXIMA-SUBSTITUTE W (CADR EXPRES) EXP)))
	   (INTFORM (LET (($RADEXPAND '$ALL))
			 (SIMPLIFY (LIST '(MEXPT) W (CADDR EXPRES)))))))

Tracing the relevant functions gives

			    1
 1 Enter ?RATIONALIZER [x + - - 2]
			    x
			      2
		       (x - 1)
 1 Exit  ?RATIONALIZER --------
			  x
				     2
			      (x - 1)	    1		    1
 1 Enter ?MAXIMA\-SUBSTITUTE [--------, x + - - 2, SQRT(x + - - 2)]
				 x	    x		    x
			      x - 1
 1 Exit  ?MAXIMA\-SUBSTITUTE -------
			     SQRT(x)
		    x - 1
 2 Enter ?INTFORM [-------]
		   SQRT(x)


This could be avoided by binding $RADEXPAND to $TRUE instead (note
that Maxima somehow remembers the integral's bounds in order to
eliminate ABS from the expression).  However, this way Maxima would be
unable to handle the indefinite integral INTEGRATE(SQRT(X+1/X-2),X)
(while the result is incomplete in this case it might be useful
anyway).

Maybe it would be best not to bind $RADEXPAND at all here and leave
the decision to the user.  The default setting $TRUE is fine anyway
and, on the other hand, they should know that $ALL may give wrong
results.

Generally speaking, fixing what seems a bug somewhere in SININT means
that we have to be confident that the real bug did not occur earlier
in defint.  After all, the person who set $RADEXPAND to $ALL might
have done this because he had good reasons to assume that an integral
like ours wouldn't turn up here.  This said, I don't believe this is
the case here because, e.g., INTEGRATE(SQRT(X+1/X-2),X,1/2,1) triggers
the same bug and I don't think there is some defint routine meant to
deal with this (but note that, e.g., INTEGRATE(SQRT((X-1)^2/X),X,0,1)
is handled by ZTO1 since it is recognised as value of the Beta
function).

Wolfgang
-- 
wjenkner@inode.at