Re: 2D Integration

*To*: mathgroup at yoda.physics.unc.edu, swolf*Subject*: Re: 2D Integration*From*: keiper*Date*: Mon, 7 Jun 93 18:15:25 CDT

> A while back I posted a question on 2D integration - i.e. is there a > good way to do this in Mma? It would be nice if WRI would make a > decent 2D or 3D integration routine (hint hint) -- the built in > Mma NIntegrate is much to slow for multiple integration involving > interpolating functions. It is not clear what is meant by "decent", but presumably the idea is to sacrifice accuracy for speed. The default options for NIntegrate are set to give 6 digits (assuming machine precision calculations) in the final result. Moreover the estimate of the error is rather conservative so you often get a relative error that is much less than 10^-6. But that is no reason to consider NIntegrate[ ] "indecent". As a user you are perfectly free to choose a different AccuracyGoal or PrecisionGoal. For example: In[4]:= Timing[NIntegrate[Exp[-x+2 y^2],{x,-1,1},{y,0,1}]] Out[4]= {2.53333 Second, 5.55742} In[5]:= Timing[NIntegrate[Exp[-x+2 y^2],{x,-1,1},{y,0,1}, PrecisionGoal -> 1]] Out[5]= {0.05 Second, 5.55705} By asking for only the first digit of the result to be correct we get a speedup by a factor of more than 50 and still achieve a relative error of less than 0.007 percent. Jerry B. Keiper keiper at wri.com Wolfram Research, Inc.