/TrigPolys.jl

Trigonometric polynomial manipulation package in Julia

Primary LanguageJuliaMIT LicenseMIT

Trignometric Polynomials

Documentation Build Status
Build Status

Documentation

  • LATESTin-development version of the documentation.

Introduction

TrigPolys.jl is a package for fast manipulation of trigonometric polynomials.

A trignometric polynomial is defined on the interval [0, 2π) by

Trig poly definition

The polynomial p(x) can be represented either by 2n+1 coefficients aₖ or by evaluations at 2n+1 distinct points in the interval [0, 2π). Each representation is useful in different situations: the coefficient representation is useful for truncating or increasing the degree of a polynomial whereas the evaluation representation is useful for adding and multiplying polynomials.

This package provides the functions evaluate and interpolate to convert efficiently between these two representations. These operations are implemented via the Fast Fourier Transform (FFT) provided by the FFTW.jl library.

For example, multiplying two trigonometric polynomials is implemented with the following code:

function Base.:*(p1::TrigPoly, p2::TrigPoly)
    n = p1.n + p2.n
    interpolate(evaluate(pad_to(p1, n)) .* evaluate(pad_to(p2, n)))
end