un

constexpr Complex un(int n, const Complex &z) noexcept

Evaluates the nth Chebyshev polynomial of the second kind [1] for a complex input.

Parameters

const Complex &z

A complex number.

const int n

A nonnegative integer.

Returns

type Complex

A complex number.

Chebyshev polynomials of the second kind can be defined as follows:

\[U_n(z) = \frac{\sin((n + 1)\cos^{-1}(z))}{\sin(\cos^{-1}(z))}\]

Example

Complex z = 1.0 + 1_j;
int n = 1;
std::cout << un(n, z) << "\n";

Output:

2 + 2j

References