KASKADE 7 development version
|
#include <cmath>
#include <numeric>
#include <iterator>
#include <utility>
#include "utilities/power.hh"
Go to the source code of this file.
Functions | |
template<class Iterator > | |
std::pair< typename std::iterator_traits< Iterator >::value_type, typename std::iterator_traits< Iterator >::value_type > | estimateGeometricSequence (Iterator first, Iterator last) |
Estimates parameters of geometric sequence. More... | |
template<class Iterator > | |
std::iterator_traits< Iterator >::value_type | estimateGeometricTruncationError (Iterator first, Iterator last, int k) |
Estimates errors of truncating geometrically convergent sequences. More... | |
std::pair< typename std::iterator_traits< Iterator >::value_type, typename std::iterator_traits< Iterator >::value_type > estimateGeometricSequence | ( | Iterator | first, |
Iterator | last | ||
) |
Estimates parameters of geometric sequence.
Given a (finite) sequence a_i, i=0,\dots , n-1 , this function estimates the parameters c,q of a geometric sequence c q^i, such that the least squares error \sum_{i=0}^{n-1} (ln(cq^i) - \ln a_i)^2 is minimal. n has to be at least 2. The values a_i have to be positive.
Iterator | an input iterator type with a scalar floating point value type |
Definition at line 34 of file geometric_sequence.hh.
Referenced by estimateGeometricTruncationError().
std::iterator_traits< Iterator >::value_type estimateGeometricTruncationError | ( | Iterator | first, |
Iterator | last, | ||
int | k | ||
) |
Estimates errors of truncating geometrically convergent sequences.
Assume there is a geometrically convergent series (x_i)_{i\in N} with data available for i=0,\dots , n . The differences satisfy a_i = x_{i+1} - x_i \approx c q^i . Then we estimate the truncation error x_k - x_\infty \approx \sum_{i=k}^{n-1} a_i + \frac{cq^n}{1-q}. This value is computed here, given the n difference values a_i .
Iterator | an input iterator with scalar floating point value type. |
k | defines for which iterate x_k the error is estimated. 0\le k \le n . |
Definition at line 75 of file geometric_sequence.hh.