473,325 Members | 2,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Numerical integration (two dimensions!)

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.
Aug 7 '08 #1
6 4208
Giovanni Gherdovich wrote:
I need to perform a two-dimensional
numerical integration, i.e. my functions are
R^2 -R.

[..]

But before re-discovering the hot water, I would
ask you if you know about a library where this is
already done!
In case you didn't know, there is a hierarchy of math newsgroups, named
'sci.math.*'. Check them out. Also, there's www.google.com (a web
site) where you can type "numerical integration c++ library" and find
interesting stuff...

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 7 '08 #2
On 7 Aug., 21:55, Giovanni Gherdovich
<gherdov...@students.math.unifi.itwrote:
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
Aug 8 '08 #3
Thank you Victor and Uwe for your replies.
look at http://www.nrbook.com/a/bookcpdf/c4-6.pdf
this should help you.
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/help...f/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.
Aug 8 '08 #4
Giovanni Gherdovich wrote:
[..]
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++?
No. If you need numerical analysis, it has nothing to do with C++ and
so you have 'sci.math.numanalysis' (or some such). If you have a C++
language problem, it does not matter what field you're in (C++ is a
general purpose programming language, not specific to numerics), ask
here, we're happy to help.
[..]
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 8 '08 #5
On Aug 7, 3:55*pm, Giovanni Gherdovich
<gherdov...@students.math.unifi.itwrote:
[snip]
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
Aug 8 '08 #6
Hello,

On Aug 8, 9:19 pm, Puppet_Sock <puppet_s...@hotmail.comwrote:
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
Aug 10 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gopal Krish | last post by:
Any sample code that uses foreach statement to walkthrough a two dimensional array? My requirement is to process data in only one dimension (say column 0 in each row of the array) Example...
2
by: Josema | last post by:
Hi, I need to instance an object of type array (of two dimensions), but i dont know what are the integers of two dimensions. I take from database some data and i would like to use the SetValue...
16
by: rguti | last post by:
Hi, How do I create a two dimensional array? I have created a one dimensional doing this: Dim laFields As ArrayList = New ArrayList How about to do a 2 dimensional?
15
by: cwsullivan | last post by:
Hi gang, I have a grid full of particles in my program, and I want to find an angle between two particles. I'm having trouble because it seems like the answer depends on whether or not the target...
1
by: =?Utf-8?B?Sm9l?= | last post by:
how to dynamic assign two dimensions array size say Dim myArray(x, y) as Integer
4
by: sanctus | last post by:
I'm trying to write a simulation program in cosmology and I'm stuck because I need to calculate integrals of the form sin(x)/x. Has anyone a source code for this? Or is there an easy way to do it in...
3
by: Zayde | last post by:
Is there a package of functions to do numerical integration in PHP ?
0
by: tiddwaylll | last post by:
Hi Hi, I am looking for a easy and free numerical library to implement. More important is to be free haha. The language/framework is in C#.NET. If you know of any, please point me in the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.