7 #ifndef BALL_MATHS_NUMERICALINTEGRATOR_H
8 #define BALL_MATHS_NUMERICALINTEGRATOR_H
10 #ifndef BALL_MATHS_FUNCTION_H
19 template <
typename Function,
typename DataType =
float>
89 DataType
integrate(
const DataType& from,
const DataType& to)
const;
102 template<
typename Function,
typename DataType>
110 template<
typename Function,
typename DataType>
113 : function_(nint.function_)
118 template<
typename Function,
typename DataType>
125 template<
typename Function,
typename DataType>
136 template<
typename Function,
typename DataType>
140 function_ =
function;
144 template<
typename Function,
typename DataType>
149 return (function_ == nint.function_);
153 template<
typename Function,
typename DataType>
161 template<
typename Function,
typename DataType>
164 const DataType& from,
const DataType& to)
const
172 DataType step = (to - from) / n;
177 area += (function_(x) + function_(x + step)) / 2.0 * step;
#define BALL_CREATE(name)
const Function & getFunction() const
DataType getValue(const DataType &x) const
virtual ~NumericalIntegrator()
Destructor.
NumericalIntegrator()
Default constructor.
DataType integrate(const DataType &from, const DataType &to) const
void setFunction(const Function &function)