(assume_pos:true, file_output_append:true, ratprint:false, showtime:true,load(simplify_sum)
, simpsum:true, load("lrats"),letrat:true,ratfac:true,algebraic:true,fpprintprec:4);
the expression -1/(y+1)/2+1/(1-%i)/(y+%i)/2+1/(1+%i)/(y-%i)/2
and y/(y+1)/(y^2+1)
are equal:
ratsimp(-1/(y+1)/2+1/(1-%i)/(y+%i)/2+1/(1+%i)/(y-%i)/2-y/(y+1)/(y^2+1));
gives 0.
[tot:-1/(y+1)/2+1/(1-%i)/(y+%i)/2+1/(1+%i)/(y-%i)/2,
toti:integrate(tot,y,0,tan(%pi/3)),
tt:ev(toti,numer)];
gives toti=-0.156 which is incorrect
while ev(integrate(y/(y+1)/(y^2+1),y,0,tan(%pi/3)),numer);
gives the correct 0.3676 which i also get by just filling in the limits of the analytic expression at y=tan(%pi/3)
and subtracting evaluation at y=0 which is %pi/4
or
[ans1:-log(tan(%pi/3)+1)/2+log(tan(%pi/3)+%i)/(1-%i)/2+log(tan(%pi/3)-%i)/(1+%i)/2+%pi/4,
ans2:ev(realpart(ans1),numer)];
which also gives 0.3676 and also numerical
It may be more direct to combine and rid the complex expression and use
[tt:integrate(-1/(y+1)/2+(y+1)/(y^2+1)/2,y),
ti:subst(y=tan(%pi/3),tt),
ev(ti,numer)];
which also gives 0.3676
Here is, I think, the same bug you identified, but presented in a way that's easier for me to read:
Thanks for this bug report.
Traced a few functions. When evaluating the definite integral,
antideriv
is called on the integrand which returns:But when doing
integrate(tot,y)
, Maxima returns:Note the lack of the
abs
function inside thelog
functions. This accounts for the difference. When we substitute the limits in the first result above, and callrectform
, we get:which is approximately -0.15595.
But when substituting the limits for the second result above, and call
rectform
andexpand
, we get:which evaluates to 0.36764, which is the expected result.
For some reason,
$logabs
is set totrue
in$defint
. But indefint
, one call toantideriv
explicitly sets$logabs
tofalse
. This path isn't taken in this particular integral though.I'm not sure why we do this.
integrate(1/x,x)
returns justlog(x)
instead oflog(abs(x))
.