Main Page | Report this Page
 
   
Science Forum Index  »  Mathematics Forum  »  Yet another Numerical Integration question... (At wit's end)
Page 1 of 1    
Author Message
Binesh Bannerjee
Posted: Fri Dec 19, 2003 6:12 am
Guest
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi... I have a function f that takes a vector (from 3-5 dimensions)...

and, I need to integrate it... I've used the Numerical Recipes in C
book (sort of) to code (as it suggests) the integrals by just
taking slices along each dimension at a time, and integrating each
of those dimensions... First I was using Simpson's, which was just
horrendously unusably slow at dimensions > 2 even... So, then, I read
about gauss-legendre, and tried that... This was fast, to be sure,
but, it wasn't all that accurate, unless I upped N to a point where
it was no longer fast, (and still it worries me that it requires that
the integrand be approximable by a polynomial...) So, anyway, I decided
to use the GNU Scientific Library, ... Anyway, enough of the rambling,

I've tried Simpson, Quadratures, Monte Carlo... All are kind of slow.

Is this just a situation where, "Yeah, if you want to integrate on multiple
dimensions, it takes a long time, if you can't symbolically integrate."?

(If not, if someone could point me at any optimized C/C++ libraries that
would do numeric integration, that'd be great too!)

Thanks!

Binesh Bannerjee

- --
"If trees could scream, would we be so cavalier about cutting them down?
We might, if they screamed all the time, and for no good reason..."
-- Jack Handey

PGP Key: http://www.hex21.com/~binesh/binesh-public.asc
Key fingerprint = 421D B4C2 2E96 B8EE 7190 A0CF B42F E71C 7FC3 AD96
SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub
SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub
OpenSSH Key: http://www.hex21.com/~binesh/binesh-openssh.pub
CipherKnight Seals:
http://www.hex21.com/~binesh/binesh-seal.tar.bz2.cs256
http://www.hex21.com/~binesh/binesh-seal.zip.cs256
http://www.hex21.com/~binesh/binesh-certificate.gif.cs256
Decrypt with CipherSaber2 N=256, Password="WelcomeJedi!" (No quotes)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/4t0ktC/nHH/DrZYRAp0LAKC1Xt4PaCVA5PeKlHkYyaW/9Qf1BgCgimRN
SAQwnuY4gFTNiS4alCfVVzg=
=3x93
-----END PGP SIGNATURE-----
Binesh Bannerjee
Posted: Fri Dec 19, 2003 9:32 am
Guest
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Binesh Bannerjee <binesh-dated-1072435944.316c3c@hex21.com> wrote:
[ a whole bunch of stuff on the woes of numeric integration. ]

OK... This just occurred to me. There is a definite polynomial component
to my problem (Exp[-((X-m)/sd)^2/2]*(Polynomial((X-m)/sd))*
Log[(k+(a X + b))/k])... (The difficulty of course, is that that's just
for one dimension, the real problem has multiple X's, m's, sd's, a's and
b's. (same k tho))...

Anyhoo. I was re-reading the Numeric Recipes in C book... and it
_mentions_ in the section on multidimensional integrals:
If the boundary is simple and the function is very smooth, then
the remaining approcaes, breaking up the problem into repeated
one dimensional integrals, or multidimensional Gaussian
quadratures, will be effective and relatively fast.

Well, I've been trying the "repeated one dimensional integral" method,
(till I get to a single dimension at which point I'm using quadratures)
and it doesn't _seem_ all that fast. But, aside from the tantalizing
mention of multidimensional quadratures, he doesn't really _say_
anything about it...

I did a search on Google and came up with some hints to this beast...
But, ... Well... any help towards understanding the concept would
be greatly appreciated. In the meantime, I'm re-reading again the
quadratures section of Numeric Recipes, to see if I can figure out
how to generalize the concept to dimensions > 1...

Thanks,
Binesh Bannerjee

- --
"If computers that you build are quantum,
Then spies of all factions will want 'em.
Our codes will all fail,
And they'll read our email,
Till we've crypto that's quantum, and daunt 'em."
-- Jennifer and Peter Shor
http://www.research.att.com/~shor/notapoet.html

PGP Key: http://www.hex21.com/~binesh/binesh-public.asc
Key fingerprint = 421D B4C2 2E96 B8EE 7190 A0CF B42F E71C 7FC3 AD96
SSH2 Key: http://www.hex21.com/~binesh/binesh-ssh2.pub
SSH1 Key: http://www.hex21.com/~binesh/binesh-ssh1.pub
OpenSSH Key: http://www.hex21.com/~binesh/binesh-openssh.pub
CipherKnight Seals:
http://www.hex21.com/~binesh/binesh-seal.tar.bz2.cs256
http://www.hex21.com/~binesh/binesh-seal.zip.cs256
http://www.hex21.com/~binesh/binesh-certificate.gif.cs256
Decrypt with CipherSaber2 N=256, Password="WelcomeJedi!" (No quotes)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/4wvYtC/nHH/DrZYRAswNAKDBb6/qzQr3pbm0Iwt3385oSm5BawCg44Zm
7Qf9Nj01x7onQQTXXHB4kig=
=f66m
-----END PGP SIGNATURE-----
Herman Rubin
Posted: Fri Dec 19, 2003 9:53 am
Guest
In article <3fe2dd34$0$4744$61fed72c@news.rcn.com>,
Binesh Bannerjee <binesh-dated-1072435944.316c3c@hex21.com> wrote:
Quote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi... I have a function f that takes a vector (from 3-5 dimensions)...

and, I need to integrate it... I've used the Numerical Recipes in C
book (sort of) to code (as it suggests) the integrals by just
taking slices along each dimension at a time, and integrating each
of those dimensions... First I was using Simpson's, which was just
horrendously unusably slow at dimensions > 2 even... So, then, I read
about gauss-legendre, and tried that... This was fast, to be sure,
but, it wasn't all that accurate, unless I upped N to a point where
it was no longer fast, (and still it worries me that it requires that
the integrand be approximable by a polynomial...) So, anyway, I decided
to use the GNU Scientific Library, ... Anyway, enough of the rambling,

I've tried Simpson, Quadratures, Monte Carlo... All are kind of slow.

Is this just a situation where, "Yeah, if you want to integrate on multiple
dimensions, it takes a long time, if you can't symbolically integrate."?

(If not, if someone could point me at any optimized C/C++ libraries that
would do numeric integration, that'd be great too!)

Numerical integration slows down rapidly with dimension.
Even two dimensions make things bad.

Above two, one mainly uses Monte Carlo, or quasi Monte Carlo.
There are ways to speed Monte Carlo up by using the method
of synthetic variables, and other such tricks. In Monte Carlo,
even with synthetic variables, for "well-behaved" problems,
the rate of convergence can only be O(1/sqrt(n)), where n is
the number of trials used. For quasi Monte Carlo, which is
usually harder to implement, it is O((log n)^d /n). So it is
hard to get accuracy.

If you can find some way to get symbolic methods in to reduce
the problem, or reduce the sampling part of it, do so. Otherwise,
you are not going to get good accuracy.


--
This address is for information only. I do not claim that these views
are those of the Statistics Department or of Purdue University.
Herman Rubin, Department of Statistics, Purdue University
hrubin@stat.purdue.edu Phone: (765)494-6054 FAX: (765)494-0558
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Wed Oct 15, 2008 7:48 pm