MathGroup Archive 2007

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

Search the Archive

Re: Numerical integration

  • To: mathgroup at smc.vnet.net
  • Subject: [mg79725] Re: Numerical integration
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Thu, 2 Aug 2007 04:01:48 -0400 (EDT)
  • References: <f8pia5$1nu$1@smc.vnet.net>

On 1    , 12:04, chuck009 <dmili... at comcast.com> wrote:
> Personally, I would suspect the symbolic result as well unless you know f=
rom independent means that the results returned by Integrate is indeed the =
correct result.  This I say in regards to another similar situation with:
>
> Log[1+1/(e^x Sqrt[x])]
>
> which returns an incorrect result symbolically.  When I use the Method->O=
scillatory I get:
>
> In[24]:=
> NIntegrate[f[x],{x,0,Infinity},Method->Oscillatory,WorkingPrecision\[Rule=
]2=AD0]
>
> Out[24]=
> 0.871

1)I don't have another source to check the integral. But based that
both Mathematica
and the other (very good!) CAS I used gave symbolic results which
their numerical
estimation agree I think that the symbolic result is ok.

2) Mathematica 6 as it shown by Bob Hanlon has problems both
numerically
and symbolically. Symbolically, that it returns an incorrect result is
of course
a bug. As regards numerically, the result itslef is quite incorrect
but I think that
"playing with" the options we can achieve better numerical estimation.
The problem is that Mathematica 6 does not return any warning message
indicating that the result might be wrong. For example something like
the following

"NIntegrate failed to converge" etc

3) You must be careful with the Method->Oscillatory.
The method cannot be used for integrands like the current one.

See here for a good reference

http://reference.wolfram.com/mathematica/tutorial/NIntegrateIntegrationStra=
tegies.html#775797877

and in particular the section under the title

Extrapolating Oscillatory Strategy

Mathematica 6 is thousand of years advanced as regards
the numerical integration algorithms compare to 5.2.
A good example is the handling of oscillatory kernels
in version 6.

Anyway, below I use Mathematica 5.2.

In[8]:=
Plot[Log[1 + z^2]*(BesselJ[1, z]^2/z), {z, 0, 10}]

This is not an oscillatory function.
There is not an alternation in the slope of the function
between the successive zeros.

On the contrary, compare

In[68]:=
Plot[{Sin[x]/Sqrt[1 + x^2], 1.*BesselJ[0, x]}, {x, 0, 20}, PlotStyle -
> {Green, Orange}]
Off[Integrate::gener]
Integrate[{Sin[x]/Sqrt[1 + x^2], BesselJ[0, x]}, {x, 0, Infinity},
GenerateConditions -> True]
N[%, 10]
NIntegrate[{Sin[x]/Sqrt[1 + x^2], N[1, 20]*BesselJ[0, x]}, {x, 0,
Infinity}, Method -> Oscillatory, WorkingPrecision -> 20,
PrecisionGoal -> 10]
On[Integrate::gener]

Out[68]=
 Graphics

Out[70]=
{(1/2)*Pi*(BesselI[0, 1] - StruveL[0, 1]), 1}

Out[71]=
{0.8730842426508674934616911159`10., 1.`10.}

Out[72]=
{0.8730842426508677087735429131`10.274488994624038,
1=2E0000000000000010826934578504`11.824627444142767}


Dimitris




  • Prev by Date: Re: removing those annoying $$$$'s from local variables names?
  • Next by Date: Re: Multi-variable Integration
  • Previous by thread: Re: Numerical integration
  • Next by thread: Re: Dot or Inner ... but not quite