views:

359

answers:

2

Can anyone point out a good C++ library that can do 2D numerical integration. It needs to be able to accept a 2D array of known values, and the spacing between the points can be assumed to be constant (for a start).

It is preferable that it have a license which allows modifying the code as needed.

A: 

http://itpp.sourceforge.net/current/

Try this. It can do what you ask for and more! And you can modify the code as much as you like.

I've read somewhere that you can extract libraries out of GNU Octave's code and use the C++ code in your own applications. I'm not sure if that's an easy task, but you can give it a try if you have the time.

Sahasranaman MS
Can you point me to the 2D integration? All I could find was 1D integration (http://itpp.sourceforge.net/current/group__integration.html)
Gilad Naor
Isn't 2D integration just a double integral? Can't you do it with the same library?
Sahasranaman MS
Not in numerical integration. You have more information which you want to use. For each "point" you have four neighbors to interpolate with, unlike 1D.
Gilad Naor
+3  A: 

It's actually a C library, but if the GPL licensing terms work for you try:

http://www.gnu.org/software/gsl/

You will want to check out the Monte Carlo integration options outlined here:

http://www.gnu.org/software/gsl/manual/html_node/Monte-Carlo-Integration.html

nsanders
Thanks, I will look into it.I'd rather stay away from Monte Catlo at the moment, though. I prefer to have deterministic results right now.
Gilad Naor