README
Math::Polynomial::Chebyshev
Raku package for functionalities based on Chebyshev polynomials.
Installation
From Zef ecosystem:
zef install Math::Polynomial::Chebyshev
From GitHub:
zef install https://github.com/antononcube/Raku-Math-Polynomial-Chebyshev.git
Usage examples
Evaluate the numerical value of the Chebyshev polynomial of first kind :
use Math::Polynomial::Chebyshev;
chebyshev-t(2, 0.3)
# -0.82
The default method is "recursive":
chebyshev-t(2, 6, method => 'recursive')
# 71
Here is an invocation of the "trigonometric" method:
chebyshev-t(2, 3, method => 'trigonometric')
# 17
Remark: Currently, the trigonometric method is implemented only for the Chebyshev polynomials of first kind. (Chebyshev-T).
Plot the 10th Chebyshev-T polynomial:
use Text::Plot;
my @x = (-1, -0.99 ... 1);
text-list-plot(@x, chebyshev-t(6, @x), width => 80)
# +---+-----------------+----------------+-----------------+----------------+----+
# | |
# + * ***** ***** * + 1.00
# | ** ** ** ** |
# | * * * * ** * |
# | ** ** * * |
# + * * * * + 0.50
# | * * ** ** ** * |
# | ** * * ** |
# | * * * ** * * |
# + ** * * ** + 0.00
# | * * ** * * * |
# | * ** * ** ** * |
# + * * * * * * + -0.50
# | * ** ** * ** * |
# | * ** * * * * |
# | * * ** ** * * |
# + *** ****** **** + -1.00
# | |
# +---+-----------------+----------------+-----------------+----------------+----+
# -1.00 -0.50 0.00 0.50 1.00
Here we make a Chebyshev-T function:
chebyshev-u(4)
# -> ;; $_? is raw = OUTER::<$_> { #`(Block|5419846387320) ... }
References
Articles
[WK1] Wolfram Koepf, "Efficient Computation of Chebyshev Polynomials in Computer Algebra". (1999), Computer Algebra Systems: A Practical Guide. 79-99.
[Wk1] Wikipedia entry, Chebyshev polynomials.
Packages
[AAp1] Anton Antonov, Text::Plot Raku package, (2022-2023), GitHub/antononcube.
[AAp2] Anton Antonov, Math::Fitting Raku package, (2024), GitHub/antononcube.
[SFp1] Solomon Foster, Math::ChebyshevPolynomial Raku package, (2013-2015), GitHub/colomon.