kyosu v0.1.0
Complex Without Complexes
Loading...
Searching...
No Matches

◆ tchebytchev

auto kyosu::tchebytchev = eve::functor<tchebytchev_t>
inlineconstexpr

Computes the value of the Tchebytchev polynomial of order n at x:

  • The Tchebytchev polynomial of order n is given by \( \displaystyle \mbox{T}_{n}(x) = \cos(n\arccos(x))\)

Header file

#include <kyosu/functions.hpp>

Callable Signatures

namespace eve
{
// Regular overload
auto constexpr tchebytchev(kyosu::concepts::real auto n, kyosu::concepts::cayley_dickson auto z) noexcept; // 1
auto constexpr tchebytchev(kyosu::concepts::real auto n, kyosu::concepts::real auto z) noexcept; // 1
// Lanes masking
constexpr auto tchebytchev[conditional_expr auto c](/* any previous overload */) noexcept; // 2
constexpr auto tchebytchev[logical_value auto m](/* any previous overload */) noexcept; // 2
// Semantic options
constexpr auto tchebytchev[kind_1](/* any previous overload */) noexcept; // 1
constexpr auto tchebytchev[kind_2](i/* any previous overload */) noexcept; // 3
constexpr auto tchebytchev[successor]( kyosu::concepts::cayley_dickson auto z,
kyosu::cayley_dickson auto tnm1) noexcept; // 4
}
General Cayley-dickson concept.
Definition concepts.hpp:41
General real concept.
Definition concepts.hpp:48
constexpr auto i
Computes the complex number in the chosen type.
Definition i.hpp:68
constexpr auto tchebytchev
Computes the value of the Tchebytchev polynomial of order n at x:
Definition tchebytchev.hpp:128
Cayley-Dickson algebra main abstraction It is built so that all operation over C, Q and other such al...
Definition cayley_dickson.hpp:32

Parameters

  • n : integral positive arguments. (note that negative values return a NaN)
  • x : real floating argument.

Return value

1.The value of the polynomial at z is returned.

  1. The operation is performed conditionnaly.
  2. evaluates the nth polynomial of tchebytchev of second kind \( \displaystyle U_n(z) = \frac{\sin(n\arccos z)}{\sin(\arccos z)}\).
  3. computes the value of \(T_{n+1}(z)\) knowing the values tn = \(T_n(z)\) and tnm1 = \(T_{n-1}(z)\), This call can be used to create a sequence of values evaluated at the same z and for rising n.

External references

Example

// revision 1
#include <eve/wide.hpp>
#include <iostream>
#include <kyosu/kyosu.hpp>
int main()
{
eve::wide xd{0.5, -1.5, 0.1, -1.0, 19.0, 25.0, 21.5, 10000.0};
eve::wide n{0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0};
double x(0.5);
std::cout << "<- xd = " << xd << '\n';
std::cout << "<- n = " << n << '\n';
std::cout << "<- x = " << x << '\n';
std::cout << "-> tchebytchev(n, xd) = " << kyosu::tchebytchev(n, xd) << '\n';
std::cout << "-> tchebytchev[eve::ignore_last(2)](n, xd) = " << kyosu::tchebytchev[eve::ignore_last(2)](n, xd)
<< '\n';
std::cout << "-> tchebytchev[n > 3](n, xd) = " << kyosu::tchebytchev[n > 3](n, xd) << '\n';
std::cout << "-> tchebytchev(3.0, xd) = " << kyosu::tchebytchev(3.0, xd) << '\n';
std::cout << "-> tchebytchev(n, 2.0) = " << kyosu::tchebytchev(n, 2.0) << '\n';
std::cout << "-> tchebytchev(n, x) = " << kyosu::tchebytchev(n, x) << '\n';
std::cout << "-> tchebytchev[kind_2](n, xd) = " << kyosu::tchebytchev[eve::kind_2](n, xd) << "\n\n";
}