The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Math::Polynomial::Chebyshev - Chebyshev polynomials of the first kind

SYNOPSIS

    use Math::Polynomial::Chebyshev;

    # create a Chebyshev polynomial of the first kind of order 7
    my $p = Math::Polynomial::Chebyshev -> chebyshev(7);

    # get the location of all extremas
    my $x = $p -> extremas();

    # get the location of all roots
    $x = $p -> roots();

    # use higher accuracy
    use Math::BigFloat;
    Math::BigFloat -> accuracy(60);
    my $n = Math::BigFloat -> new(7);
    $x = Math::Polynomial::Chebyshev -> chebyshev($n);

DESCRIPTION

This package extends Math::Polynomial, so each instance polynomial created by this modules is a subclass of Math::Polynomial.

The Chebyshev polynomials of the first kind are orthogonal with respect to the weight function 1/sqrt(1-x^2).

The first Chebyshev polynomials of the first kind are

    T₀(x) = 1
    T₁(x) = x
    T₂(x) = 2 x^2 - 1
    T₃(x) = 4 x^3 - 3 x
    T₄(x) = 8 x^4 - 8 x^2 + 1
    T₅(x) = 16 x^5 - 20 x^3 + 5 x
    T₆(x) = 32 x^6 - 48 x^4 + 18 x^2 - 1
    T₇(x) = 64 x^7 - 112 x^5 + 56 x^3 - 7 x
    T₈(x) = 128 x^8 - 256 x^6 + 160 x^4 - 32 x^2 + 1
    T₉(x) = 256 x^9 - 576 x^7 + 432 x^5 - 120 x^3 + 9 x

CLASS METHODS

Constructors

chebyshev($n)

Math::Polynomial::Chebyshev->chebyshev($n) creates a new polynomial of order $n, where $n is a non-negative integer.

    # create a Chebyshev polynomial of the first kind of order 7
    $p = Math::Polynomial::Chebyshev -> chebyshev(7);

    # do the same, but with Math::BigFloat coefficients
    use Math::BigFloat;
    $n = Math::BigFloat -> new(7);
    $p = Math::Polynomial::Chebyshev -> chebyshev($n);

    # do the same, but with Math::Complex coefficients
    use Math::Complex;
    $n = Math::Complex -> new(7);
    $p = Math::Polynomial::Chebyshev -> chebyshev($n);
roots()

$p->roots return the location of all root of $p. All roots are located in the open interval (-1,1).

    # get the roots of a polynomial
    @x = $p -> roots();
extremas()

$p->extremas returns the location of all extremas of $p located in the closed interval [-1,1]. There are no extremas outside of this interval. Only the extremas in the closed interval (-1,1) are local extremas. All extremas have values +/-1.

    # get the extremas of a polynomial
    @x = $p -> extremas();

BUGS

Please report any bugs through the web interface at https://rt.cpan.org/Ticket/Create.html?Queue=Math-Polynomial-Chebyshev (requires login). We will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Math::Polynomial::Chebyshev

You can also look for information at:

SEE ALSO

LICENSE AND COPYRIGHT

Copyright (c) 2020 Peter John Acklam.

This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

Peter John Acklam <pjacklam (at) gmail.com>.