7 #ifndef BALL_MATHS_ROMBERGINTEGRATOR_H 8 #define BALL_MATHS_ROMBERGINTEGRATOR_H 10 #ifndef BALL_MATHS_NUMERICALINTERGRATOR_H 19 template <
typename Function,
typename DataType>
70 DataType
integrate(DataType from, DataType to);
82 DataType
trapezoid(DataType
h, DataType from, DataType to);
93 template<
typename Function,
typename DataType>
100 template<
typename Function,
typename DataType>
106 template<
typename Function,
typename DataType>
112 template<
typename Function,
typename DataType>
125 template<
typename Function,
typename DataType>
132 template<
typename Function,
typename DataType>
139 template<
typename Function,
typename DataType>
147 template<
typename Function,
typename DataType>
149 bool RombergIntegrator<Function, DataType>::operator ==
156 && (
result_ == romint.result_ ));
159 template<
typename Function,
typename DataType>
164 DataType helper = (to - from);
167 Size nsteps = (
Size) (sqrt((helper*helper)/(h*
h)));
168 for (count=1; count<nsteps-1; count++)
180 template<
typename Function,
typename DataType>
183 (DataType from, DataType to)
197 for (j=1; j <= i; j++)
203 dev =
result_[((i-2)*(i-1))/2+(i-2)] -
result_[((i-1)*(i))/2+(i-1)];
206 return (
result_[((i-1)*(i))/2 + (i-1)]);
210 #endif // BALL_MATHS_ROMBERGINTEGRATOR_H const RombergIntegrator & operator=(const RombergIntegrator &romint)
Assignment operator.
vector< DataType > result_
DataType trapezoid(DataType h, DataType from, DataType to)
BALL_EXTERN_VARIABLE const double E
Euler's number - base of the natural logarithm.
bool operator==(const RombergIntegrator &romint) const
Equality operator.
~RombergIntegrator()
Destructor.
DataType integrate(DataType from, DataType to)
void setEpsilon(float eps)
Set the upper bound for the error we want to allow.
void setMaxNumSteps(Size mns)
Set the maximum number of steps we want to use in computation.
RombergIntegrator(float epsilon=1E-5, Size nsteps=1000)
Default constructor.
virtual void clear()
Clear method.
BALL_EXTERN_VARIABLE const double h
#define BALL_CREATE(name)