FilonQuadrature

class FilonQuadrature(*args)

Tensorized integration algorithm of Gauss-Legendre.

Parameters
nint, n>0

The discretization used by the algorithm. The integration algorithm will be regularly discretized by 2n+1 points.

omegafloat

The default pulsation in the oscillating kernel. Default value is 1.0.

kindint, kind\geq 0

The type of oscillating kernel defining the integral, see notes. Default value is 0.

Notes

The Filon algorithm enables to approximate the definite integral:

\int_a^b f(t)w(\omega t)\di{t}

with f: \Rset \mapsto \Rset^p, a, b\in\Rset, \omega\in\Rset and:

w(\omega t)=\left\{
\begin{array}{ll}
  \cos(\omega t) & \mathrm{if}\: kind=0 \\
  \sin(\omega t) & \mathrm{if}\: kind=1 \\
  \exp(i \omega t) & \mathrm{if}\: kind\geq 2
\end{array}
\right.

This algorithm is based on a regular partition of the interval [a,b], the function f being approximated by a quadratic function on three consecutive points. This algorithm provides an approximation of order \cO(1/\omega^2) when \omega\rightarrow\infty. When w(\omega t)=\exp(i \omega t), the result is returned as a Point of dimension 2, the first component being the real part of the result and the second component the imaginary part.

Examples

Create a Filon algorithm:

>>> import openturns as ot
>>> algo = ot.FilonQuadrature(100)
>>> algo = ot.FilonQuadrature(100, 10.0)

Methods

getClassName(self)

Accessor to the object’s name.

getId(self)

Accessor to the object’s id.

getKind(self)

Accessor to the kind of oscillating weight defining the integral.

getN(self)

Accessor to the discretization of the algorithm.

getName(self)

Accessor to the object’s name.

getOmega(self)

Accessor to the default pulsation.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

integrate(self, \*args)

Evaluation of the integral of f w on an interval.

setKind(self, kind)

Accessor to the kind of oscillating weight defining the integral.

setN(self, n)

Accessor to the discretization of the algorithm.

setName(self, name)

Accessor to the object’s name.

setOmega(self, omega)

Accessor to the default pulsation.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getKind(self)

Accessor to the kind of oscillating weight defining the integral.

Returns
kindint

The oscillating weight function defining the integral, see the notes.

getN(self)

Accessor to the discretization of the algorithm.

Returns
ninteger

The discretization used by the algorithm.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOmega(self)

Accessor to the default pulsation.

Returns
omegafloat

The pulsation used in the integrate method if not explicitely given.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

integrate(self, \*args)

Evaluation of the integral of f w on an interval.

Available usages:

integrate(f, interval)

integrate(f, interval, omega)

Parameters
fFunction, f: \Rset \mapsto \Rset^p

The integrand function.

omegafloat

The pulsation in the weight function. This value superseeds the value given in the constructor.

intervalInterval, interval \in \Rset

The integration domain.

Returns
valuePoint

Approximation of the integral. Its dimension is p if kind\in\{0,1\}, otherwise it is 2p with the p first components corresponding to the real part of the integral and the remaining ones to the imaginary part.

Examples

>>> import openturns as ot
>>> import math
>>> f = ot.SymbolicFunction(['t'], ['log(1+t)'])
>>> a = 0.5
>>> b = a + 8.0 * math.pi
>>> n = 100
>>> omega = 1000.0
>>> kind = 0
>>> algoF = ot.FilonQuadrature(n, omega, kind)
>>> value = algoF.integrate(f, ot.Interval(a, b))
>>> print(value[0])
-0.00134...
>>> kind = 1
>>> algoF = ot.FilonQuadrature(n, omega, kind)
>>> value = algoF.integrate(f, ot.Interval(a, b))
>>> print(value[0])
0.00254...
>>> kind = 2
>>> algoF = ot.FilonQuadrature(n, omega, kind)
>>> value = algoF.integrate(f, ot.Interval(a, b))
>>> print(value[0])
-0.00134...
>>> print(value[1])
0.00254...
setKind(self, kind)

Accessor to the kind of oscillating weight defining the integral.

Parameters
kindint

The oscillating weight function defining the integral, see the notes.

setN(self, n)

Accessor to the discretization of the algorithm.

Parameters
ninteger, n>0

The discretization used by the algorithm.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setOmega(self, omega)

Accessor to the default pulsation.

Parameters
omegafloat

The pulsation used in the integrate method if not explicitely given.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.