MathGroup Archive 2006

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

Search the Archive

confusion about sampled points in NIntegrate[...,Method->Oscillatory]

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70085] confusion about sampled points in NIntegrate[...,Method->Oscillatory]
  • From: dimmechan at yahoo.com
  • Date: Mon, 2 Oct 2006 00:34:26 -0400 (EDT)

Dear all,

I posted this message again since of his unreadable format there
was no response. I will concentrate only on my queries ommiting
unecessary details.

-----------------------------------------------------------------------

I am very confused about the points sampled by NIntegrate when the
option Method->Oscillatory is selected.

Remove["Global`*"]
$Version
5.2 for Microsoft Windows (June 20, 2005)

Consider the following rapidly oscillatory function

hh[x_]:=ArcTan[3/x] Sin[-9 x]

Here is its plot

Plot[hh[x],{x,0,10},PlotPoints\[Rule]1000];


Here is the analytic result of the integral over the range
{x,0,Infinity}

Integrate[hh[x],{x,0,Infinity}]//N
-0.1745329251991049

Here is one numerical estimation

NIntegrate[hh[x],{x,0,Infinity},Method\[Rule]Oscillatory]
-0.174532925199098

Previous command is equivalent to

NIntegrate[hh[x],{x,0,3(1/9)Pi}]+NSum[NIntegrate[hh[x],{x,k(1/9)Pi,(k+1)(1/­9)Pi}],{k,3,Infinity},Method\[Rule]SequenceLimit,VerifyConvergence\[Rule]False]

NIntegrate::nlim: x = 0.349066 k is not a valid limit of integration.
-0.17453292519909863

Here is the number of sampled points.

Block[{Message},Length[Reap[NIntegrate[hh[x],{x,0,3(1/9)Pi},EvaluationMonit­or\[RuleDelayed]Sow[x]]+NSum[NIntegrate[hh[x],{x,k(1/9)Pi,(k+1)(1/9)Pi},Eva­luationMonitor\[RuleDelayed]Sow[x]],{k,3,Infinity},Method\[Rule]SequenceLimit,Veri­fyConvergence\[Rule]False]][[2,1]]]]

374


Below is another implementation

psum[i_?NumberQ]:=NIntegrate[hh[x],{x,i(1/9)Pi,(i+1)(1/9)Pi}]

NSum[psum[i],{i,0,Infinity},Method\[Rule]SequenceLimit,VerifyConvergence\[Rule]Fal­se]

-0.1745329251991767

Consider now the following function which keeps track of the points
at which is evaluated, in a list called sampledPoints.

sampledPoints={};
f[x_?InexactNumberQ]:=(AppendTo[sampledPoints,x];-ArcTan[3/x])

Then

NIntegrate[f[x]*Sin[9x],{x,0,Infinity},Method\[Rule]Oscillatory]
-0.17453292519909797

However, executing the following command someone get the idea
that there are almost 4000 sampling points!

Length[sampledPoints]
3894

I do not understand why now exists this big difference in the
sampling points.

Note that executing the next commands show that the two approaches (the

first with Reap...Sow, the second with AppendTo) give the same list of
sample points.


Block[{Message},Length[Reap[NIntegrate[f[x]*Sin[9x],{x,
        0,Infinity},EvaluationMonitor\[RuleDelayed]Sow[x]]][[2,1]]]]
286

sampledPoints={};
Block[{Message},NIntegrate[f[x]*Sin[9x],{x,0,Infinity}]]
1.8915013450362048
Length[sampledPoints]
286

Note also that you cannot apply the Reap...Sow approach directly since

Reap[NIntegrate[f[x]Sin[9x],{x,
0,Infinity},Method\[Rule]Oscillatory,EvaluationMonitor\[RuleDelayed]Sow[x]]]

{-0.17453292519909797, {{x}}}

I really appreciate some guidance.
Thanks in advance for any assistance. 


Dimitrios Anagnostou 
NTUA


  • Prev by Date: Re: RE: Re: Re: distance function
  • Next by Date: Re: RE: Re: Re: distance function
  • Previous by thread: oscillatory integrals
  • Next by thread: unexpected operator error - 5.2 on linux