> For the complete documentation index, see [llms.txt](https://niina-toru.gitbook.io/kasok/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://niina-toru.gitbook.io/kasok/aitken_delta_squared.md).

# Aitken's Delta Squared

An implementation of [Aitken's delta-squared process](https://en.wikipedia.org/wiki/Aitken's_delta-squared_process).

It provides the following functions.

```cpp
template<typename Function, typename Tolerance, typename UInt>
/* the same type as Function returns */
aitken(Function&& f, Tolerance&& tolerance, UInt& iteration);

template<typename FirstIterator, typename LastIterator, typename Tolerance>
/* the same type as Function returns */
aitken(FirstIterator& first, LastIterator last, Tolerance&& tolerance);

template<typename Function, typename Tolerance, typename UInt>
/* the same type as Function returns */
aitken_sum(Function&& f, Tolerance&& tolerance, UInt& iteration);

template<typename FirstIterator, typename LastIterator, typename Tolerance>
/* the same type as Function returns */
aitken_sum(FirstIterator& first, LastIterator last, Tolerance&& tolerance);
```

## calculating limit of a sequence

The following functions calculates the limit of a given sequence.

```cpp
template<typename Function, typename Tolerance, typename UInt>
/* the same type as Function returns */
aitken(Function&& f, Tolerance&& tolerance, UInt& iteration);

template<typename FirstIterator, typename LastIterator, typename Tolerance>
/* the same type as Function returns */
aitken(FirstIterator& first, LastIterator last, Tolerance&& tolerance);
```

## calculating limit of sum of a sequence

The following functions automatically calculates the sum of a given sequence. The usage is the same as the functions that calculates a limit.

```cpp
template<typename Function, typename Tolerance, typename UInt>
/* the same type as Function returns */
aitken_sum(Function&& f, Tolerance&& tolerance, UInt& iteration);

template<typename FirstIterator, typename LastIterator, typename Tolerance>
/* the same type as Function returns */
aitken_sum(FirstIterator& first, LastIterator last, Tolerance&& tolerance);
```
