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

typedef std::function< T(const T &x, const VectorX< T > &k)> IntegrableFunction
 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...
 
Evaluate (const T &u, const SpecifiedValues &values={}) const
 Evaluates the definite integral over 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 not given. 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.

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
TThe ℝ domain scalar type, which must be a valid Eigen scalar.
Note
Instantiated templates for the following scalar types T are provided:
  • double

Member Typedef Documentation

typedef std::function<T(const T& x, const VectorX<T>& k)> IntegrableFunction

Scalar integrable function f(x; 𝐀) type.

Parameters
xThe variable of integration x ∈ ℝ .
kThe parameter vector 𝐀 ∈ ℝᡐ.
Returns
The function value f(x; k).

Constructor & Destructor Documentation

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_functionThe function f(x; 𝐀) to be integrated.
default_valuesThe values specified by default for this function, i.e. default lower integration bound v ∈ ℝ and default parameter vector 𝐀 ∈ ℝᡐ.

Member Function Documentation

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

Evaluates the definite integral over 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 not given.

Parameters
uThe upper integration bound.
valuesThe 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_errorif preconditions are not met.
const IntegratorBase<T>* get_integrator ( ) const
inline

Gets a pointer to the internal integrator instance.

IntegratorBase<T>* get_mutable_integrator ( )
inline

Gets a pointer to the internal mutable integrator instance.

AntiderivativeFunction& operator= ( const AntiderivativeFunction< T > &  )
delete
AntiderivativeFunction& operator= ( AntiderivativeFunction< T > &&  )
delete
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
argsThe integrator type-specific arguments.
Returns
The new integrator instance.
Template Parameters
IntegratorThe integrator type, which must be an IntegratorBase subclass.
ArgsThe 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: