[Date Index] [Thread Index] [Author Index]
RE: NIntegrate or For or Special Function?
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 ===========================================