[Date Index]
[Thread Index]
[Author Index]
Re: New LevinIntegrate package for highly oscillatory integration
*To*: mathgroup at smc.vnet.net
*Subject*: [mg82616] Re: New LevinIntegrate package for highly oscillatory integration
*From*: Andrew Moylan <andrew.j.moylan at gmail.com>
*Date*: Fri, 26 Oct 2007 05:22:24 -0400 (EDT)
*References*: <fei3qo$qsb$1@smc.vnet.net><ffpqbg$lgt$1@smc.vnet.net>
Hi Anton.
Yeah I agree: the correct place for LevinIntegrate is as a rule or
strategy in NIntegrate. Gaining access to NIntegrate's pre-processing
(for piecewise functions, a la your example (but shouldn't Out[21] be
7.46604+0.00482644*I?)) is a good example of why that will be
valuable.
Thanks for your example demonstrating how to set up an integration
strategy that calls LevinIntegrate. It makes me think that setting up
LevinIntegrate as a rule or strategy ("LevinOscillatory"---I like it)
won't be all that tricky. Is there documentation available to help
authors of integration strategies?
Related matters:
1. Do there exist sensible rules for *automatically* selecting the
LevinOscillatory strategy during pre-processing (a la the rules that
NIntegrate pre-processing presently uses to select the existing
Oscillatory Clenshaw-Curtis rules when the frequency of the Sin/Cos/
Exp[I*] in question is large enough)?
1a. Is it difficult (for a package author) to extend NIntegrate's
pre-processing / rule selection procedure?
The answer to 1. is unclear to me. The whole problem with irregularly
oscillatory integrals is that it's no longer easy to judge "how"
oscillatory they are over a given range of the integration parameter:
Exp[I*g[x]] <-- hard to decide whether this is sufficiently
oscillatory to warrant applying LevinIntegrate rather than just
GaussKronrod, especially since g may be g[x_?NumericQ]:=bla.
Andrew
On Oct 25, 8:15 pm, antononcube <antononc... at gmail.com> wrote:
> 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;
> res = MapThread[
> LevinIntegrate[#1, Sequence @@ #2,
> Sequence @@ strOpts] &, {integrands, ranges}];
> If[FreeQ[res, Null],
> Total@res,
> Total@
> MapThread[
> 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}
>
> > For more information or to download the package, seehttp://andrew.j.moylan.googlepages.com/levinintegrate.
>
> > 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: Gradient of a List**
Previous by thread:
**Re: New LevinIntegrate package for highly oscillatory integration**
Next by thread:
**Re: New LevinIntegrate package for highly oscillatory integration**
| |