2
$\begingroup$

I want to program an integration routine in C++ using the GSL library but for complex functions.

How should I split my integrand to apply the gsl_integration_qag function on it.

Just integrate the real and imaginary parts by themselves is not correct I guess.

I have the following function: $$S(a,N) = S(a, \infty) - \sum^{\infty}_{n = 1} \frac{1}{n + N}$$ where $S(a, \infty)$ is some real constant. The functions I later intend to integrate are using the harmonic sum as a basis but are just sums of it.

The integration I intend to do is the Mellin transform which is given by: $$f(x) = \frac{1}{2 \pi i} \int_C dn x^{-n} f^{M}(n).$$

Any help is much approciated.

EDIT: Any idea on a C++ program for complex numerical integration?

$\endgroup$
  • $\begingroup$ Complex integration is a more subtle business than real integration; it depends on what you precisely mean: contour integrals? path integrals? are the integrands holomorphic or do they contain poles? It would be helpful if you could add an example of the type of integral you're trying to compute. $\endgroup$ – Christian Clason Apr 24 '16 at 10:40
  • $\begingroup$ Thanks for your answer @ChristianClason ! I mean contour integration and the integrands contain poles. I actually want to compute the inverse mellin transform of functions containing harmonic sums. I don't have an example at hand right now but I'll provide one. I wrote a program using simspons rule but it delivers wrong results for harmonic sums, although it does deliver the right results for simple functions like 1/z for e.g. $\endgroup$ – Silverwhale Apr 24 '16 at 10:48
  • $\begingroup$ You should edit your answer to include this information (comments can go away, or be buried in a long thread, and are very small :)) $\endgroup$ – Christian Clason Apr 24 '16 at 11:03
  • $\begingroup$ Any reason you're not using a specific method for the inverse Mellin transform, e.g., sciencedirect.com/science/article/pii/037704279190041H or link.springer.com/article/10.1007%2FBF01932274#page-1? $\endgroup$ – Christian Clason Apr 24 '16 at 11:04
  • $\begingroup$ I have the following function: $$S(a,N) = S(a, \infty) - \sum^{\infty}_{n = 1} \frac{1}{n + N}$$ where $S(a, \infty)$ is some real constant. The functions I later intend to integrate are using the harmonic sum as a basis but are just sums of it. and the Mellin transform is given by: $$f(x) = \frac{1}{2 \pi i} \int_C dn x^{-n} f^{M}(n).$$ $\endgroup$ – Silverwhale Apr 24 '16 at 11:06
1
$\begingroup$

I think the way to go is to parametrize the integral with a real parameter and integrate the real and imaginary parts seperately. Implementing this is subtle, the implementation depends from case to case.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.