Numerical integration (two dimensions!)

  • Thread starter Giovanni Gherdovich
  • Start date
G

Giovanni Gherdovich

Hello,

I need to perform a two-dimensional
numerical integration, i.e. my functions are
R^2 -> R.

All the tool I'm aware of provide routines for
single-variable numerical integration, so I'm
about to write a "wrapper" wich uses a
1-D method "two times", applying Fubini's Theorem
http://en.wikipedia.org/wiki/Fubini's_theorem

I've already seen this strategy used in Matlab;
if you use Matlab, have a look to the file
dblquad.m to see what I mean.

But before re-discovering the hot water, I would
ask you if you know about a library where this is
already done!


Regards,
Giovanni Gh.
 
U

Uwe Schmitt

Hello,

I need to perform a two-dimensional
numerical integration, i.e. my functions are
R^2 -> R.

All the tool I'm aware of provide routines for
single-variable numerical integration, so I'm
about to write a "wrapper" wich uses a
1-D method "two times", applying Fubini's Theoremhttp://en.wikipedia.org/wiki/Fubini's_theorem

I've already seen this strategy used in Matlab;
if you use Matlab, have a look to the file
dblquad.m to see what I mean.

But before re-discovering the hot water, I would
ask you if you know about a library where this is
already done!

Regards,
Giovanni Gh.

look at http://www.nrbook.com/a/bookcpdf/c4-6.pdf
this should help you.
greeetings, uwe
 
G

Giovanni Gherdovich

Thank you Victor and Uwe for your replies.

I've picked "Numerical Recipes in C++" from the local library,
and in fact chapter 4.6 (Multidimensional Integration)
addresses my problem with a very straightforward code.

I was trapped by the esotericism I found in the
code of the Matlab function dblquad.m
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/dblquad.html
but with a bit of thinking I could come out with
the minimal code provided in NR...

With that I can really use the 1-D Gaussian quadrature
provided in the GNU Scientific Library (wich is
just an implementation of the well known QUADPACK),
or pick up some fancy 1-D algorithm from http://www.netlib.org/
or http://www.oonumerics.org/oon/.

For the sake of completeness I will also list two
commercial resources I've found:
1. Visual Numerics IMSL C numerical Library
http://www.vni.com/products/imsl/c/imslc.php
2. NAG C library
http://www.nag.com/numeric/CL/CLdescription.asp

At least VN provides 2-D integration out of the box,
but I haven't strong arguments to persuade my
company to buy their license...

Victor:
In case you didn't know, there is a hierarchy of math
newsgroups, named 'sci.math.*'.

As unbelievable as it can seem, I didn't know.
Anyway, since my problem is completely solved from the
theoretical point of view, but can be trappy on the
implementation side, I thought this newsgroup was the
right place to post. Sorry if it was inappropriate.

Do you know a newsgroups specifically dedicated to numerical
analysis in C++? I've never been on the oonumerics.org
mailing list, but I tend to prefer Usenet groups.
Also, there's www.google.com (a web site) [...]

Of course I've googled the subject before posting,
and I've found that classical resources as GSL and NETLIB
only provide tools for 1-D integration.
And now, after the 20-lines sample code in the NR book,
I know why...

Regards,
Giovanni Gh.
 
P

Puppet_Sock

On Aug 7, 3:55 pm, Giovanni Gherdovich
I need to perform a two-dimensional
numerical integration,

If you are going to be doing more than one homework
assignment worth of such stuff, you need this book.

Handbook of Mathematical Functions: with Formulas,
Graphs, and Mathematical Tables (Paperback)
by Milton Abramowitz (Editor), Irene A. Stegun (Editor)

If you are going to be doing science or engineering
oriented computing with any regularity, you need it.
If you are going to be doing science or engineering
oriented calculations on or off computer, you need it.

Don't re-invent that stuff. Look it up, copy it, and,
if you have a QA program at your place, cite it.
Socks
 
G

Giovanni Gherdovich

Hello,

If you are going to be doing more than one homework
assignment worth of such stuff, you need this book.

Handbook of Mathematical Functions: with Formulas,
Graphs, and Mathematical Tables (Paperback)
by Milton Abramowitz (Editor), Irene A. Stegun (Editor)

Thank you!

I will definitely check it out.

Cheers,
Giovanni
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,522
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top