Question:Is this integral real or complex? The real integral of a real function evaluates to be complex!

Question:Is this integral real or complex? The real integral of a real function evaluates to be complex!

Now I compute the integral

0<int((abs(c-x)/x)^n,x=a..b)=int((c-x)/x)^n,x=a..c),symbolic)+int((x-c)/x)^n,x=c..b)

assuming c>0,b>c,n>-1.

As it is not possible directly, I split this apparently real integral in two parts. Both parts are real for n>0. Look, what's happens!!!

> Za:=simplify(int(((c-x)/x)^n,x=a..c),symbolic) assuming a>0,c>a,n>-1;
> Zb:=simplify(int(((x-c)/x)^n,x=c..b),symbolic) assuming c>0,b>c,n>-1;

> Z2:=(A,B,C)->subs(a=A,c=C,Za)-subs(b=B,c=C,Zb);
> INT:=simplify(Z2(A,B,(A+B)/2)) assuming A>0,B>0,C>0,C>A,B>C,n>0;
> RI:=simplify(evalc(Re(INT))) assuming A>0,B>0,C>0,C>A,B>C,n>0;
> II:=simplify(evalc(Im(INT))) assuming A>0,B>0,C>0,C>A,B>C,n>0;
> ii:=evalf(simplify(subs(A=1.,B=2.,II),trig)):
> ri:=evalf(subs(A=1,B=2,RI)):
> plot(ri,n=0..1);
> plot(ii,n=0..1);

The integral is now complex! Exception n=0,n=1/2 and n=1.

Can anybody explain this behavior? What's going wrong?

﻿