trigpolyroot | R Documentation |
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.
trigpolyroot( ablist, tol=.Machine$double.eps^0.5 )
ablist |
a list with 3 items
| ||||||
tol |
tolerance for the imaginary part; if the absolute value of the
imaginary part of the root is less than or equal to |
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
.
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
.
Wikipedia. Trigonometric polynomial. https://en.wikipedia.org/wiki/Trigonometric_polynomial
polyroot()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.