 
 
 
 
 
 
NIntegrate vs. N[Integrate]
- To: mathgroup at yoda.physics.unc.edu
- Subject: NIntegrate vs. N[Integrate]
- From: Mangalam Vasudaven <TVASUDAVE at cc.curtin.edu.au>
- Date: 21 Jul 1993 13:23:54 +0800
Hello Mathgroup,
I was always under the impression that it is a lot more efficient to use
NIntegrate when one is trying to get approximate values of definite integrals
than surround it by N[].  But while playing around with some gamma integrals
I found that NIntegrate took sixty times as much time as the second method.
BTW, Mathematica Book, in page 683, confirms my original impression.
p[x_]:= Integrate[(y^6)*(E^-y)/6!,{y,0,x}]
NIntegrate[ p[x]*(1-p[x]),{x,0,200}]
Now, the NIntegrate took 336.36 seconds.  And
N[Integrate[p[x]*(1-p[x]),{x,0,200},10]
took just 5.66 seconds, giving an answer accurate to more decimal places than
NIntegrate, incidently.
Why does this happen?  Being a novice to Mathematica, I could not figure out
why.  If it is of any relevance, I am running version 2.2 under windows.
M. Vasudaven
Curtin University of Technology
Perth

