FilonQuadrature

class FilonQuadrature(*args)

Tensorized integration algorithm of Gauss-Legendre.

Parameters:
n : int, n>0

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

omega : float

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

kind : int, 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() Accessor to the object’s name.
getId() Accessor to the object’s id.
getKind() Accessor to the kind of oscillating weight defining the integral.
getN() Accessor to the discretization of the algorithm.
getName() Accessor to the object’s name.
getOmega() Accessor to the default pulsation.
getShadowedId() Accessor to the object’s shadowed id.
getVisibility() Accessor to the object’s visibility state.
hasName() Test if the object is named.
hasVisibleName() Test if the object has a distinguishable name.
integrate(*args) Evaluation of the integral of f w on an interval.
setKind(kind) Accessor to the kind of oscillating weight defining the integral.
setN(n) Accessor to the discretization of the algorithm.
setName(name) Accessor to the object’s name.
setOmega(omega) Accessor to the default pulsation.
setShadowedId(id) Accessor to the object’s shadowed id.
setVisibility(visible) Accessor to the object’s visibility state.
__init__(*args)

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

getClassName()

Accessor to the object’s name.

Returns:
class_name : str

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

getId()

Accessor to the object’s id.

Returns:
id : int

Internal unique identifier.

getKind()

Accessor to the kind of oscillating weight defining the integral.

Returns:
kind : int

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

getN()

Accessor to the discretization of the algorithm.

Returns:
n : integer

The discretization used by the algorithm.

getName()

Accessor to the object’s name.

Returns:
name : str

The name of the object.

getOmega()

Accessor to the default pulsation.

Returns:
omega : float

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

getShadowedId()

Accessor to the object’s shadowed id.

Returns:
id : int

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns:
visible : bool

Visibility flag.

hasName()

Test if the object is named.

Returns:
hasName : bool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns:
hasVisibleName : bool

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

integrate(*args)

Evaluation of the integral of f w on an interval.

Available usages:

integrate(f, interval)

integrate(f, interval, omega)

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

The integrand function.

omega : float

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

interval : Interval, interval \in \Rset

The integration domain.

Returns:
value : Point

Approximation of the integral. Its dimension is p if kind\in\{0,1\}, otherwise it is 2p whith 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(kind)

Accessor to the kind of oscillating weight defining the integral.

Parameters:
kind : int

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

setN(n)

Accessor to the discretization of the algorithm.

Parameters:
n : integer, n>0

The discretization used by the algorithm.

setName(name)

Accessor to the object’s name.

Parameters:
name : str

The name of the object.

setOmega(omega)

Accessor to the default pulsation.

Parameters:
omega : float

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

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters:
id : int

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters:
visible : bool

Visibility flag.