Learn R Programming

polarzonoid (version 0.3-0)

trigpolyroot: compute roots of a trigonometric polynomial

Description

Given a trigonometric polynomial of degree \(n\), defined on the real interval \([0,2\pi]\). The function transforms it to a polynomial of degree \(2n\) in the standard way, and then solves that polynomial. Only the real roots of the original trigonometric polynomial are returned.

Usage

trigpolyroot( ablist, tol=.Machine$double.eps^0.5 )

Value

trigpolyroot() returns the real roots in the interval \([0,2\pi)\) and in increasing order (as a numeric vector). There may be duplicates, which correspond to multiple roots. It is up to the user to handle multiple roots.

The number of roots returned is always even, and in the set \(\{ 0,2,4,..,2n \}\).

If \(n\) is 0, or all the coefficients are 0, it is an error. In case of error, the function returns NULL.

Arguments

ablist

a list with 3 items

a0the constant term of the trigonometric polynomial
areal coefficients of \(cos(jt), ~ j = 1..n \)
breal coefficients of \(sin(jt), ~ j = 1..n \)

tol

tolerance for the imaginary part; if the absolute value of the imaginary part of the root is less than or equal to tol, then the root is considered to be real, and is returned

Details

The given trigonometric polynomial is converted, using a change of variable and Euler's formula, to a standard polynomial of degree \(2n\), see Wikipedia. This polynomial is solved using base::polyroot(). After the inverse change of variable, the imaginary roots are removed using tol.

See Also