I'm trying to calculate the definite integral: $$\int_{-\pi}^{\pi} (-5\ e^{iz})^{\frac{3}{2}} e^{-inz} dz $$
The indefinite integral without the constant of integration is:
$$ \frac {10 i\sqrt {5}\sqrt {-e^{i z}} e^{-i (n - 1) z}} {2 n - 3} $$
The difference of the indefinite integral evaluated at the bounds $\{-\pi,\pi\}$ is
$$ \frac{10 i \sqrt{5} e^{-i \pi (n-1)}}{2 n-3}-\frac{10 i \sqrt{5} e^{i \pi (n-1)}}{2 n-3} $$
If I substitute $n$ for a positive integer this difference evaluates to $0$
Also the difference can be simplified to
$$ \frac{10 i \sqrt{5} e^{-i \pi (n-1)}}{2 n-3}-\frac{10 i \sqrt{5} e^{i \pi (n-1)}}{2 n-3} = \frac{20 \sqrt{5} \sin (\pi n)}{2 n-3} $$
If I ask Mathematica to compute the definite integral
Integrate[E^(-I*n*z)*((-5*E^(I*z))^(3/2)), {z, -Pi, Pi}],
it produces:
$$ \frac{20 \sqrt{5} (\sin (\pi n)+1)}{2 n-3} $$
I'm using this to generate a Fourier series of $$ {(-5\ e^{i\ z})}^{\frac{3}{2}} $$
Using the definite integral that Mathematica produces, I am able to produce a Fourier series that converges correctly. But using the definite integral obtained from taking the difference of the indefinite integral at the bounds, I can't generate a correctly converging fourier series since $n$ substituted for positive integers always causes the expression to equal $0$
So what I'm wondering is how did Mathematica generate the correct definite integral?, why doesn't computing the definite integral the typical analytic way work?, and is there a way to calculate the correct definite integral using the indefinite integral in this case?


