Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Precision available with NIntegrate {Method -> Oscillatory}

132 views
Skip to first unread message

Peter

unread,
Mar 7, 2007, 3:17:35 AM3/7/07
to
Hi. I'm helping someone with a scientific programming problem, and I
wanted to get a high accuracy result to use as a reference solution.
I am able to get 15 digits of accuracy for a non-oscillatory integral,
but it appears that when I specify the option Method -> Oscillatory
for NIntegrate, it ignores my precision request:

--------------------------------------------------------------------
a = 0;
b = 6706902 * 10^\(-7);
c = 589300 * 10^(-6);
d = 9802874 * 10^(-7);
t = -5026548 * 10^(-6);
=CE=B1 = 0;

Iint = NIntegrate[(b^2 - 2 d Cos[t + x] b + d^2 + (a + b c
x)^2)^(-3/2), {x, =CE=B1, Infinity}, {PrecisionGoal -> 15, WorkingPrecision
-> 30, MaxRecursion -> 200}]


NIntegrate::slwcon :
Numerical integration converging too slowly; suspect one of the
following: singularity, value of the integration being 0, oscillatory
integrand, or insufficient WorkingPrecision. If your integrand is
oscillatory try using the option Method->Oscillatory in NIntegrate.
More...

1=2E46869038002327

Cint = NIntegrate[Cos[x]/(b^2 - 2 d Cos[t + x] b + d^2 + (a + b c
x)^2)^(3/2), {x, =CE=B1, Infinity}, {PrecisionGoal -> 15, WorkingPrecision -
> 25, MaxRecursion -> 300, Method -> Oscillatory}]

0=2E2592156

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

I'm not concerned about the slow convergence warning on the first
integral, Iint. Rather, the second integral, Cint, is only evaluated
to a precision of 8 digits, despite the explicit request for more in
the call to Nintegrate. Does anyone have a suggestion to obtain 15
digits of precision on the second integral?

Thanks,
Peter


Jean-Marc Gulliet

unread,
Mar 8, 2007, 4:32:43 AM3/8/07
to

Set the system variable $MinPrecision to 15.

In[1]:=
a = 0;
b = 6706902/10^7;
c = 589300/10^6;
d = 9802874/10^7;
t = -5026548/10^6;

Block[{$MinPrecision = 15},
Cint = NIntegrate[Cos[x]/(b^2 - 2*d*Cos[t + x]*b +
d^2 + (a + b*c*x)^2)^(3/2), {x, 0, Infinity},


{PrecisionGoal -> 15, WorkingPrecision -> 30,

MaxRecursion -> 300, Method -> Oscillatory}]]

Precision[Cint]

Out[6]=
0.2592155970460264

Out[7]=
15.988

Regards,
Jean-Marc

Peter

unread,
Mar 8, 2007, 4:52:44 AM3/8/07
to
On Mar 7, 12:17 am, "Peter" <petersamsim...@hotmail.com> wrote:
> Hi. I'm helping someone with a scientific programming problem, and I
> wanted to get a high accuracy result to use as a reference solution.
> I am able to get 15 digits of accuracy for a non-oscillatory integral,
> but it appears that when I specify the option Method -> Oscillatory
> for NIntegrate, it ignores my precision request:
>
> --------------------------------------------------------------------
> a = 0;
> b = 6706902 * 10^\(-7);
> c = 589300 * 10^(-6);
> d = 9802874 * 10^(-7);
> t = -5026548 * 10^(-6);
> alpha = 0;

>
> Iint = NIntegrate[(b^2 - 2 d Cos[t + x] b + d^2 + (a + b c
> x)^2)^(-3/2), {x, alpha, Infinity}, {PrecisionGoal -> 15, WorkingPrecision

> -> 30, MaxRecursion -> 200}]
>
> NIntegrate::slwcon :
> Numerical integration converging too slowly; suspect one of the
> following: singularity, value of the integration being 0, oscillatory
> integrand, or insufficient WorkingPrecision. If your integrand is
> oscillatory try using the option Method->Oscillatory in NIntegrate.
> More...
>
> 1.46869038002327

>
> Cint = NIntegrate[Cos[x]/(b^2 - 2 d Cos[t + x] b + d^2 + (a + b c
> x)^2)^(3/2), {x, alpha, Infinity}, {PrecisionGoal -> 15, WorkingPrecision -

> > 25, MaxRecursion -> 300, Method -> Oscillatory}]
>
> 0.2592156

>
> --------------------------------------------------------------------
>
> I'm not concerned about the slow convergence warning on the first
> integral, Iint. Rather, the second integral, Cint, is only evaluated
> to a precision of 8 digits, despite the explicit request for more in
> the call to Nintegrate. Does anyone have a suggestion to obtain 15
> digits of precision on the second integral?
>
> Thanks,
> Peter

I apologise for some of the symbols appearing wrong in my first post.
I have corrected them in the quoted material above. I'm still looking
for an answer.

Thanks,
Peter


Peter

unread,
Mar 9, 2007, 2:02:07 AM3/9/07
to
On Mar 8, 1:32 am, Jean-Marc Gulliet <jeanmarc.gull...@gmail.com>
wrote:

Thank-you, Jean-Marc. It worked. Could you please explain why it is
necessary? I thought that the options I passed to NIntegrate were
sufficient.

Thanks,
Peter


Jean-Marc Gulliet

unread,
Mar 10, 2007, 7:04:17 AM3/10/07
to
Hi Peter,

Options such as PrecisionGoal as a wish. That is, NIntegrate will try to
return a result with the desired precision. This is not guarantee,
however. From the online help, "Even though you may specify
PrecisionGoal -> n, the results you get may sometimes have much less
than n‐digit precision."

OTOH, $MinPrecision is a system-wide variable. Setting it to a specific
value coerces Mathematica to work at least at given level of precision:
"By making the global assignment $MinPrecision = n, you can effectively
apply SetPrecision[expr, n] at every step in a computation. This means
that even when the number of correct digits in an arbitrary‐precision
number drops below n, the number will always be padded to have n digits.
[1]"

Section 3.1.5 "Arbitrary-Precision Numbers" is worth reading [1].

HTH,
Jean-Marc

[1] "The Mathematica Book Online / Advanced Mathematics in Mathematica /
Numbers / 3.1.5 Arbitrary-Precision Numbers",
http://documents.wolfram.com/mathematica/book/section-3.1.5

0 new messages