MathGroup Archive 2007

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

Search the Archive

Re: Gauss-Kronrod algorithm

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75524] Re: Gauss-Kronrod algorithm
  • From: Peter Pein <petsie at dordos.net>
  • Date: Fri, 4 May 2007 04:11:53 -0400 (EDT)
  • References: <f04nlc$8kr$1@smc.vnet.net><f16pjl$70u$1@smc.vnet.net> <f19fuf$4sj$1@smc.vnet.net>

dimitris schrieb:
> Although this is from the documentation of the upcoming version of
> Mathematica
> I suggest you to have a look!
> 
> http://reference.wolfram.com/mathematica/ref/NIntegrate.html
> 
...

This is a strange page...

suppose you want the integral of the first example with PrecisionGoal 30:

in Mathematica 5.1 for Windoze:

In[1]:= (* with MachinePrecision: *)
vars = {x1, x2, x3, x4};
Timing[NIntegrate[Inner[Divide, vars, {3, 2, 2, 10}]^(-1/2),
        Evaluate[Sequence @@ ({#1, 0, 1} & ) /@ vars]]]
Out[2]=
{0.0923*Second, 1.2391040669224405}

...well done :-), but:

In[3]:=
TimeConstrained[Timing[NIntegrate[Inner[Divide, vars, {3, 2, 2, 10}]^(-1/2),
    Evaluate[Sequence @@ ({#1, 0, 1} & ) /@ vars], PrecisionGoal -> 30,
WorkingPrecision -> 32]],
  35, $Failed]
Out[3]=
$Failed
In[4]:=
Timing[N[Integrate[Inner[Divide, vars, {3, 2, 2, 10}]^(-1/2),
    Evaluate[Sequence @@ ({#1, 0, 1} & ) /@ vars]], 30]]
Out[4]=
{17.219*Second, 1.239104123885570005313026072763653619727834549813`30.}

Direct approximation does not succeed in more than twice the time, exact
integration and subsequent approximation needs.

 This example shows again that using exact expressions as far as possible is
often a good choice, when high precision is wanted.

 The second example contains a call to RandomReal, which is not mentioned at
http://reference.wolfram.com/mathematica/ref/RandomReal.html, because "1" is
definitely not a range. Try for example
Integrate[1,Prepend[1,myfavouritevariableletter]] to calculate
Integrate[1,{x,0,1}]. Does this work in version 6?? I guess it does (and
should) not. The new concept of a range introduces unnecessary inconsistencies.

 Or does that help page (RandomReal) just use incorrect terms?

slightly confused greetings,
Peter


  • Prev by Date: Re: averaging sublists of different lengths
  • Next by Date: Re: A program check
  • Previous by thread: Re: Gauss-Kronrod algorithm
  • Next by thread: Re: Gauss-Kronrod algorithm