Re: New LevinIntegrate package for highly oscillatory integration

• To: mathgroup at smc.vnet.net
• Subject: [mg82578] Re: New LevinIntegrate package for highly oscillatory integration
• From: antononcube <antononcube at gmail.com>
• Date: Thu, 25 Oct 2007 06:07:35 -0400 (EDT)
• References: <fei3qo\$qsb\$1@smc.vnet.net>

```This package can be hooked up to V6.0 NIntegrate using NIntegrate's
plug-in mechanism. It would be best if the package is made in such a
way that it provides a new integration strategy. (I.e. the plug-in is
its ultimate goal.)

Below is an example how the hook up can be done just using
LevinIntegrate. Note that with that new strategy, LevinOscillatory,
piecewise functions are properly integrated. E.g. this works

In[21]:= NIntegrate[If[x < 5, Sqrt[x], Exp[I*Cosh[x]]], {x, 0, 10},
Method -> LevinOscillatory] // Timing

Out[21]= {0.021987,-0.138718+1.20194 I}

but LevinIntegrate gives up:

In[23]:= LevinIntegrate[If[x < 5, Sqrt[x], Exp[I*Cosh[x]]], {x, 0,
10}] // Timing

During evaluation of In[23]:= LevinIntegrate::unknownoscillator: \
LevinIntegrate only operates on integrands containing oscillatory \
factors matching E^_|BesselJ[_Integer,_]|Sin[_]|Cos[_]. If your \
integrand can still be integrated using a Levin-type method, use \
GeneralisedLevinIntegrate.

Out[23]= {0.001462,Null}

Plug-in code:

Needs["Moylan`LevinIntegrate`"]
Clear[LevinOscillatory]
LevinOscillatory /:
NIntegrate`InitializeIntegrationStrategy[LevinOscillatory, nfs_,
ranges_, strOpts_, allOpts_] :=
Block[{},
LevinOscillatory[{First /@ ranges, strOpts}]
];
LevinOscillatory[{vars_, strOpts_}]["Algorithm"[regions_, opts___]] :=
Module[{integrands, ranges, res},
integrands = (#@"Integrand")@"FunctionExpression" & /@ regions;
ranges =
First@Outer[Prepend[#1, #2] &, #@"Boundaries", vars, 1] & /@
regions;
LevinIntegrate[#1, Sequence @@ #2,
Sequence @@ strOpts] &, {integrands, ranges}];
If[FreeQ[res, Null],
Total@res,
Total@
If[NumberQ[#1], #1,
NIntegrate[#2, Sequence @@ #3 // Evaluate,
DeleteCases[opts, Method -> _] // Evaluate]] &, {res,
integrands, ranges}]
]
];

Anton Antonov,
Wolfram Research, Inc.

On Oct 10, 3:51 am, "Andrew Moylan" <andrew.j.moy... at gmail.com> wrote:
> Hi all,
>
> My LevinIntegrate package, for numerical integration of highly oscillatory
> functions, is now available athttp://andrew.j.moylan.googlepages.com/levinintegrate.
>
> LevinIntegrate is an automatic integrator based on Levin's method for highly
> oscillatory integration. It outperformsNIntegrate(and other automatic
> integrators) for a variety of irregularly oscillatory functions:
>
> LevinIntegrate[Exp[I*Cosh[x]], {x, 0, 10}] // Timing
>
> >> {0.02, -0.138718 + 1.20194 * I}
>
> Compare with:
>
> NIntegrate[Exp[I*Cosh[x]], {x, 0, 10}, MaxRecursion -> 50] // Timing
>
> >> (warnings)
> >> {4.546, -0.138718 + 1.20194 * I}
>
>
> This is an early release of LevinIntegrate; it is still under development.
> If you have any comments, suggestions, or problems, please do let me know of
> them!
>
> Andrew Moylan

```

• Prev by Date: Re: Converting notebooks to use Mathematica Player
• Next by Date: Re: Computation does not stop when solving system quadratic eqn
• Previous by thread: New LevinIntegrate package for highly oscillatory integration
• Next by thread: Re: New LevinIntegrate package for highly oscillatory integration