Mantid
Loading...
Searching...
No Matches
ChebyshevPolynomial.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//-----------------------------------------------------------------------------
8// Includes
9//-----------------------------------------------------------------------------
11
12#include <cassert>
13#include <cmath>
14
15using std::acos;
16using std::cos;
17
18namespace Mantid::Kernel {
19
20//-----------------------------------------------------------------------------
21// Public members
22//-----------------------------------------------------------------------------
31double ChebyshevPolynomial::operator()(const size_t n, const double x) {
32 assert(x >= -1.0 && x <= 1.0);
33 return cos(static_cast<double>(n) * acos(x));
34}
35
36} // namespace Mantid::Kernel
double operator()(const size_t n, const double x)
Return the value of the nth Chebyshev polynomial of the first kind .