Complex Monte Carlo Integration

Convert function. In summary, the conversation discusses the use of GNU Scientific Library (GSL) in writing a code for path integrals in C++. The speaker mentions the compatibility of GSL with C++ and the need to extend its abilities for complex integration. They also mention the challenges faced in returning a function from a function due to the required arguments for GSL integration. The suggested solution is to create a class with a function as a member and use an additional Convert function to produce an array of data.
  • #1
Trajito
6
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
  • #2
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
 

1. What is Complex Monte Carlo Integration?

Complex Monte Carlo Integration is a numerical integration method that uses random sampling to approximate the value of a complex integral. It is used to calculate integrals that cannot be solved analytically or through traditional numerical methods.

2. How does Complex Monte Carlo Integration work?

Complex Monte Carlo Integration works by generating a large number of random points within a given region and using these points to approximate the integral. The more points that are generated, the more accurate the approximation will be. The final result is obtained by taking the average of all the points within the region.

3. What are the advantages of using Complex Monte Carlo Integration?

There are several advantages to using Complex Monte Carlo Integration. It is a versatile method that can be used to approximate integrals of any dimension. It also converges to the true value of the integral at a faster rate compared to other numerical integration methods. Additionally, it can handle integrands with high dimensionality and complicated shapes.

4. Are there any limitations to using Complex Monte Carlo Integration?

Complex Monte Carlo Integration can be computationally expensive, especially for higher dimensional integrals. It also requires a large number of samples to achieve accurate results, which may not be feasible for some applications. Additionally, it may not be suitable for integrands with discontinuities or singularities.

5. In what fields is Complex Monte Carlo Integration commonly used?

Complex Monte Carlo Integration is widely used in various fields of science and engineering, such as physics, finance, statistics, and computer graphics. It is particularly useful in problems involving high-dimensional integrals, such as pricing complex financial derivatives or simulating physical systems with many variables.

Similar threads

  • Programming and Computer Science
Replies
7
Views
1K
  • Atomic and Condensed Matter
Replies
3
Views
876
  • Programming and Computer Science
Replies
1
Views
754
  • Set Theory, Logic, Probability, Statistics
Replies
7
Views
1K
  • Programming and Computer Science
Replies
21
Views
3K
  • Programming and Computer Science
Replies
11
Views
1K
  • Programming and Computer Science
Replies
1
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
2
Views
1K
  • Atomic and Condensed Matter
Replies
1
Views
2K
  • Programming and Computer Science
Replies
6
Views
928
Back
Top