Numerical multidimensional integration over function of six variables

Click For Summary
SUMMARY

The discussion centers on performing numerical multidimensional integration of a function with six variables using MATLAB. The user seeks to integrate over three of the variables (x4, x5, x6) while keeping the others (x1, x2, x3) constant. Monte Carlo integration is suggested as a viable method for handling this type of multidimensional integral, especially given the user's concerns about computational efficiency with traditional methods. The user has a 6D array of data points and is exploring the feasibility of implementing Monte Carlo integration versus a straightforward summation approach.

PREREQUISITES
  • Understanding of numerical integration techniques, specifically Monte Carlo integration.
  • Familiarity with MATLAB programming for implementing numerical algorithms.
  • Knowledge of multidimensional arrays and their manipulation in MATLAB.
  • Basic concepts of volume elements in integration.
NEXT STEPS
  • Research "Monte Carlo integration in MATLAB" for specific implementation techniques.
  • Explore "Numerical integration methods for multidimensional functions" to understand various approaches.
  • Learn about "discretization techniques in numerical analysis" to improve efficiency.
  • Investigate existing MATLAB packages or libraries that facilitate multidimensional integration.
USEFUL FOR

This discussion is beneficial for mathematicians, data scientists, and engineers involved in numerical analysis, particularly those working with high-dimensional data and seeking efficient integration methods in MATLAB.

WraithM
Messages
32
Reaction score
0
So, I'm writing a program in matlab. I have a function of six variables, say f(x1,x2,x3,x4,x5,x6). I want to integrate over x4, x5, and x6 numerically. f is defined over a 10 sided 6-cube of points. I also want to integrate over the whole cube.

So I want,

F(x_1, x_2, x_3) = \int\int\int f(x_1, x_2, x_3, x_4, x_5, x_6) dx_4 dx_5 dx_6

Does anybody have a hint to get me started down some path? I'm really stuck. It's sort of an insane problem.

The internet seems to point me toward monte carlo integration. These methods handle multidimensional integrals well apparently. Can monte carlo methods handle my problem of not integrating over all 6 dimensions? I don't know why I think monte carlo wouldn't, but if so, does anybody have an idea of how to do this? I'm not an expert in numerical integration at all. I'm also not opposed to turning this project into a C program or Mathematica or something. Anything that will solve the problem would be much appreciated!
 
Physics news on Phys.org
In what form do you have f? Is it an analytic function that could be integrated analytically? Or is it a numeric table? In either case, why can't you just discretize the function, multiply by the volume element dx4 dx5 dx6 and add up the contribution from all of the little cubes? You would basically be evaluating the sum:
\sum_{x4_{min}}^{x4^{max}}\sum_{x5_{min}}^{x5^{max}}\sum_{x6_{min}}^{x6^{max}}f(x1,x2,x3,x4,x5,x6)\Delta x4 \Delta x5 \Delta x6
 
For 3 or more dimensions, Monte Carlo is faster than straightforward method (suggested by phyzguy).
 
Thank you for the replies!

I have it stored in a 6D array. I've considered the way that phyzguy suggested. It seems that method would take a very long time. I've got a grid of a 10^6 points on it, but this method would be extremely easy to implement. It'd be like 5 - 6 lines of code in Matlab, tops. It would not scale well with size at all... If I make the size of the 6-cube larger by even 1, the time the problem would take goes up tremendously. It goes up as O(N^d). Where N is the size of one side of the cube, and d is the dimension. If I can't figure out monte carlo integration, I will definitely do this, but I want to avoid this method if at all possible.

Mathman, do you have any suggestions on how to implement the monte carlo integration? I have only a rough idea of what monte carlo integration even is, let alone how to implement it in higher dimensions. Could you give me a rough outline of what my algorithm should look like? Your description may be very rough.

If not, do you have a suggestion on a website, already implemented package, or book where I could learn how to do this?

Thank you again!
 
Last edited:
WraithM,

You're not doing an entirely numerical calculation since some of the variables remain as variables. It's best if you reveal the specific function that you are integrating so you can get advice about how to handle the symbolic part of the calculation.
 

Similar threads

  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 13 ·
Replies
13
Views
3K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 5 ·
Replies
5
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K