Calculating the Fourier series for $\frac{1}{x+i}$ I am trying to calculate the Fourier series for 
$$s(x) = (x+ix_i)^p = \sum_{n=\infty}^\infty A_n \exp(ik_x x),$$
where
$$k_x = \frac{n\pi}{l_x},$$
$$s \in [-l_x, l_x],$$
$$p = -1.$$
I have tried doing this in maple with the code below. It gives a terrible approximation and I don't know why. The code seems to be okay for $p \ge 0$.
> restart;
> x_i := 1
> l_x := 5*x_i
> k_x := n*Pi/l_x
> p := -1
> A_n := 1/(2*l_x)*evalf(int((x + x_i*I)^p*exp(-I*k_x*x), x = -l_x .. l_x))
> A_0 := 1/(2*l_x)*evalf(int((x + x_i*I)^p, x = -l_x .. l_x))
> plot([Re(sum(A_n*exp(k_x*x*I), n = -100 .. -1) + A_0 + sum(A_n*exp(k_x*x*I), n = 1 .. 100)), Re((x + x_i*I)^p)], x = -l_x .. l_x)

Here is the outputted figure (blue is $\Re(s(x))$ and red is the approximation).

 A: I don't understand why you are trying to use int and sum instead of Int and add, for adding up a finite number of expressions and performing numeric integration. I suspect one or both was the cause of trouble.
Let me know if this is quick enough. (You could also utilize a coarser tolerance in the Int calls, using say epsilon=1e-5 or some such.)
restart;
x_i := 1:
l_x := 5*x_i:
k_x := n*Pi/l_x:
p := -1:

Try to make the following procedure quick (but flexible if you want to adjust options).
A_n := proc(n, p)
     local opts, rng;
     if not [n,p]::[numeric,numeric] then
       return 'procname'(args);
     end if;
     opts := method=_d01akc;
     rng := -l_x .. l_x;
     1/(2*l_x)
     *(Int(unapply(evalc(Re((x + x_i*I)^p*exp(-I*k_x*x))), x),
           rng, opts)
       +I*Int(unapply(evalc(Im((x + x_i*I)^p*exp(-I*k_x*x))), x),
              rng, opts));
   end proc:

And now to compute some coefficients numerically.
A_0 := 1/(2*l_x)*evalf(Int((x + x_i*I)^(p), x = -l_x .. l_x)):

KK := A_0
      + add(evalf(A_n(n,p))*exp(k_x*x*I), n = -100 .. -1)
      + add(evalf(A_n(n,p))*exp(k_x*x*I), n = 1 .. 100):

And plot that,
plot([Re(KK),Re((x + x_i*I)^(p))], x = -l_x .. l_x);


