-----maxima-bounces at math.utexas.edu wrote: -----
>This?reference?seems?to?restrict?the?use?of?tan(x/2)?substitution?to?the?
>case?of?rational?functions?of?sin(x)?and?cos(x),?which?is?not?the?case?
>of?exp(sin(x))?and?abs(sin(x)).?I?am?not?sure,?but?the?ghost?poles?
>introduced?via?the?substitution?may?be?much?more?difficult?to?treat?
>correctly?in?the?case?of?non?rational?trig?expressions.
I agree with Eric, the ghost poles are difficult to treat correctly for
integrate(abs(sin(x)),x) and integrate(abs(sin(x)),x). I wish the Maxima integrator
was more circumspect about introducing ghost poles. Maybe there is a option variable
that turns of this off (at least partially)?
Here is the Maxima output (minus some error messages about log(0) in failed computations)
(%i1) load("abs_integrate.mac")$
(%i2) load("partitions2deep.mac")$
In this case, the antiderivative is not continuous at odd integer multiples of pi, making
it poorly suited for definite integration. The ghost poles show up in the
arguments of signum (not atan)
(%i3) integrate(abs(cos(x)),x);
(%o3) 2*((1/2-sin(x)/((cos(x)+1)*(sin(x)^2/(cos(x)+1)^2+1)))*signum(sin(x)/(cos(x)+1)-1)+1)*signum(sin(x)/(cos(x)+1)+1)
Integrate using simplification (and partitions2deep):
(%i4) 'integrate(abs(cos(x)),x);
(%o4) 2*floor(x/%pi+1/2)-cos(%pi*floor(x/%pi+1/2)-x-%pi/2)
With integrate(abs(sin(x)),x), the ghost poles show up in the arguments of log, atan, and signum.
It's a big mess, but correct between odd integer multiples of pi, I think:
(%i5) integrate(abs(sin(x)),x);
(%o5) 4*((abs(sin(x))*(atan(sin(x)/(cos(x)+1))/2+sin(x)/((cos(x)+1)*((2*sin(x)^2)/(cos(x)+1)^2+2))))/abs(cos(x)+1)-(signum(sin(x)/(cos(x)+1))*log((2*sin(x)^2)/(cos(x)+1)^2+2)-signum(sin(x)/(cos(x)+1))*log(sin(x)^2/(cos(x)+1)^2+1)+((2*sin(x)*atan(sin(x)/(cos(x)+1)))/(cos(x)+1)-log(2))*signum(sin(x)/(cos(x)+1)))/4)
The antiderivative by simplification:
(%i6) 'integrate(abs(sin(x)),x);
(%o6) 2*floor(x/%pi)-cos(%pi*floor(x/%pi)-x)
I sometimes wonder if a purely pattern matching / lookup integration would be superior to what we have; for
example http://www.apmaths.uwo.ca/~arich/ .
--Barton