       Re: Calculate a numerical integral with enough precision

• To: mathgroup at smc.vnet.net
• Subject: [mg114728] Re: Calculate a numerical integral with enough precision
• From: Andrew Moylan <amoylan at wolfram.com>
• Date: Tue, 14 Dec 2010 06:56:27 -0500 (EST)

```Oops, I used 2*Pi instead of Pi/2. Here it is with the correct upper bound on the integral:

In:= terms = Table[NIntegrate[Sin[1/x]^n/n!, {x, 0, \[Pi]/2}], {n, 0, 20}]

Out= {1.5708, 0.907801, 0.480967, 0.106782, 0.0296747, 0.00411818, 0.000796359, \
0.0000806215, 0.0000120758, 9.62763*10^-7, 1.1806*10^-7, 7.76187*10^-9,
8.06354*10^-10, 4.50918*10^-11, 4.06356*10^-12, 1.97651*10^-13,
1.57249*10^-14, 6.76638*10^-16, 4.81798*10^-17, 1.85856*10^-18,
1.19747*10^-19}

In:= Total[terms] // InputForm

Out//InputForm=
3.101028987751552

Andrew Moylan
Wolfram Research

----- Original Message -----
From: "Andrew Moylan" <amoylan at wolfram.com>
To: "Alexei Boulbitch" <alexei.boulbitch at iee.lu>
Cc: mathgroup at smc.vnet.net
Sent: Tuesday, December 14, 2010 10:50:42 AM
Subject: [mg114728] Re: [mg114709] Re: Calculate a numerical integral with enough precision

This is a tricky one. I don't know any automatic methods for these kind of integrals.

I found one manual method which works however:

The new "LevinRule" method for NIntegrate in Mathematica 8 can efficiently handle integer powers of oscillatory functions. Therefore you can try replacing Exp with its power series:

Exp[Sin[1/x]] = Sin[1/x] + Sin[1/x]^2 / 2! + ...

In:= terms =
Table[NIntegrate[Sin[1/x]^n / n!, {x, 0, 2 \[Pi]}], {n, 0, 20}]

Out= {6.28319, 2.26277, 0.706044, 0.135229, 0.0326695, \
0.00439035, 0.000818095, 0.0000821659, 0.0000121744, 9.68476*10^-7,
1.18363*10^-7, 7.7766*10^-9, 8.07019*10^-10, 4.51197*10^-11,
4.06465*10^-12, 1.97691*10^-13, 1.57263*10^-14, 6.76684*10^-16,
4.81812*10^-17, 1.85861*10^-18, 1.19749*10^-19}

The terms shrink fast:

ListLogPlot[terms]

Therefore I suspect all the digits shown here are correct:

In:= Total[terms] // InputForm

Out//InputForm=
9.425202795524033

A different way may be to use a contour integral if you can find the right contour.

----- Original Message -----
From: "Alexei Boulbitch" <alexei.boulbitch at iee.lu>
To: mathgroup at smc.vnet.net
Sent: Monday, December 13, 2010 10:34:34 PM
Subject: [mg114728] [mg114709] Re: Calculate a numerical integral with enough precision

NIntegrate[Exp[Sin[1/x]], {x, 0, \[Pi]/2}, WorkingPrecision -> 12,
Exclusions -> (x == 0), PrecisionGoal -> 15] // Quiet

3.09892833696

* /Subject/: [mg114668] Calculate a numerical integral with enough
precision
* /From/: alphatest <iliurarfwpuap at mailinator.com>
* /Date/: Sun, 12 Dec 2010 05:45:17 -0500 (EST)

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

How can we calculate the following integral up to 10-12 decimal places?

integrate exp(sin(1/x)) , x=0..pi/2

It's as if no integration method or precision option lets you calculate more than 5-6 decimal places. Is it possible?

--
Alexei Boulbitch, Dr. habil.
Senior Scientist
Material Development

IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 CONTERN
Luxembourg

Tel: +352 2454 2566
Fax: +352 2454 3566
Mobile: +49 (0) 151 52 40 66 44

e-mail: alexei.boulbitch at iee.lu

www.iee.lu

--

This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you are not the intended
recipient and have received this e-mail in error, you are hereby
notified that any review, copying or distribution of it is strictly
prohibited. Please inform us immediately and destroy the original
transmittal from your system. Thank you for your co-operation.

```

• Prev by Date: Re: LessEqual vs Inequality, was ..Re: Replacement Rule with Sqrt in denominator
• Next by Date: Re: Replacement Rule with Sqrt in denominator. Also Bug in Series
• Previous by thread: Re: Calculate a numerical integral with enough precision
• Next by thread: Re: Calculate a numerical integral with enough precision