This is a typical ill-posed problem resulting from the limited mind-set 
that comes from
thinking that sqrt is a single-valued function, and that therefore
sqrt(z^2), an expression which can be reduced to a set:  {-z,z}  should be
collapsed to abs(z).
Which it of course is not.  Draw the graphs of f(z)=-z   or f(z)=z,  and 
you see
that NEITHER  ONE is the same as f(z)=abs(z).

So, given  the very strong possibility that  the limited mind set occurs in
at least one of 3 places:
  the mind of the proposer
  the mind of the Sage programmer
  the mind of the Maxima programmer

what is one to do?

  Do you want to integrate  cot(z),  which indeed gives an integral of 0, 
correctly.
or do you want to integrate -cot(z),  which of course also gives 0
or  abs(cot(z))   which would be  integral(cot(z),z,%pi/4,%pi.2)   - 
integral(cot(z),z,%pi/2,3*%pi/4).

and that gives log(2).

in the Maxima I have on my computer,  integrate(abs(cot(z)),z,%pi/4, 
3*%pi/4) gives the very
peculiar answer log(-1)

the  numerical integration program quad_qag gives  0.69314718055995 which 
looks like log(2).

So there is probably no bug in the integration version of the answer that 
is 0,  There is a bug
in sqrt.  Or rather, in the mind-set regarding sqrt.

There is a bug in the integration of abs(cot()) though. probably related to 
Nils' observation, though
probably not in the way he thinks...  the integral is of a real function 
between real values.

Also if Sage translates a definite integration to a call to Maxima for an 
INdefinite integration,
and then using the fundamental theorem of calculus  (difference of value of 
integral at endpoints)
it is making a BIG MISTAKE.   FTC doesn't always apply, and Maxima knows 
something about
definite integrals, contour integration etc.  Not apparently bug-free..

RJF


On Thursday, August 27, 2015 at 10:10:39 AM UTC-7, Gregory Bard wrote:
>
> There is an integral which Sage correctly numerically integrates, and 
> which Sage symbolically gets very wrong. William and I looked into this 
> during Sage Days 68, and he discovered that, in fact, Maxima gets this 
> integral very wrong as well. (More correctly, the particular configuration 
> and version of Maxima built into Sage gets the integral very wrong. Some 
> setting might be incorrect or badly chosen.)
>
> The integral of sqrt( cot(x)^2 ) dx for pi/4 < x < 3pi/4 is not too bad to 
> compute by hand. The answer is the logarithm, base e, of 2. The numerical 
> integration in Sage agrees.
>
> Maxima thinks that the answer is instead zero. (Or more correctly, the 
> particular configuration and version of Maxima built into Sage thinks the 
> answer is zero.)
>
> Please see the attached sagews worksheet. 
>
> Is there anyone on this list who knows Maxima in general, and the 
> connections/interface between Maxima and Sage in particular?
> ---Greg
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to