Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*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 smc.vnet.net
  • Subject: [mg46655] Re: [mg46613] Speed of V5 vs V4
  • From: Anton Antonov <antonov at wolfram.com>
  • Date: Thu, 26 Feb 2004 17:54:24 -0500 (EST)
  • References: <200402251807.NAA05902@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

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?
>
>Timing[NIntegrate[(Sin[q])^2,{q,0,Pi},WorkingPrecision->15,MaxPoints->7000]]
>
>This is after a clean install of each version, so all the settings are at their default
>values.
>  
>
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 
precise.  

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