Drake
AntiderivativeFunction< T > Class Template Reference

A thin wrapper of the ScalarInitialValueProblem class that, in concert with Drake's ODE initial value problem solvers ("integrators"), provide the ability to perform quadrature on an arbitrary scalar integrable function. More...

#include <drake/systems/analysis/antiderivative_function.h>

## Classes

struct  SpecifiedValues
The set of values that, along with the function being integrated, partially specify the definite integral i.e. More...

## Public Types

using IntegrableFunction = std::function< T(const T &x, const VectorX< T > &k)>
Scalar integrable function f(x; π€) type. More...

## Public Member Functions

AntiderivativeFunction (const IntegrableFunction &integrable_function, const SpecifiedValues &default_values={})
Constructs the antiderivative function of the given integrable_function, using default_values.v as lower integration bound if given (0 if not) and parameterized with default_values.k if given (an empty vector if not) by default. More...

T Evaluate (const T &u, const SpecifiedValues &values={}) const
Evaluates the definite integral F(u; π€) = β«α΅₯α΅ f(x; π€) dx from the lower integration bound v (see definition in class documentation) to u using the parameter vector π€ (see definition in class documentation) if present in values, falling back to the ones given on construction if missing. More...

std::unique_ptr< ScalarDenseOutput< T > > MakeDenseEvalFunction (const T &w, const SpecifiedValues &values={}) const
Evaluates and yields an approximation of the definite integral F(u; π€) = β«α΅₯α΅ f(x; π€) dx for v β€ u β€ w, i.e. More...

template<typename Integrator , typename... Args>
Integratorreset_integrator (Args &&... args)
Resets the internal integrator instance. More...

const IntegratorBase< T > * get_integrator () const
Gets a pointer to the internal integrator instance. More...

IntegratorBase< T > * get_mutable_integrator ()
Gets a pointer to the internal mutable integrator instance. More...

Does not allow copy, move, or assignment
AntiderivativeFunction (const AntiderivativeFunction &)=delete

AntiderivativeFunctionoperator= (const AntiderivativeFunction &)=delete

AntiderivativeFunction (AntiderivativeFunction &&)=delete

AntiderivativeFunctionoperator= (AntiderivativeFunction &&)=delete

## Detailed Description

### template<typename T> class drake::systems::AntiderivativeFunction< T >

A thin wrapper of the ScalarInitialValueProblem class that, in concert with Drake's ODE initial value problem solvers ("integrators"), provide the ability to perform quadrature on an arbitrary scalar integrable function.

That is, it allows the evaluation of an antiderivative function F(u; π€), such that F(u; π€) = β«α΅₯α΅ f(x; π€) dx where f : β β β , u β β, v β β, π€ β βα΅. The parameter vector π€ allows for generic function definitions, which can later be evaluated for any instance of said vector. Also, note that π€ can be understood as an m-tuple or as an element of βα΅, the vector space, depending on how it is used by the integrable function.

See ScalarInitialValueProblem class documentation for information on caching support and dense output usage for improved efficiency in antiderivative function F evaluation.

For further insight into its use, consider the following examples.

• Solving the elliptic integral of the first kind E(Ο; ΞΎ) = β«α΅  β(1 - ΞΎΒ² sinΒ² ΞΈ)β»ΒΉ dΞΈ becomes straightforward by defining f(x; π€) β β(1 - kβΒ² sinΒ² x)β»ΒΉ with π€ β [ΞΎ] and evaluating F(u; π€) at u = Ο.
• As the bearings in a rotating machine age over time, these are more likely to fail. Let Ξ³ be a random variable describing the time to first bearing failure, described by a family of probability density functions gα΅§(y; l) parameterized by bearing load l. In this context, the probability of a bearing under load to fail during the first N months becomes P(0 < Ξ³ β€ N mo.; l) = Gα΅§(N mo.; l) - Gα΅§(0; l), where Gα΅§(y; l) is the family of cumulative density functions, parameterized by bearing load l, and G'α΅§(y; l) = gα΅§(y; l). Therefore, defining f(x; π€) β gα΅§(x; kβ) with π€ β [l] and evaluating F(u; π€) at u = N yields the result.
Template Parameters
 T The β domain scalar type, which must be a valid Eigen scalar.
Note
Instantiated templates for the following scalar types T are provided:
• double

## ◆ IntegrableFunction

 using IntegrableFunction = std::function& k)>

Scalar integrable function f(x; π€) type.

Parameters
 x The variable of integration x β β . k The parameter vector π€ β βα΅.
Returns
The function value f(x; k).

## ◆ AntiderivativeFunction() [1/3]

 AntiderivativeFunction ( const AntiderivativeFunction< T > & )
delete

## ◆ AntiderivativeFunction() [2/3]

 AntiderivativeFunction ( AntiderivativeFunction< T > && )
delete

## ◆ AntiderivativeFunction() [3/3]

 AntiderivativeFunction ( const IntegrableFunction & integrable_function, const SpecifiedValues & default_values = {} )
inline

Constructs the antiderivative function of the given integrable_function, using default_values.v as lower integration bound if given (0 if not) and parameterized with default_values.k if given (an empty vector if not) by default.

Parameters
 integrable_function The function f(x; π€) to be integrated. default_values The values specified by default for this function, i.e. default lower integration bound v β β and default parameter vector π€ β βα΅.

## ◆ Evaluate()

 T Evaluate ( const T & u, const SpecifiedValues & values = {} ) const
inline

Evaluates the definite integral F(u; π€) = β«α΅₯α΅ f(x; π€) dx from the lower integration bound v (see definition in class documentation) to u using the parameter vector π€ (see definition in class documentation) if present in values, falling back to the ones given on construction if missing.

Parameters
 u The upper integration bound. values The specified values for the integration.
Returns
The value of the definite integral.
Precondition
The given upper integration bound u must be larger than or equal to the lower integration bound v.
If given, the dimension of the parameter vector values.k must match that of the parameter vector π€ in the default specified values given on construction.
Exceptions
 std::logic_error if any of the preconditions is not met.

## ◆ get_integrator()

 const IntegratorBase* get_integrator ( ) const
inline

Gets a pointer to the internal integrator instance.

## ◆ get_mutable_integrator()

 IntegratorBase* get_mutable_integrator ( )
inline

Gets a pointer to the internal mutable integrator instance.

## ◆ MakeDenseEvalFunction()

 std::unique_ptr > MakeDenseEvalFunction ( const T & w, const SpecifiedValues & values = {} ) const
inline

Evaluates and yields an approximation of the definite integral F(u; π€) = β«α΅₯α΅ f(x; π€) dx for v β€ u β€ w, i.e.

the closed interval that goes from the lower integration bound v (see definition in class documentation) to the uppermost integration bound w, using the parameter vector π€ (see definition in class documentation) if present in values, falling back to the ones given on construction if missing.

To this end, the wrapped IntegratorBase instance solves the integral from v to w (i.e. advances the state x of its differential form x'(t) = f(x; π€) from v to w), creating a scalar dense output over that [v, w] interval along the way.

Parameters
 w The uppermost integration bound. Usually, v < w as an empty dense output would result if v = w. values The specified values for the integration.
Returns
A dense approximation to F(u; π€) (that is, a function), defined for v β€ u β€ w.
Note
The larger the given w value is, the larger the approximated interval will be. See documentation of the specific dense output technique in use for reference on performance impact as this interval grows.
Precondition
The given uppermost integration bound w must be larger than or equal to the lower integration bound v.
If given, the dimension of the parameter vector values.k must match that of the parameter vector π€ in the default specified values given on construction.
Exceptions
 std::logic_error if any of the preconditions is not met.

## ◆ operator=() [1/2]

 AntiderivativeFunction& operator= ( AntiderivativeFunction< T > && )
delete

## ◆ operator=() [2/2]

 AntiderivativeFunction& operator= ( const AntiderivativeFunction< T > & )
delete

## ◆ reset_integrator()

 Integrator* reset_integrator ( Args &&... args )
inline

Resets the internal integrator instance.

A usage example is shown below.

antiderivative_f.reset_integrator<RungeKutta2Integrator<T>>(max_step);
Parameters
 args The integrator type-specific arguments.
Returns
The new integrator instance.
Template Parameters
 Integrator The integrator type, which must be an IntegratorBase subclass. Args The integrator specific argument types.
Warning
This operation invalidates pointers returned by AntiderivativeFunction::get_integrator() and AntiderivativeFunction::get_mutable_integrator().

The documentation for this class was generated from the following file: