Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Speed of V5 vs V4

  • To: mathgroup at
  • Subject: [mg46655] Re: [mg46613] Speed of V5 vs V4
  • From: Anton Antonov <antonov at>
  • Date: Thu, 26 Feb 2004 17:54:24 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

Bill NoSPAM wrote:

>Can anybody tell me why this should take about 10 times as long in version 5.01 as in
>version 4.2?
>This is after a clean install of each version, so all the settings are at their default
Calling NIntegrate with the option MaxPoints invokes the MonteCarlo 
methods. In version 4.2 the handling of WorkingPrecision is not handled 
properly (machine precision is used). In version 5 this done properly. 
So the apparent slowdown is because version 5 uses big precision 
numbers, while version 4.2 uses machine ones. If version 5 is called 
with machine numbers it is faster. The answer of version 5 is also more 

First, the exact answer:
(V5.0.1)In[67]:= N[Integrate[Sin[q]^2,{q,0,Pi}],20]

(V5.0.1)Out[67]= 1.5707963267948966192

V5 bignum call:
(V5.0.1)In[69]:=Timing[NIntegrate[Sin[q]^2, {q, 0, Pi}, WorkingPrecision 
-> 15, MaxPoints -> 7000]]

(V5.0.1)Out[69]={0.6799999999999864*Second, 1.5707963267948966}
                                  exact---> 1.5707963267948966192

V5 machine numbers call:
(V5.0.1In[71]:=Timing[NIntegrate[Sin[q]^2, {q, 0, Pi}, MaxPoints -> 7000]]

(V5.0.1Out[71]={0.029999999999996585*Second, 1.5707963267949019}
                                   exact---> 1.5707963267948966192

V4.2 bignum call:
(V4.2) In[11]:=Timing[NIntegrate[Sin[q]^2, {q, 0, Pi}, WorkingPrecision 
-> 15, MaxPoints -> 7000, Compiled -> False]]

(V4.2) Out[11]= {0.039999999999999994*Second, 1.5707963267949019}
                                    exact---> 1.5707963267948966192

V4.2 machine numbers call:
(V4.2) In[8]:= Timing[NIntegrate[Sin[q]^2, {q, 0, Pi}, MaxPoints -> 7000]]

(V4.2) Out[8] = {0.03*Second, 1.5707963267949019}
                    exact---> 1.5707963267948966192

Anton Antonov 
Wolfram Research, Inc.

  • Prev by Date: Re: Matrix Element Extraction
  • Next by Date: Re: How to set y always greater than or equal to x for a function?
  • Previous by thread: Speed of V5 vs V4
  • Next by thread: Re: Speed of V5 vs V4