c++mathnumerical-integrationnumerical-analysis

Numerical integration of a 2-dim complex function in C++?


I am trying to integrate this integral numerically (so without evaluating the primitive) in C++:

enter image description here

It is simpler than what it seems, in fact I know which algorithm I can implement to solve it (I consider fYsin as func(th,phi) and integrate it with trapezoidal rule in 2-D). The only problem is that Y is complex and in particular is proportional to e^ikx. How should I proceed with this problem? Should I modify my integral in a way or should I apply numerical integration to real and imaginary part separately?

EDIT

I found this formula:

enter image description here

maybe it can be used to integrade real and complex part separated and numerically?


Solution

  • I solved this problem by simply integrating real and imaginary part separately. The complete code can be found in this repository, within the complete algorithm definition to integrate the function of the first image I posted.