Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: NIntegrate preprocessing and rule selection

  • To: mathgroup at smc.vnet.net
  • Subject: [mg81488] Re: NIntegrate preprocessing and rule selection
  • From: antononcube <antononcube at gmail.com>
  • Date: Wed, 26 Sep 2007 06:31:01 -0400 (EDT)
  • References: <fc85un$ll0$1@smc.vnet.net>

The specialized integrator for finite oscillatory integrals uses
modified Clenshaw-Curtis rule. When the integral is not oscillatory
enough the modified Clenshaw-Curtis rule switches to a Gauss-Kronrod
rule. Consider this an integral part of the modified Clenshaw-Curtis
rule (which is applied only to finite oscillatory integrals).

So if we want to use the non-modified Cleshaw-Curtis rule, we should
preclude the OscillatorySelection strategy. Here is one way to do
this:

In[8]:= f[w_, x_] = Sin[w*x]/(x2);

In[9]:= Reap[NIntegrate[f[1, x], {x, 1, 2},
  Method -> {"SymbolicPreprocessing", "OscillatorySelection" -> False,
    Method -> "ClenshawCurtisRule"}, EvaluationMonitor :> Sow[x]]]

Out[9]= {0.472399, {{1., 1.03806, 1.14645, 1.30866, 1.5, 1.69134,
1.85355, 1.96194,
   2., 1.01903, 1.07322, 1.15433, 1.25, 1.34567, 1.42678, 1.48097,
1.98097,
   1.92678, 1.84567, 1.75, 1.65433, 1.57322, 1.51903}}}

Compare with:

In[13]:= Reap[NIntegrate[x6, {x, 1, 2}, Method ->
"ClenshawCurtisRule",
  EvaluationMonitor :> Sow[x]]]

Out[13]= {18.1429, {{1., 1.03806, 1.14645, 1.30866, 1.5, 1.69134,
1.85355, 1.96194, 2.,
    1.01903, 1.07322, 1.15433, 1.25, 1.34567, 1.42678, 1.48097,
1.98097,
   1.92678, 1.84567, 1.75, 1.65433, 1.57322, 1.51903}}}

Anton Antonov
Wolfram Research, Inc

On Sep 12, 2:53 am, "Andrew Moylan" <andrew.j.moy... at gmail.com> wrote:
> Here's an integrand that is highly oscillatory for large values of its first
> argument:
>
> f[w_, x_] = Sin[w*x]/(x^2);
>
> For small w,NIntegrateautomatically selects GaussKronrodRule as usual:
>
> Reap[NIntegrate[f[1, x], {x, 1, 2}, EvaluationMonitor :> Sow[x]]]
>
> For large w,NIntegrate'spreprocessor decides the integrand is highly
> oscillatory and uses its specialised Clenshaw-Curtis rule for oscillatory
> integrands:
>
> Reap[NIntegrate[f[10, x], {x, 1, 2}, EvaluationMonitor :> Sow[x]]]
>
> (One way to tell that the specialised rule was used is to notice that the
> endpoints (1. and 2.) were sampled.)
>
> Now consider this example:
>
> Reap[NIntegrate[f[1, x], {x, 1, 2}, Method -> "ClenshawCurtisRule",
>      EvaluationMonitor :> Sow[x]]]
>
> As expected,NIntegrate'spreprocessor does not decide to use the
> specialised Clenshaw-Curtis rule (because w is too low to be called "highly
> oscillatory"). However, the integration then apparently proceeds using
> GaussKronrodRule rather than the requested ClenshawCurtisRule. Why is this?
>
> One way to get around this for particular cases where you know it is going
> to happen is to use the option "SymbolicProcessing"->0. But what should we
> do if we *do* want symbolic processing, but want ClenshawCurtisRule to be
> used (instead of GaussKronrodRule) in those cases to which none ofNIntegrate'sspecialised rules apply?




  • Prev by Date: Re: Erroneous Mathematica Kummer's (Hypergeometric1F1)
  • Next by Date: Re: Nullcline and getting "2" values for y
  • Previous by thread: NIntegrate preprocessing and rule selection
  • Next by thread: Re: DisplayForm Problem