# Algorithms for Various Trigonometric Power Sums
## 6 Integral Approach Revisited  
The previous section was aimed at constructing an algorithm for twisted trigonometric power sums, \(T^{\pm}_{v,l}(m,r)\), by using the general results for another important trigonometric power sum, \(V^{\pm}_{v,j}(m)\), given in Lemma 1. Two different forms were determined, the first appearing in Theorem 2, and the second given by (97). Consequently, we obtained polynomials in \(m\) of degree \(2v\), provided \(r\) was set to fixed values. These results agreed with the values obtained by programming the power sums directly in Mathematica. From the direct approach, it was found in the [PERSON] case that both \(m\) and \(r\) had to be specified or set to numerical values, which meant only decimal values for the trigonometric power sum could be compared with each other, even though rational values were obtained from the new algorithm. In addition, \(m\) did not need to be specified to obtain expressions for \(T^{\pm}_{v,l}(m,r)\) via the new algorithm. Surprisingly, in the Dowker case, Mathematica was not only able to provide the polynomials in \(m\) for the values of the twisted trigonometric power sums, but also combined with powers of \(r\), when \(r\) was algebraic. This is not possible with the new algorithm since \(r\) has to be specified. Consequently, this section aims to adapt the integral approach in [21] in order to generate results possessing powers of \(m\) and \(r\) like those generated by Mathematica in the Dowker case. In doing so, we shall be able to obtain the results for the Gardner-Fisher case, where Mathematica fails. Thus, the results presented here will be more general than any of the results presented in previous sections. Theorem 6.1: _For \(r\), a positive integer less than \(lm\), the twisted trigonometric power sum, \(T^{+}_{v,l}(m,r)\), as defined by (9) is given by_  
\[T^{+}_{v,l}(m,r)=\frac{2^{2v}}{\Gamma(2v)}\sum_{n=0}^{v-1}\frac{(-1)^{n}}{2n+2 }\,s(v,v-n-1)\Big{(}(lm)^{2n+2}B_{2n+2}(r/lm)-B_{2n+2}\Big{)}, \tag{98}\]  
_where, as before, \(B_{2n+2}(x)\) represents the Bernoulli polynomial of order \(2n+2\)._Proof. : The proof begins with (20), where we assume \(m=lm\) for the time being. Multiplying this equation by \(\cos(2\pi kr/m)\) yields  
\[\cos\!\left(\frac{2\pi kr}{m}\right)\csc^{2v}\!\left(\frac{k\pi}{m}\right) =-\frac{2^{2v-2}m^{2}}{2\pi^{2}\Gamma(2v)}\int_{0}^{1}\frac{\ln u }{1-u^{m}}\prod_{n=1}^{v-1}\!\left(\frac{m^{2}}{4\pi^{2}}\ln^{2}u+n^{2}\right)\] \[\times\left(u^{k}+u^{m-k}\right)\left(e^{2i\pi kr/m}+e^{-2i\pi kr/ m}\right)\!\frac{du}{u}. \tag{99}\]  
Therefore, the summation over \(k\) becomes  
\[T_{v,l}^{\pm}(m,r) =-\frac{2^{2v-2}m^{2}}{2\pi^{2}\Gamma(2v)}\int_{0}^{1}\frac{\ln u }{1-u^{m}}\prod_{n=1}^{v-1}\!\left(\frac{m^{2}}{4\pi^{2}}\ln^{2}u+n^{2}\right)\] \[\times\sum_{k=1}^{m-1}(\pm 1)^{k}\!\left(u^{k}+u^{m-k}\right)\! \left(e^{2i\pi kr/m}+e^{-2i\pi kr/m}\right)\!\frac{du}{u}. \tag{100}\]  
For the upper-signed case, one finds, by substituting \(m-k\) by \(k\) in the sums with \(u^{m-k}\) and \(r\) equal to an integer, that  
\[\sum_{k=1}^{m-1}u^{m-k}e^{\pm 2i\pi kr/m}=\sum_{k=1}^{m-1}\!\left(ue^{\mp 2i \pi r/m}\right)^{k}. \tag{101}\]  
In other words, we obtain the same sums involving \(u^{k}\), which means that we can multiply the sums involving \(u^{k}\) by a factor of 2 and discard the complex conjugate terms. The upper-signed case of (100) can be expressed as  
\[T_{v,l}^{+}(m,r) =-\frac{2^{2v-1}m^{2}}{2\pi^{2}\Gamma(2v)}\sum_{n=0}^{v-1}\! \left(\frac{m}{2\pi}\right)^{2n}\!s(v,v-n-1)\int_{0}^{1}\frac{\ln^{2n+1}u}{1 -u^{m}}\] \[\times\quad\sum_{k=1}^{m-1}\!\left(u^{k}e^{2i\pi kr/m}+\text{c.c. }\right)\!\frac{du}{u}, \tag{102}\]  
where c.c. denotes the complex conjugate of the preceding sum over \(k\).