Problems with improper integrals



Alexios Tamparopoulos wrote:
> I want to evaluate the improper integral
> f(x):=1/(a+sin(x))
> integrate(f(x),x,0,2*%pi)
> where a>1
> 
> The first question Maxima asks is
> 
> Is  (a-1)*(a+1)  positive, negative, or zero?
> 
> I reply p
> 
> Is  sqrt(a^2-1)+a  positive or negative?
> 
> I give p (that was a trivial question anyway)
> 
> Is  abs(sqrt(a^2-1)-a)-1  positive, negative, or zero?
> 
> I reply n (I had to do a slight calculation)
> 
> Is  sqrt(a^2-1)+a-1  positive, negative, or zero?
> 
> I reply p (another trivial question)
> 
> (2*%pi)/sqrt(a^2-1)
> 
> The answer is correct, but I wonder what kind of procedure was followed 
> and I had to specify all those values.
> 
> I tried to replace a with b+1 with b positive, but I received 4 
> questions again with only the first actually needed.
> 
> The issue with questions of that type is something that is planned to be 
> fixed? Where can I read details about this, so I don't post trivial 
> questions myself?

You could start with assume(a>1).  This gets rid of the first two 
questions.

The first two questions come about because maxima is trying to see if 
the integrand has any poles on the real axis on the interval from 0 to 
2*%pi.  (I discovered this by pressing C-c and looking at the backtrace.)

After that, maxima is applying the substitution exp(%i*x) = y and doing 
a contour integral around the unit circle.  This is done via residues, 
so the questions come from computing the poles of the new integrand.

Definite integration is pretty much contained in the (Lisp) file 
src/defint.lisp.  There are some comments in the file describing what's 
happening.


> 
> Another problem I had:
> 
> f2(x):=x/(1-cos(x)+x^2);
> integrate(f2(x),x,0,2*%pi);
> 
> not result was presented (should be 8*%pi/3 if calculation I did by hand 
> was right).
> Seems like Maxima can't handle this integral.

You're right.  Maxima can't handle this integral.  What method did you 
use to compute this?

Ray