Chebyshev Polynomials
The Chebyshev polynomials are two sequences of polynomials, and . The Chebyshev polynomials of the first kind, , can be defined by the recurrence relation:
The Chebyshev polynomioals of the second kind, , can be defined by
Both and have degree , and any polynomial of degree may be uniquely written as a linear combination of the polynomials , , …, (similarly with ).
First Kind
#
Polynomials.ChebyshevT
— Type
ChebyshevT{T, X}(coeffs::AbstractVector)
Chebyshev polynomial of the first kind.
Construct a polynomial from its coefficients coeffs
, lowest order first, optionally in terms of the given variable var
, which can be a character, symbol, or string.
|
Examples
julia> using Polynomials
julia> p = ChebyshevT([1, 0, 3, 4])
ChebyshevT(1⋅T_0(x) + 3⋅T_2(x) + 4⋅T_3(x))
julia> ChebyshevT([1, 2, 3, 0], :s)
ChebyshevT(1⋅T_0(s) + 2⋅T_1(s) + 3⋅T_2(s))
julia> one(ChebyshevT)
ChebyshevT(1.0⋅T_0(x))
julia> p(0.5)
-4.5
julia> Polynomials.evalpoly(5.0, p, false) # bypasses the domain check done in p(5.0)
2088.0
The latter shows how to evaluate a ChebyshevT
polynomial outside of its domain, which is [-1,1]
. (For newer versions of Julia
, evalpoly
is an exported function from Base with methods extended in this package, so the module qualification is unnecessary.
The Chebyshev polynomials are also implemented in |
The ChebyshevT
type holds coefficients representing the polynomial .
For example, the basis polynomial can be represented with ChebyshevT([0,0,0,0,1])
.
Conversion
ChebyshevT
can be converted to Polynomial
and vice-versa.
julia> c = ChebyshevT([1, 0, 3, 4])
ChebyshevT(1⋅T_0(x) + 3⋅T_2(x) + 4⋅T_3(x))
julia> p = convert(Polynomial, c)
Polynomial(-2.0 - 12.0*x + 6.0*x^2 + 16.0*x^3)
julia> convert(ChebyshevT, p)
ChebyshevT(1.0⋅T_0(x) + 3.0⋅T_2(x) + 4.0⋅T_3(x))