RE: NIntegrate or For or Special Function?
- To: mathgroup at smc.vnet.net
- Subject: [mg47726] RE: [mg47700] NIntegrate or For or Special Function?
- From: David.Annetts at csiro.au
- Date: Fri, 23 Apr 2004 02:31:10 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi Matt, > I am constructing filling entries in a matrix using For loops. The > individual entries come from integrating Bessel, Hankel and Kelvin > functions numerically with NIntegrate. A 100x100 matrix > takes a few hours > to run? Is my procedural way of doing things to blame? Is it the > specialty functions (Bessel etc)? Is it simply NIntegrate? > Would anyone > be willing to look at my awful code? > > Any help would be greatly appreciated. Without looking at your 'awful code', it's very likely that your procedural way of doing things is the root of the problem. If you can at all rethink things so that you can take advantage of Mathematica's functional programming constructs (eg. Map, Inner, Outer, etc,.), then it's time & effort well spent. For example, I have seen a x20 speed up replacing Fortran-style nested loops with Outer. Perhaps posting a reduced (eg 3x3) version of your problem might elicit some suggestions from the group? Regards, Dave. ========================================== Dr. David Annetts EM Modelling Analyst CSIRO DEM Tel: +612 9490 5416 North Ryde Fax: +612 9490 5467 Australia David.Annetts at csiro.au ===========================================