TERMIAL function
Description
Termial function. TERMIAL(n) returns the termial of n, or the nth triangular number $T_n$. For a given non-negative integer n, the termial of n, denoted n?, is defined as the sum of all positive integers up to n: 1+2+3+...+n.
$$\displaystyle
\begin{align} T_n &= \sum_{k=1}^n k = 1+2+ \dotsb +n \\
&= \frac{n^2+n \vphantom{(n+1)}}{2} = \frac{n(n+1)}{2} \\
&= {n+1 \choose 2}
\end{align} $$
If the argument n is not an integer, it is truncated.
The argument n cannot be negative.
The argument n can be a real number or a matrix. When it is a matrix, the function returns a matrix with the same dimensions and with the TERMIAL function applied to all elements.
The function's name "Termial" was given by Donald Knuth (1997) in analogy with the "Factorial" function.
Example
TERMIAL(5) equals 15 (=1+2+3+4+5)
Calculator
Graph
References
- Donald E. Knuth (1997). The Art of Computer Programming: Volume 1: Fundamental Algorithms. 3rd Ed. Addison Wesley Longman, U.S.A. p. 48.