next up previous contents
Next: Example Up: Number of roots of Previous: Mathematical background   Contents

Implementation

The purpose of the implementation is first to convert the trigonometric equation in sine and cosine of $\theta$:
\begin{displaymath}
F= \sum a_k\sin^m(\theta)\cos^n(\theta)
\end{displaymath} (4.2)

into a polynomial in either $\tan(\theta/2)$ or $\tan((\pi+\theta)/2)$. A first procedure return an upper bound of the degree of the resulting polynomial:
 
int Degree_Max_Convert_Trigo_Interval(int n,VECTOR &A,INTEGER_VECTOR &SSin,INTEGER_VECTOR &CCos);
int Degree_Max_Convert_Trigo_Interval(int n,INTEGER_VECTOR &A,
                        INTEGER_VECTOR &SSin,INTEGER_VECTOR &CCos);
with: Then we may use a procedure which compute the coefficients of the polynomial equation using the following procedures:
 
VOID Convert_Trigo_Interval(int n,VECTOR &A,INTEGER_VECTOR &SSin,
                        INTEGER_VECTOR &CCos,VECTOR &Coeff,int *degree);
VOID Convert_Trigo_Interval(int n,INTEGER_VECTOR &A,INTEGER_VECTOR &SSin,
                        INTEGER_VECTOR &CCos,INTEGER_VECTOR &Coeff,int *degree);
VOID Convert_Trigo_Interval(int n,INTERVAL_VECTOR &A,INTEGER_VECTOR &SSin,
                        INTEGER_VECTOR &CCos,INTERVAL_VECTOR &Coeff,int *degree);
with: The previous procedures use the substitution $T=\tan(\theta/2)$ which is not valid for $\theta =\pi$. In that case we may use instead the substitution $T=\tan((\pi+\theta)/2)$ and the coefficient of the resulting polynomial may be determined using the following procedures:
 
VOID Convert_Trigo_Pi_Interval(int n,VECTOR &A,INTEGER_VECTOR &SSin,
            INTEGER_VECTOR &CCos,INTEGER_VECTOR &Coeff,int *degree);
VOID Convert_Trigo_Pi_Interval(int n,INTEGER_VECTOR &A,INTEGER_VECTOR &SSin,
            INTEGER_VECTOR &CCos,INTEGER_VECTOR &Coeff,int *degree);
VOID Convert_Trigo_Pi_Interval(int n,INTERVAL_VECTOR &A,INTEGER_VECTOR &SSin,
            INTEGER_VECTOR &CCos,INTEGER_VECTOR &Coeff,int *degree);
Similar procedures exists for interval trigonometric equations i.e. equations where the coefficients A are intervals. In that case degree will no more an integer but an INTERVAL which indicate the lowest and highest degree of the resulting polynomial. In some case the number of roots of the trigonometric equation may exceed the degree of the equivalent polynomial. For example the equation $\sin\theta =0$ has the roots $0,
\pi$ while the degree of the equivalent polynomial is only 1. In all cases the total number of roots of the trigonometric equation will never exceed the degree+2.

Having determined the equivalent polynomial you my use the tools described in section 5 for determining the number of roots of the trigonometric equation. But you still have to manage the search interval. The following procedure is able to determine this search interval and to determine the number of roots of the trigonometric equation:

 
int Nb_Root_Trigo_Interval(int n,VECTOR &A,INTEGER_VECTOR &SSin,
                        INTEGER_VECTOR &CCos,REAL Inf,REAL Sup)
with: On success this procedure returns a number greater or equal to 0 and returns -1 if it has failed. Failure occurs either if the equation is equal to 0 or if Sturm method failed to determine the number of roots of the equivalent polynomial equation (this will happen if Inf or Sup are exact root of the equation).


next up previous contents
Next: Example Up: Number of roots of Previous: Mathematical background   Contents
Jean-Pierre Merlet 2012-12-20