Complex Monte Carlo Integration

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 3K views
Trajito
Messages
6
Reaction score
0
Hello,

I am trying to write a code taking path integrals in C++, using GNU Scientific Library. GSL is mainly written for C and does not include classes and other object-oriented language stuff, but it's also compatible with C++. Thus, what I first tried was making use of classes with GSL.

Since Feynman path integral formulation requires complex integration, I should first extend the standard GSL Monte Carlo function's abilities to taking complex integrals. I want to divide a function into two, real part and imaginary part. However, if I write a function which returns the real part of what is returned in the original function, my converting function must take the original function as its argument. But this brings trouble because GSL can integrate functions whose arguments must be (double [], size_t, void*). So, I have to return a function from a function.

Thank you
 
Physics news on Phys.org
You can make a class with the function as a member of it with an extra function such as

Convert(Double * DD, int size)

which when you call it, produces an array of data based on the function you have