I need to numerically integrate a complex valued function of a real variable and a complex variable by the real variable. My integral:
$$ \int^1_{-1}\frac{e^{ix}}{x-z}dx ~~~\text{where} ~~x \in \mathbb{R}, z \in \mathbb{C}$$
I'm trying to do this:
z := x + I y; NIntegrate[Exp[I x]/(x - z), {x, -1, 1}]
But I get the message:
NIntegrate::inumr: The integrand (I E^(I x))/y has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}.
How can this integration be done numerically in Mathematica?
z
a numerical value or useIntegrate
instead ofNIntegrate
. $\endgroup$