Integral of implicit integral function

166 Views Asked by At

I want to calculate integral of implicit function containing imaginary numbers $$\int\limits_0^1 f(iz) \, \mathrm{d}z$$ where $f(iz)$ is something like: $$f(iz)=\int\limits_{0.3}^{0.9} g(ix) \mathrm{d}x$$ and $g(ix)$ is something like: $$g(ix)=e^{ixz}$$ I want to calculate it numerically. Python scipy.quad doesn't calculate integrals of imaginary numbers. Quadpy isn't efficient also. So I am thinking about dividing integrals like in the way shown below (where $\operatorname{Re}$ is real part and $\operatorname{Im}$ is imaginary part): $$ \int f(iz) dz = \int \operatorname{Re} f(iz) \mathrm{d}z + \int \operatorname{Im} f(iz) \mathrm{d}z$$

and continuing:

$$ \int f(iz) \mathrm{d}z = \int \operatorname{Re} \left[ \int \operatorname{Re} g(ix) \mathrm{d}x + \int \operatorname{Im} g(ix) \mathrm{d}x\right] \mathrm{d}z + \int \operatorname{Im} \left[ \int \operatorname{Re} g(ix) \mathrm{d}x + \int \operatorname{Im} g(ix) \mathrm{d}x\right]\mathrm{d}z$$ Can I do that?

1

There are 1 best solutions below

0
On

You can use Sympy to approximate it directly.

from sympy import exp, I, integrate, N, pretty_print, Rational, symbols


num_of_dec_places = 15
x, z = symbols('x z')

integral = integrate(integrate(exp(I * x * z),
                               (x, Rational('0.3'), Rational('0.9'))),
                     (z, 0, 1))

approx = N(integral, num_of_dec_places)
pretty_print(approx)