Simbody
3.5
|
This abstract class represents a mathematical function that calculates a value of arbitrary type based on M real arguments. More...
Classes | |
class | Constant |
This is a Function_ subclass which simply returns a fixed value, independent of its arguments. More... | |
class | Linear |
This is a Function_ subclass whose output value is a linear function of its arguments: f(x, y, ...) = ax+by+...+c. More... | |
class | Polynomial |
This is a Function_ subclass whose output value is a polynomial of its argument: f(x) = ax^n+bx^(n-1)+...+c. More... | |
class | Sinusoid |
This is a Function_ subclass whose output value is a sinusoid of its argument: f(x) = a*sin(w*x + p) where a is amplitude, w is frequency in radians per unit of x, p is phase in radians. More... | |
class | Step |
This is a Function_ subclass whose output value y=f(x) is smoothly stepped from y=y0 to y1 as its input argument goes from x=x0 to x1. More... | |
Public Member Functions | |
virtual | ~Function_ () |
virtual T | calcValue (const Vector &x) const =0 |
Calculate the value of this function at a particular point. More... | |
virtual T | calcDerivative (const Array_< int > &derivComponents, const Vector &x) const =0 |
Calculate a partial derivative of this function at a particular point. More... | |
T | calcDerivative (const std::vector< int > &derivComponents, const Vector &x) const |
This provides compatibility with std::vector without requiring any copying. More... | |
virtual int | getArgumentSize () const =0 |
Get the number of components expected in the input vector. More... | |
virtual int | getMaxDerivativeOrder () const =0 |
Get the maximum derivative order this Function_ object can calculate. More... | |
This abstract class represents a mathematical function that calculates a value of arbitrary type based on M real arguments.
The output type is set as a template argument, while the number of input components may be determined at runtime. The name "Function" (with no trailing _) may be used as a synonym for Function_<Real>.
Subclasses define particular mathematical functions. Predefined subclasses are provided for several common function types: Function_<T>::Constant, Function_<T>::Linear, Function_<T>::Polynomial, and Function_<T>::Step. You can define your own subclasses for other function types. The Spline_ class also provides a convenient way to create various types of Functions.
|
inlinevirtual |
|
pure virtual |
Calculate the value of this function at a particular point.
x | the Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Implemented in SimTK::BicubicFunction, SimTK::Function_< T >::Step, SimTK::Function_< T >::Sinusoid, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Linear, SimTK::Spline_< T >, and SimTK::Function_< T >::Constant.
|
pure virtual |
Calculate a partial derivative of this function at a particular point.
Which derivative to take is specified by listing the input components with which to take it. For example, if derivComponents=={0}, that indicates a first derivative with respective to component 0. If derivComponents=={0, 0, 0}, that indicates a third derivative with respective to component 0. If derivComponents=={4, 7}, that indicates a partial second derivative with respect to components 4 and 7.
derivComponents | The input components with respect to which the derivative should be taken. Its size must be less than or equal to the value returned by getMaxDerivativeOrder(). |
x | The Vector of input arguments. Its size must equal the value returned by getArgumentSize(). |
Implemented in SimTK::BicubicFunction, SimTK::Function_< T >::Step, SimTK::Function_< T >::Sinusoid, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Linear, SimTK::Spline_< T >, and SimTK::Function_< T >::Constant.
|
inline |
This provides compatibility with std::vector without requiring any copying.
|
pure virtual |
Get the number of components expected in the input vector.
Implemented in SimTK::BicubicFunction, SimTK::Function_< T >::Step, SimTK::Function_< T >::Sinusoid, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Linear, SimTK::Spline_< T >, and SimTK::Function_< T >::Constant.
|
pure virtual |
Get the maximum derivative order this Function_ object can calculate.
Implemented in SimTK::BicubicFunction, SimTK::Function_< T >::Step, SimTK::Function_< T >::Sinusoid, SimTK::Function_< T >::Polynomial, SimTK::Function_< T >::Linear, SimTK::Spline_< T >, and SimTK::Function_< T >::Constant.