4. Basic Trigonometric Power Sums
Basic trigonometric power sums are defined as finite trigonometric power sums of the form
where
m,
q and
n are positive integers,
is dependent upon
n such as
or even
, and
is a relatively simple function of
k, such as unity or
with
p, an integer. Besides the derivation of new results for interesting versions of these sums in [
20], important applications were studied, such as the determination of the number of closed random walks of length
with
vertices. The key results of this work are
and
where
and
Although the second result in each case is not necessary, since it is covered by the first result, they were displayed separately (1) because of their simplicity and (2) to make contact with the results on p. 640 of [
24]. There, they are given as
and
The above results can be programmed easily in Mathematica by typing the following instructions:
CosSum[m−, n−]:= Sum[Cos[k Pi/n]∧(2 m), {k, 0, n − 1}]
CosSum2[m−, n−]:= 2∧(1 − 2 m) n (Binomial[2 m − 1, m − 1] +
Sum[Binomial[2 m, m − p n], {p, 1, Floor[m/n] }]).
If we put and , then Mathematica prints out
In[12]:= CosSum[15, 17]
Out[12] = 1 + 2 Cos + 2 Cos + 2 Cos + 2 Cos + 2 Sin
2 Sin + 2 Sin + 2 Sin.
In number form, this gives a value of 2.455895617604257. On the other hand, typing in
In[13]:= CosSum2[15, 17]
yields
Out[13] = 164812365/67108864.
The decimal value of the above result yields the same decimal value as CosSum[15, 17] except a 6 appears as the last figure, and not a 7. This means that the first result is limited by machine precision, and will not be accurate beyond 16 decimal places. Moreover, one cannot observe whether the results are rational or not, which is clearly the case when employing CosSum2.
The other basic trigonometric power sums studied in [
20] were written in terms of
and
. Nearly all involved combinations of
or
with different arguments. A typical example is
where
n is a positive even integer. Based on the preceding material we can program this basic trigonometric power sum as
CosSum3[m−, n−]:= Sum[Cos[k Pi/3] Cos[k Pi/(3 n)]∧(2 m), k, 0, 3 n−1]
CosSum4[m−, n−]:= 3 CosSum2[m, n/2] − 3 CosSum2[m, n]/2 + CosSum2[m, 3 n]/2 −
CosSum2[m, 3 n/2].
By putting and in both instructions, one obtains
In[14]:= CosSum3[15, 18]
Out[14] = 261261003/268435456 + Cos− Cos− 2 Cos− Cos+
Cos + 2 Cos + Cos − Cos − Cos + Cos +
2 Cos + Cos − Sin + Sin + 2 Sin + Sin − Sin−
2 Sin − Sin + Sin + Sin − Sin − 2 Sin − Sin.
In number form, this yields 0.02986178733408444. However, by applying the second form we find that
In[15]:= CosSum4[15, 18]
Out[15] = 16031925/536870912.
This gives the same value in number form as the above value except the last two digits are 51, not 44. Therefore, programming (
35) and (
36) into Mathematica yields rational values for all the basic trigonometric power sums studied in [
20].
More recently, Du et al. [
25] have developed basic trigonometric power sums further in two directions. The first involves the introduction of an offset in the argument of the power of the trigonometric function so that (
37) and (
38) are re-defined as
and
Consequently, it was found that
and
Here, the
forms have been dropped, since they are included in (
44) and (
45).
The above results can be checked by implementing them in Mathematica [
17]. For example, (
44) can be implemented via the following instructions:
CosSum[m−, n−, ]:= Sum[Cos[(k/n + ) ]∧(2 m), {k, 0, n − 1 }]
CosSum2[m−, n−, ]:= 2∧(1 − 2 m) n (Binomial[2 m − 1, m − 1] +
Sum[Binomial[2 m, m − p n] Cos[2 p n ], {p, 1, Floor[m/n]}]).
Putting , and in the first instruction yields
In[16]:= CosSum[12, 15, 1/3]
Out[16] = 8388609/8388608 + (−1 −/140737488355328 +
(1 −/281474976710656 + (−1 + /281474976710656 + 2 Cos[ +
2 Cos[(2 + 2 Sin[ + 2 Sin[(7 .
In number form, Mathematica prints out a value of 2.41770386695862. On the other hand, typing CosSum2[12,15,1/3] generates the rational value of 10140585/4194304, which yields the same decimal value except the final digit of 2 is replaced by 18.
The second direction taken in [
25] deals with the introduction of a twisted cosine phase factor, e.g.,
, in the summand with the cosine power. This will become become important when we study twisted forms of Dowker-like sums in the next section. It should be mentioned that twisted basic trigonometric power sums were also studied in [
20], but only in limited cases. In [
25], the following result was obtained:
The above result was obtained by adapting No. I.1.10 in [
24] and then multiplying by
. By summing over
k from zero to
, one finds that
The sums over
k on the rhs in (
47) are simply versions of the basic cosine power sum given by (
35). As a consequence, their introduction results in (
46). However, it should be stressed that (
47) is only valid for
and 2.
Since
was observed in [
21] to yield rational values, it follows that the cosine power sum given on the lhs of (
46) will also yield rational rational values. As an example, consider
, which yields
Both the
and
results were not checked numerically in [
25]. However, we can check them here, since a knowledge of how they are coded will be required in the following section.
The definition of a basic trigonometric power sum also includes those with alternating phase factors in the summands. Surprisingly, these have not been studied yet. Moreover, we shall require these sums in the next section. Therefore, the following lemma needs to be proved.
Lemma 1. The alternating basic sine power sum, , stemming from the definition, , has the following solutions for . For the Dowker case or , we havewhereFor the Gardner–Fisher case or , the sum has the following solution:where Remark 1. The conditions on and in the lemma mean that and are equal to , when and , respectively, are odd numbers. Consequently, we shall find that the above results can only be implemented as algorithms/programs yielding rational values.
Proof. To prove the Dowker case for odd values of
n, we set
, where
p is a non-negative integer, and write
as
In the second sum, we replace
k by
. Then,
becomes
or
, while
. Accordingly, the second sum becomes the negative of the first sum on the rhs (rhs) of (
53), thereby yielding zero or the first result of (
49). To prove the remaining results in the lemma, we use No. 17.4.5 of [
26], which can be expressed as
For the Dowker case, we need to put
equal to
, while for the Gardner–Fisher case, we put
. Then, we multiply both sides of each resulting equation by
, sum over
k from zero to
n and interchange the summations. Hence, for the Dowker case, we arrive at
while for the Gardner–Fisher case, we obtain
The second sum appearing on the rhs of both (
55) and (
56) simply yields
, which means, in turn, that it vanishes for odd values of
n and gives unity when
n is even. It provides the common term in the
n even cases of (
51) and (
52).
The first sum on the rhs of either (
55) or (
56) can be evaluated either in Mathematica or using the formula for a geometric series. We shall define them by
This is the general form for the sum. When
x is set equal to
shortly, the sum will be denoted as
. For the Dowker or
case, we require
in (
57), which becomes
The above sum can be determined using Mathematica or splitting the cosine into exponentials of imaginary arguments and applying the geometric series. In adopting the first approach, one simply types
H2[m−, n−, j−, x−]:= Sum[(−1)∧k Cos[2 k (m − j) x], {k, 0, n }].
Next, one types
In[17]:= H2[m, n, j, x].
Then, one obtains the following output:
Out[17] = 1/2 (Cos[j x − m x] Sec[(j − m) x] + Cos[n − j x + m x − 2 j n x + 2 m n x]
Sec[(j − m) x]).
Putting
and dropping the fourth variable, since it is summed out eventually, one arrives at
There is, however, a problem with using this result in the summand, due to the fact that the secant can yield infinity. This problem can be circumvented by simplifying (
59) with the aid of trigonometric identities. Thus, we find that
The above equation is beginning to approach the second result of (
50). Unfortunately, this is not the end of the matter, as (
59) cannot be valid for all values of
m,
n and
j. If we return to (
58) and put
, then we observe that whenever
, where
p is a non-negative integer,
, not the result obtained from (
60). As
j is summed from 0 to
m, this condition can be met occasionally. That is, there will be at least one value of
p where
. Hence, we arrive at (
50). If we insert (
50) and the result below (
56) into (
55), then it becomes
From the reflection formula for the gamma function, one obtains
Introducing the above result into (
61) yields (
49). In the Gardner–Fisher case given by (
56), we observe that the summation over
k can be represented by
according to (
57). This, too, can be summed in Mathematica or by employing the geometric series. Thus, by typing the instruction as
H1[m−, n−, j−, x−]:= Sum[(−1)∧k Cos[k (m − j) x], {k, 0, n }],
followed by
In[18]:= H1[m, n, j, x],
one obtains following output:
Out[18] = 1/2 (−Cos[(−2 + j x − m x)] Sec[(j − m) x] + Cos[ (2n − j x + m x −
2 j n x + 2 m n x)] Sec[(j − m) x]).
Putting
in the above result yields
, which is given by
As in the case of
, the above result can be simplified further by the application of trigonometric identities. Therefore, after a bit of manipulation, one finds that
However, (
64) is not valid when
and
p is a non-negative integer. Thus,
, and we arrive at (
52). Finally, if we replace the sum over
k by
and introduce (
62) into (
56), then we obtain (
51). □
The results in Lemma 1 indicate that the values of and are rational. Even though they have been expressed as formulas, in reality, they represent algorithms when one wishes to determine values from them. Consequently, Mathematica modules need to be created.
As an example, let us consider the second result in (
49). This basic trigonometric sum can be programmed as
Szero1minus[m−, n−]:= Sum[(−1)∧k Sin[k /n]∧(2 m), {k, 0, n}].
For relatively small values of n, typically less than or equal to 6, the above instruction generates rational values. For example, for and , Mathematica prints out
In[19]:= Timing[Szero1minus[16, 6]]
Out[19] = {0.000195, −(32881827/33554432)}.
However, putting and yields
In[20]:= Timing[Szero1minus1[16, 8]]
Out[20] = {0.00016, 32769/32768 − 2 Cos[/8]32 − 2 Sin[/8]32}.
In number form, this yields 0.841277837753296. Unfortunately, one cannot tell whether the value is rational or not, unless the trigonometric powers are expressed as surds as in
Section 5.
To create a module that is able to calculate rational values of
for even integer values of
n, we require a Do loop to determine each of the contributions from the summand of the second result of (
49). Before entering the Do loop, we calculate the second term on the rhs first, which will be denoted as e1. To obtain the correct value of the summand, we introduce an If statement with the condition being whether exp
is equal to −1 or not. If it is, then
or H2 as it is denoted in the module below equals
. Otherwise, it will equal
. Then, the summand, which will be denoted as e2, can be evaluated and summed with e1 to yield a new value for e1. On exiting the Do loop, the final value will become the value of
, which can then be printed out as in the following module:
Szero1minusA[m−, n−]:= Module[{}, e1 = −Binomial[2 m, m] (1 + (−1)∧n)/2∧(2 m +
1); Print[“The value of e1 is ”, e1];
Do[If[ Exp[2 (m − j) I /n] == −1, H2 = (n + 1), H2 = (1 + (−1)∧n)/2];
e2 = (−1)∧(m + j) Binomial[2 m, j] H2/2∧(2 m − 1);
Print[“For j=”, j, “ the value of H2 is ”, H2, “ while the value of e2 is ”, e2];
e1 = e1 + e2, {j, 0, m}]; Print[“The value of Szero1minus is ”, e1]].
Running the module for and gives
Szero1minusA[16, 8]
The value of e1 is −(300540195/2147483648)
For j = 0 the value of H2 is 1 while the value of e2 is 1/2147483648
For j = 1 the value of H2 is 1 while the value of e2 is −(1/67108864)
For j = 2 the value of H2 is 1 while the value of e2 is 31/134217728
For j = 3 the value of H2 is 1 while the value of e2 is −(155/67108864)
For j = 4 the value of H2 is 9 while the value of e2 is 40455/268435456
For j = 5 the value of H2 is 1 while the value of e2 is −(6293/67108864)
For j = 6 the value of H2 is 1 while the value of e2 is 56637/134217728
For j = 7 the value of H2 is 1 while the value of e2 is −(105183/67108864)
For j = 8 the value of H2 is 1 while the value of e2 is 2629575/536870912
For j = 9 the value of H2 is 1 while the value of e2 is −(876525/67108864)
For j = 10 the value of H2 is 1 while the value of e2 is 4032015/134217728
For j = 11 the value of H2 is 1 while the value of e2 is −(4032015/67108864)
For j = 12 the value of H2 is 9 while the value of e2 is 254016945/268435456
For j = 13 the value of H2 is 1 while the value of e2 is −(10855425/67108864)
For j = 14 the value of H2 is 1 while the value of e2 is 29464725/134217728
For j = 15 the value of H2 is 1 while the value of e2 is −(17678835/67108864)
For j = 16 the value of H2 is 1 while the value of e2 is 300540195/1073741824
The value of Szero1minusA is 3528575/4194304.
Finally, the decimal value is found by typing
In[21]:= N[3528575/4194304, 16]
Out[21] = 0.8412778377532959,
which agrees with the previously given value. Of course, the above process can be sped up by removing the Print instruction in the Do loop. From the output, we observe also that there are two instances where equal to or 9, namely and . These values of j will change when m and n are assigned different values. Finally, if we wish to evaluate , all that is required is to alter the first part of the Do loop to
Do[If[ Exp[(m − j) I /n] == −1, H1 = (n + 1), H1 = (1 + (−1)∧(m + n − j))/2];
e2 = (−1)∧(m + j) Binomial[2 m, j] H1/2∧(2 m − 1);.
In fact, we can combine both modules into one module by introducing the variable, l, which is set equal to 1 or 2 corresponding to the Dowker and Gardner–Fisher cases. This can be accomplished by using the Which instruction in Mathematica in the following manner:
Sminuszerol[−1, l−, i−, m−]:= Module[{H1, H2}, H1 = 0; H2 = 0;
e1 = −Binomial[2 i, i] (1 + (−1)∧m)/2∧(2 i + 1);
Which[l == 1, Do[If[ Exp[2 (i − j) I /m] == −1, H2 = (m + 1), H2 = (1 + (−1)∧m)/2];
e2 = (−1)∧(i + j) Binomial[2 i, j] H2/2∧(2 i − 1); e1 = e1 + e2, {j, 0, i}],
l == 2, Do[If[ Exp[(i − j) I /m] == −1, H1 = (m + 1), H1 = (1 + (−1)∧(i + m − j))/2];
e2 = (−1)∧(i + j) Binomial[2 i, j] H1/2∧(2 i − 1);
e1 = e1 + e2, {j, 0, i}]]; Print[e1]].
Therefore, by setting and 2 in the above module, one obtains the values for and , respectively.
5. Twisted Trigonometric Power Sums
As indicated in the introduction, a twisted trigonometric power sum is one whose trigonometric power is multiplied by an extra cosine factor. Originally, this name was applied to the
case of (
10) with
inserted in the sum, and
r was any integer from 1 to
[
6,
7,
12]. In actual fact,
r can be much greater
m, but then it must be replaced by the modulo value with respect to
m, viz.,
. This issue will be discussed in more detail in
Section 6. Moreover, since the trigonometric power sum in (
10) has
in the denominator, we shall consider twisted trigonometric power sums where the cosine factor appears as
as in (
9). Hence, we will be able to study both the Dowker and Gardner–Fisher cases of (
9). Note, however, the upper limit is now
, whereas in the previous sections, we considered
as the upper limit in both cases. Obviously, this has no effect in the Dowker case, but in the Gardner–Fisher case, it will play a role. For
, we shall be required to express the sums in (
9) in terms of those appearing in previous sections. It should also be mentioned that the case of the cosine factor accompanying the basic trigonometric power has already been studied in [
25].
When one considers twisted trigonometric power sums, one frequently ends up having to study other trigonometric power sums, denoted here by
, and defined as
where
j ranges from 0 to
r. These sums arise when the factor of
in a twisted trigonometric power sum is expressed as a sum in powers of
, as will be seen later. Nevertheless, these sums are not only interesting in their own right, but are also formidable. By expressing the cosine powers in terms of power of sines via the binomial theorem, one finds that
For the case of
, the inner sum becomes a pure cosecant power sum. Consequently, it will yield polynomials in powers of
with number-theoretical coefficients or coefficients expressible in terms of the Riemann zeta function. However, when
, there will also be sums involving basic trigonometric power sums. In particular, when
and the summand does not alternate, the sum over
k simply becomes
given by (
36). On the other hand, for the alternating case, it can be expressed in terms of
in Lemma 1. As we have seen in the previous section, such sums are combinatorial in nature. Hence the second case is more complicated than the first case. Nevertheless, both cases can be considered together in one lemma as follows.
Lemma 2. For , the trigonometric power sum defined by (65) can be expressed aswhere the summand factors, are displayed in Table 6 for both signs in the Dowker and Gardner–Fisher cases. For , is given bywhere , , and are, respectively, given by (81), (82), (49) and (51), while the various m-dependent values of are displayed in Table 7. In addition, denotes the Kronecker delta, which equals unity only when or in the Gardner–Fisher case. Proof. When
, all the sine powers in (
66) are negative. Consequently, the results of
Section 2 and
Section 3 can be used to evaluate
. For
and the non-alternating case, we introduce (
15) into (
66), which gives
On the other hand, for the Gardner–Fisher case, where
, we note that
Therefore, we can replace the sum on the rhs of (
66) by
. Since
is given by (
11), we arrive at
where the contribution from the term of unity on the rhs of (
70) vanishes courtesy of the binomial theorem. When the summand alternates in sign, i.e., for
, we still have a purely cosecant power sum, but now the results in
Section 3 apply. For the Dowker case, we introduce (
17) into (
66). Thus, we arrive at
For
, however, we need to take note of the fact that
where
is defined by (
16). Now, by introducing (
18) into (
66), one obtains
Similarly to the term of unity in the non-alternating case, the resulting sum arising from the constant of
in (
73) vanishes due to the binomial theorem. From these results, we see that the sums over
n have a common term of
. Hence, the sums can be expressed as this term multiplied by a summand factor,
, for each value of
in both the Dowker and Gardner–Fisher cases. By adopting this approach, we arrive at (
67), where the summand factors are displayed in
Table 6. These results have been obtained from (
11), (
15), (
17) and (
18), bearing in mind that, in the Gardner–Fisher cases, there is an extra factor of 2, as indicated by (
70) and (
73). Furthermore, since the above results for
depend on the Riemann zeta function, they are purely number-theoretical. When
, however, the situation changes. Then, (
66) becomes
The first term on the rhs of (
75) is number-theoretical as in the
case, except the upper limit is
, not
j. Consequently, the earlier results in the proof can be applied here except the summation over
i has an upper limit of
. The next term on the rhs is the
term, which has been isolated or separated to avoid any potential problem concerning the determinacy of the zeroth power of the sine in Mathematica. For
and the positive-sign or non-alternating case, the sum over
k equals
. However, for
and the negative-sign or alternating case, the sum over
k vanishes when
m is odd, but equals
when
m is even. For the Gardner–Fisher case, the sum over
k equals
for
and
for
. We shall represent the latter sums over
k for the various values of the sign and
l by
. Hence, the second term on the rhs of (
75) can be represented by
, where the various values of
appear in
Table 7.
The final term on the rhs of (
75) represents a sum over basic sine power sums. It also vanishes when
. From the previous section, we have seen that these sums yield combinatorial results. For
j close to
v, the first sum on the rhs of (
75) dominates. Hence, we expect that the overall results will be mainly number-theoretical in nature when
j is approximately equal to
v. This applies especially to the alternating Dowker case because, as we shall see, the sum over the basic sine power sums vanishes when coded as a program. For the Dowker or
case, the final term on the rhs of (
66) can be expressed as
On the other hand, in the Gardner–Fisher case, we have to split the sum over
k into two separate sums, since the upper limit is
for
. In terms of
, the sum can be expressed as
which is identical to the inverse power cases given by (
70) and (
73). As a consequence, for the Gardner–Fisher case, the third term on the rhs of (
75) becomes
As a result of the preceding discussion, (
75) becomes
The sum in the penultimate term on the rhs of (
79) can be evaluated with the aid of No. 4.2.1.5 in Ref. [
24]. Then, we find that
By introducing (
80) into (
79), we arrive at the second result in Lemma 2. □
From the proof, we observe that the powers of m in the final results are governed by the summand factors. In fact, since each summand factor possesses a term with , the degree of the polynomials in m will be corresponding to . In other words, the highest power of is , where .
We are now in a position to consider the development of an algorithm that will evaluate
as defined by (
65). Of the terms comprising
, the most formidable is the second term on the rhs of (
68), namely the term involving the alternating basic sine power sums since, from (
36), the positive sign or non-alternating case can be reduced to
and
where
These forms are easily implemented in Mathematica. However, when the summands are alternating, i.e., for
, we have to deal with
. Previously, it was shown how this function can be implemented by itself in Mathematica, but now it appears in another sum involving binomial coefficients.
To simplify the problem, we combine the results appearing in Lemma 2 into one expression as
Therefore, when
and
m is odd, (
84) vanishes as demonstrated by the top result of (
49), while when
or
m is even, the first sum contributes as demonstrated by the other results in (
49) and (
50) with the major difference being that
and
are implemented when
and
, respectively. In accordance with Lemma 1, the second or final term on the rhs of (
84) only contributes when
m is even.
When it comes to the creation of a module in Mathematica, we do not really need to implement
and
. Instead, we employ a condition to evaluate
H, which is different according to whether
or
when the sign or
equals −1. On the other hand, we can introduce another conditional statement to cover the case when the sign is equal to +1. Moreover, the
and
cases can be combined into one statement by separating the
term in the second term of (
68) and expressing it as
Although the above equation is elegant from a mathematical point of view, it makes a module less readable rather than considering the
and
cases separately, which can be handled by employing a conditional If statement. Consequently, we shall create a module that will calculate the entire last term on the rhs of (
75) for both the Dowker and Gardner–Fisher cases in addition to both their non-alternating (
= +1) and alternating versions (
= −1). Thus, we shall evaluate
The above result can be regarded as a different type of trigonometric power sum. A Mathematica module that is capable of calculating
appears below:
U[sgn_,l_,v_,j_,m_]:= Module[{H}, H = 0; totval = 0;
Do[e1 = 0;Which[sgn == 1&&(l == 1),
e1 = 2∧(1−2(i−v))m Sum[(−1)∧(p m) Binomial[2 (i−v),i−v−p m], {p,1,Floor[(i−v)/m]}]
+2∧(−2(i−v))m Binomial[2(i−v),i−v];
(sgn == 1)&&(l == 2),
e1 = 2∧(1−2(i−v)) m Sum[Binomial[2 (i−v),i−v−2p m],{p,1,Floor[(i−v)/(2m)]}]
+2∧(−2 (i−v))m Binomial[2 (i−v),i−v]−1/2,
(sgn == −1)&&(l == 1),
e1 = −Binomial[2 (i−v),i−v](1 + (−1)∧m)/2∧(2 (i−v) + 1);
Do[If[Exp[2(i−v−k)I /m] == −1,H = (m + 1),H = (1 + (−1)∧m)/2];
e2 = (−1)∧(i−v + k) Binomial[2 (i−v),k]H/2∧(2(i−v)−1); e1 = e1 + e2,{k,0,(i−v)}];
(sgn == −1)&& (l == 2),
e1 = −Binomial[2 (i−v),i−v](1 + (−1)∧m)/2∧(2 (i−v) + 1);
Do[If[ Exp[(i−v−k)I /m] == −1,H = (m + 1),H = (1 + (−1)∧(i−v + m−k))/2];
e2 = (−1)∧(i−v + k) Binomial[2 (i−v),k]H/2∧(2(i−v)−1); e1 = e1 + e2,{k,0,i−v}]];
If[l == 2,e1 = (−1)∧i Binomial[j,i](2 e1−(−1)∧m),
e1 = (−1)∧i Binomial[j,i] e1] e1;totval = totval + e1,{i,v + 1,j}];
Print[“For l=”,l,“, sgn=”,sgn,“, j= ”,j,“v=”,v,“ and m=”,m,“, the sum of the basic
trigonometric power sums in is equal to ”,totval]]].
After setting both the values of H, given by (
57), and
or totval to zero initially, the code encounters a Do loop, whose purpose is to evaluate the summation over
i in (
86). Within the Do loop, the module encounters a Which instruction, which is required to handle all four types of basic trigonometric power sums according to the values of
and
l. The first case in the Which instruction corresponds to the non-alternating Dowker case, where the value of
given by e1 is calculated in accordance with the upper signed version of (
76). The second case is the non-alternating Gardner–Fisher sum, where e1 is evaluated according to (
82). The next two cases in the Which instruction handle both types of alternating sums. This is where H figures in the evaluation of e1. As indicated previously, both these cases require another Do loop, since H is conditional on the value of
. After e1 has been calculated for the particular values of
and
l, the code continues with the first Do loop by testing the upper limit of the inner sum. That is, for the
case, the code takes account of the fact that the upper limit is
as in (
77). Then, each e1 is multiplied by the binomial factor of
to give each value of the summand in the sum over
i in (
86). Finally, all the e1 values are summed within the first Do loop to become the current value of totval. When the Do loop has been completed, totval becomes the value of
, which is the only value printed out by the code.
Table 8 displays the values obtained from the above Mathematica module of all four cases of
, where
v and
j are varied for fixed values of
m. All told, there are 100 values that have been evaluated using the Mathematica module. As expected, the tabulated values are rational. The values were then converted into decimal notation so that they could be checked against the values calculated by programming each basic trigonometric sum in Mathematica. For example,
or the alternating Gardner–Fisher case can also be programmed as
TRGSM4[v_,j_,m_]:= Sum[(−1)∧i Binomial[j,i] Sum[(−1)∧k Sin[k Pi/(2 m)]∧ (2 i−2 v),
{k,1,2m−1}],{i,v + 1,j}].
Obviously, in this module, the phase factor has to be removed for the non-alternating cases, while when dealing with a Dowker case sum, is replaced by m.
It was found that the decimal values of all the results in
Table 8 agreed with the results obtained from the alternative modules, except for the final value in the
and
column. The decimal value of
is 0.0004948227…, whereas TRGSM4[20,40,16] gives a value of 0.000369022… As indicated previously, a closer examination of
can be conducted by inserting a Print[e1] instruction before totval is evaluated in the module. This means that each term in the sum over
i in (
86) is now printed out. In doing so, it is found that e1 vanishes for
i ranging from
to
. That is, only the last five values in the sum contribute to the value of
. Specifically, the last five or non-zero values in the sum are
Summing these values yields the final value in
Table 8 or
.
On the other hand, if one examines the individual terms in the sum over i in TRGSM4[40,20,16], which is achieved by the following instruction:
Term[j−,v−,i−,m−]:= (−1)∧i Binomial[j,i] Sum[(−1)∧ Sin[k Pi/(2 m)]∧(2 i−2 v),
{k,1,2m−1}],
then one finds that the five values given above are obtained in decimal form for i ranging from 36 to 40. Thus, both Mathematica modules calculate the correct components for . The problem, however, lies with the vanishing terms. These are found to be zero using the first module, but are rounded off when using TRGSM4. These round-off errors become sizeable because of the binomial factor multiplying the round-off value obtained from the sum over k in TRGSM4. Normally, round-off errors remain small due since they often oscillate in sign and remain negligible. However, when the terms from to 35 are summed by typing the following instruction:
Sum[Term[40,20,i,16],{i,21,35}],
then Mathematica prints out a value of −0.0001258. If this value is added to , then one obtains , which agrees with the value of TRGSM4[20,40,16] given above. From this study, we observe that utilizing the machine dependent approach to obtain values of will not necessarily guarantee a correct answer, especially when the binomial factor, , becomes very large. Nonetheless, we see that such trigonometric power sums are rational, which is also not noticeable when utilizing the machine dependent approach.
Having produced a Mathematica module for the term involving basic trigonometric power sums or the second term in (
68), we turn our attention to the last two terms in the same equation. The first of these can be handled by one instruction, such as
BinomTerm[sgn−,j−,v−,m−]:= sgn∧m (−1)∧(v + j) Binom[j−1,v](1 + (−1)∧l)/2.
This term only makes a contribution in the Gardner–Fisher or
case. It also changes when the summand of
alternates in sign. Nevertheless, it is rather simple to program by employing the Binomial instruction in Mathematica. On the other hand, the final term in (
68) is dependent upon both
l and
, since
is different for all cases of
. This term can be programmed as a Mathematica module as follows:
PSum[sgn−,l−,j−,v−,m−]:= Module[, Which[ (sgn == 1) &&(l == 1),e1 = m−1,
(sgn == 1) &&(l == 2),e1 = 2m−1,(sgn == −1) &&(l == 1), e1 = −(1 + (−1)∧m)/2,
(sgn == −1) &&(l == 2), e1 = −1];
PSumval = (−1)∧v Binomial[j,v] e1; Print[“ The value of the sum with P(sgn,l) is ”,
PSumval]].
From this module we see that the same conditions in the Which instruction for U[sgn
−, l
−,v
−,j
−,m
−] apply. Therefore, one could, perhaps, incorporate the above module into U[sgn
−,l
−,v
−,j
−,m
−]. However, this is hampered by the Do loop corresponding to the summation over
i in (
68) even though having a module with one Which instruction would result in a more elegant code. Therefore, a simpler option is to insert the module after totval has been evaluated, assign a new variable e2 to determine PSumval and then add PSumval and BinomTerm to determine totval. A code combining the modules appears below:
U1[sgn_,l_,v_,j_,m_]:= Module[{H}, H = 0; totval = 0;
Do[e1 = 0; Which[sgn == 1&&(l == 1),
e1 = 2∧(1−2(i−v))m Sum[(−1)∧(p m) Binomial[2 (i−v),i−v−p m], {p,1,Floor[(i−v)/m]}]
+2∧(−2(i−v))m Binomial[2(i−v),i−v];
(sgn == 1)&&(l == 2),
e1 = 2∧(1−2(i−v)) m Sum[Binomial[2 (i−v),i−v−2p m],{p,1,Floor[(i−v)/(2m)]}]
+2∧(−2 (i−v))m Binomial[2 (i−v),i−v]−1/2,
(sgn == −1)&&(l == 1),
e1 = −Binomial[2 (i−v),i−v](1 + (−1)∧m)/2∧(2 (i−v) + 1);
Do[If[Exp[2(i−v−k)I /m] == −1,H = (m + 1),H = (1 + (−1)∧m)/2];
e2 = (−1)∧(i−v + k) Binomial[2 (i−v),k]H/2∧(2(i−v)−1); e1 = e1 + e2,{k,0,(i−v)}];
(sgn == −1)&& (l == 2),
e1 = −Binomial[2 (i−v),i−v](1 + (−1)∧m)/2∧(2 (i−v) + 1);
Do[If[ Exp[(i−v−k)I /m] == −1,H = (m + 1),H = (1 + (−1)∧(i−v + m−k))/2];
e2 = (−1)∧(i−v + k) Binomial[2 (i−v),k]H/2∧(2(i−v)−1); e1 = e1 + e2,{k,0,i−v}]];
If[l == 2,e1 = (−1)∧i Binomial[j,i](2 e1−(−1)∧m),
e1 = (−1)∧i Binomial[j,i] e1] e1;totval = totval + e1,{i,v + 1,j}];
Which[(sgn == 1)&&(l == 1),e3 = m−1, (sgn == 1)&&(l == 2),e3 = 2m−1,
(sgn == −1)&&(l == 1),e3 = −(1 + (−1)∧m)/2, (sgn == −1)&&(l == 2),e3 = −1];
scndval = (−1)∧ Binomial[j,v] e3;totval = totval + scndval;
totval = totval + (−1)∧v Binomial[j,v] Sum[(sgn)∧k,{k,1,lm−1}];
Print[“For l=”,l,“, sgn=”,sgn,“, j= ”,j,“v=”,v,“ and m=”,m,“, the sum of the basic
trigonometric power sums in is equal to ”,totval]]].
This interim module is essentially the same as the previous one, except it calculates the last two terms in (
68) and adds them to totval. Therefore, to produce a code that determines values of
, we only require the code to evaluate the first term on the rhs of (
68) when
. Moreover, this term is identical to the rhs of (
67), except for the upper limit of the outer sum. Hence, one can use the same code to calculate (
67), except for a change in the upper limit. To handle this problem, a conditional If instruction has been inserted near the beginning of the program. This instruction tests whether the upper limit of the outer sum equals
j when
or equals
for all other values of
j. It then assigns a variable called upplmt to whichever case applies. Moreover, the same instructions can be used to evaluate the double sum in either case. As a result of the introduction of upplmt into the code, there needs to be another conditional If instruction or statement following the calculation of the double sum, which calculates the remaining terms in (
68) for
.
In
Section 3, we introduced a summand factor to cover both the
and
cases of
. Here, we adopt this approach further by noting that the four cases of
all include
in their summands. Therefore, we can employ the Which instruction again to determine the appropriate summation factor for the case of
we are studying. This is achieved by implementing the following instruction:
Which[sgn == 1 &&(l == 1), Sfctr = 2∧(2n + 1) (m∧(2 v−2 n) −1),
sgn == 1 &&(l == 2), Sfctr = 2∧(2v + 1) (m∧(2v−2n)−1),
sgn == −1 &&(l == 1), Sfctr = 2∧(2n)(1 + (−1)∧m)(((2∧(2 n−2 v + 1)−1) m∧(2 v−2n) −1),
sgn == −1 &&(l == 2), Sfctr = (2∧(2n + 2)− 2∧(2v + 1)) m∧(2v−2n)− (−1)∧m 2∧(2v + 1)
+((−1)∧m −1)2∧(2n + 1)].
Now, we are in a position to present an algorithm for determining rational values of
by combining the preceding material into one module called Vpm[sgn
−,l
−,v
−,j
−,m
−]. To execute the module, one needs to input the values of
,
l,
v,
j and
m, although the value of
m can be algebraic. The module begins by initializing the value of the trigonometric power sum given by the variable totval to zero in addition to H, which is used in evaluating the term involving the basic trigonometric power sum or the second term on the rhs of (
68). Next, the summand factor for either the rhs of (
67) or the first term on the rhs of (
68) is determined from the input values of
and
l. The summand factor is printed out via the first Print instruction, but this diagnostic can be commented out, if desired. In fact, there are other Print instructions in the module that can also be removed, since they only appear to observe that the module is behaving properly. Hence, only the last Print instruction, which prints out the final value of totval, needs to be retained.
Once the appropriate summand factor has been determined, the module determines whether the upper limit of the number-theoretical term is
j or
corresponding to
or
. If it is the former value, then upplmt is set equal to
j and the variable totval becomes the value of the double sum in (
67). Otherwise, upplmt is set equal
and totval becomes the value of the first term on the rhs of (
68). It is then printed out as the current value of totval. In the first case, totval becomes the value of
. The rest of the module is discarded because of the conditional If instruction after the second Print instruction. Hence, totval becomes the final value of
, and is printed out again in the final Print instruction. However, if
, then the module calculates the remaining terms on the rhs of (
68).
As stated earlier, the second term on the rhs of (
68) represents a finite sum of basic trigonometric power sums, which can be evaluated by employing the module presented for
below (
32). It was also stated that this is the most difficult term to evaluate because in the case of an alternating sum H changes according to the conditions of the If instruction as it is being tested for each iteration in a Do loop. Therefore, this term is left until after the third and fourth terms on the rhs of (
68) are evaluated in the module below. After the number-theoretical term has been calculated, the module evaluates the fourth term on the rhs of (
68), which only contributes to the Gardner–Fisher or
trigonometric power sums. This calculation is represented by e1 in the module.
Vpm[sgn−, l−, v−, j−, m−] := Module[{H}, H = 0; totval = 0;
Which[(sgn == 1 && l == 1), Sfctr = 2∧(2 n + 1) (m∧(2 v − 2 i − 2 n) − 1),
(sgn == 1 && l == 2), Sfctr = 2∧(2 v − 2 i + 1) (m∧(2 v −2 i − 2 n) − 1),
(sgn == −1 && l == 1), Sfctr = 2∧(2 n) (1 + (−1)∧m) ((2∧(2 n − 2 v + 2 i + 1)−1)
m∧(2 v−2 i− 2 n)− 1),
(sgn == −1 && l == 2), Sfctr = (2∧(2 n + 2) − 2∧(2 v − 2 i + 1)) m∧(2 v − 2 i − 2 n) −
(−1)∧ m 2∧(2 v − 2 i + 1) + ((−1)∧m − 1) 2∧(2 n + 1)];
Print[“The value of the summand factor is ”, Sfctr];
If[j < v, upplmt = j, upplmt = v − 1];
totval = Expand[FullSimplify[ Sum[(−1)∧i Binomial[j, i] Sum[ SymmetricPolynomial[n,
Table[k∧2, k, 1, v − i − 1]] Zeta[2 v−2 i−2 n] Sfctr/(Pi∧(2 v− 2 i −2 n) Pochhammer[2 v−
2 i−2 n, 2 n]), {n, 0, v − i − 1}], {i, 0, upplmt}]]];
Print[“The current value of totval is ”, totval];
If[v j, If[l == 2 && j != v, e1 = −sgn∧m (−1)∧v Binomial[j−1, v], e1 = 0];
totval = totval + e1;
Print[“The value of the l = 2 extra term is ”, e1];
Which[(sgn == 1 && l == 1), e2 = m − 1, (sgn == 1 && l == 2), e2 = 2 m − 1, (sgn
== −1 && l == 1), e2 = −(1 + (−1)∧m)/2, (sgn == −1 && l == 2), e2 = −1];
Print[“The value of P(sgn,l) is ”, e2];
e3 = (−1)∧v Binomial[j, v] e2;
Print[“The value of the extra term is ”, e3];
totval = totval + e3];
If[v<j, Do[e4 = 0; Which[(sgn == 1) && (l == 1),
e4 = 2∧(1 −2 (i −v)) m Sum[(−1)∧(p m)
Binomial[2 (i −v), i−v−p m], {p, 1, Floor[(i − v)/m]}] + 2∧(−2 (i− v)) m Binomial[2 (i− v),
i− v], (sgn == 1) && (l ==2), e4 = 2∧(1 −2 (i −v)) m Sum[Binomial[2 (i−v), i−v −2 p m],
{p, 0, Floor[(i − v)/(2 m)]}] − 2∧(−2 (i−v)) m Binomial[2 (i− v), i− v] − 1/2, (sgn == −1)
&& (l == 1), e4 = −Binomial[2 (i−v), i−v] (1 + (−1)∧m)/2∧(2 (i−v) + 1);
Do[If[ Exp[2 (i− v− k) I Pi/m] == −1, H = (m + 1), H = (1 + (−1)∧m)/2]; e5 = (−1)∧(i−
v + k) Binomial[2 (i−v), k] H/2∧ (2 (i− v) − 1); e4 = e4 + e5, {k, 0, (i− v)}], (sgn == −1)
&& (l == 2), e4 = −Binomial[2 (i− v), i− v] (1 + (−1)∧m)/2∧ (2 (i− v) + 1);
Do[If[ Exp[(i − v − k) I Pi/m] == −1, H = (m + 1), H = (1 + (−1)∧(i− v+ m− k))/2];
e5 = (−1)∧(i −v+ k) Binomial[2 (i−v), k] H/2∧(2 (i − v) − 1); e4 = e4 + e5, {k, 0, i − v}]];
If[l == 2, e4 = (−1)∧i Binomial[j, i] (2 e4 + (sgn)∧(m)), e4 = (−1)∧i Binomial[j, i] e4];
Print[“The value of e4 is ”, e4];
totval = totval + e4, {i, v + 1, j}]];
Print[“The final value of the sum is ”, totval]].
The fourth term on the rhs of (
68) is the next term that is evaluated in the module. Before this term can be evaluated, the appropriate value of
given in
Table 7 must be determined. Like the summand factor for the number-theoretical terms, a Which instruction is invoked, and the value is given by e2. A diagnostic Print statement that prints out the appropriate value of
follows. Then, this value is multiplied by the binomial factor to give the value of e3, which is subsequently added to totval. Finally, e4 representing the value for the sum of the basic trigonometric power sums is obtained by adapting the Mathematica module for
, and is added to totval to give the final value for
. Before this value is added to totval, the module checks whether a doubling up is required due to the fact that for
, the summation over
k has an upper limit of
, rather than
.
For the Dowker case, we introduce (
17) and (
49) into (
77). Therefore, we observe that for
m odd,
vanishes, as in (
72). However, there is no need to display the result here, as we can use the algorithms for
and
to obtain the values of
.
Let us now examine the output generated from the above module for two examples. In the first example, we consider
, while in the second example, we consider
. That is, in both examples, we shall require the more complicated (
68) rather than (
67). Moreover, we shall consider the alternating or
forms of
, since they require the results of Lemma 1. Specifically, we shall set
or consider the Dowker case for
in the first example, and then set
, or consider the Gardner–Fisher case for
. For the first example, we do not require (
49) because
j is not greater than
v, but in the second example, we require (
50), since there will be basic trigonometric power sums for all those values between
and
j. Finally, we shall set
m to a specific value, viz. 12 in the first example, while it will remain algebraic in the second example.
Below is the output generated by Vpm when
and
for the alternating form of the Dowker case. That is, the trigonometric power sum reduces to
Typing Vpm[−1, 1, 9, 9, 12] into a Mathematica notebook yields
Vpm[−1, 1, 9, 9, 12]
The value of the summand factor is 21+2n (−1+1218−2i−2n (−1+2−17+2i+2n))
The current value of totval is −
The value of the l = 2 extra term is 0
The value of P(sgn,l) is −1
The value of the extra term is 1
The final value of the sum is −.
In decimal form, the final value is given as
N
−3.94535 × 1010.
By clicking on the NumberForm of this result, one can extend the decimal value to 16 places. For example,
NumberForm[−3.94535 × 1010, 16]
NumberForm= −3.94534892399999 .
The above output begins by displaying the value of the summand factor, which is a simplification of the
and
form of the third result in
Table 6. Next, the value of the first term on the rhs of (
68) is given. As expected, because
, the third term on the rhs of (
68) does not contribute. Thus, the
term is given as zero. Then, the last term on the rhs of (
68) is calculated, which requires
from
Table 7. Since
m is even, the entire term is non-zero. In fact, it yields unity due to the fact that
and
v is odd. Finally, the term involving basic trigonometric powers sums, viz. the second term on the rhs of (
68) is evaluated. However, as
in the example, there is no contribution from this term.
On the other hand, one can evaluate
by using the standard instructions in Mathematica [
17], which means expressing it as
Sum[(−1)∧k Csc[k Pi/12]∧(18) Cos[k Pi/12]∧(18), {k, 1, 11}].
The above instruction generates the following output:
.
Once again, the above expression can be evaluated via the N[] instruction in Mathematica as indicated below:
In[22]:= N.
Out[22] = −3.94535 × 1010.
As before, we can extend the number of decimal places using NumberForm. Therefore, we find that
In[23]:= NumberForm[−3.94535 × 1010, 16]
Out[23] = −3.945348923999989 × 1010.
In this example, we observe that the standard approach yields an almost identical result to the algorithmic approach employing which, as we have seen already, is not always the case.
Let us now consider the second example. As indicated above, this example has the same values for the arguments as the first example except that
and
m remains algebraic. In this instance, the sum becomes
, which is given by
Then, typing Vpm[−1, 2, 9, 9, m] into a Mathematica notebook generates the following output:
In[24]:= Vpm[−1, 2, 9, 12, m]
The value of the summand factor is
−(−1)m 219−2i+21+2n (−1+(−1)m)+(−219−2i+22+2n)
The current value of totval is
The value of the l = 2 extra term is 55 (−1)m
The value of P(sgn,l) is −1
The value of the extra term is 220
The value of e4 is 66
The value of e4 is −12
The value of e4 is
The final value of the sum is
.
The output begins by printing out the summand factor,
, for the first sum on the rhs of (
68). Then, the module prints out the value of the number-theoretical term or the first term on the rhs of (
68). Next the third term on the rhs of (
68), which only contributes when
, is calculated and printed out. After this, the term containing
is calculated and printed out followed by the value of the last term on the rhs of (
68). The last term handled by the module is the sum over the basic trigonometric power sums or the second term on the rhs of (
68). As expected, there are three distinct sums corresponding to
. These combinatorial terms only affect the constant term in the polynomials derived from summing the number-theoretical terms represented by the first value of totval. Finally, all these terms are added to totval to give the value of
. From the output, we observe that the behavior of the trigonometric power sum is mainly dominated by the number-theoretical term in (
68).
One can check the above result for by setting m equal to specific values. Before this can be accomplished, one must first create a function out of the final value as follows:
Q[m−]:= 28736191507522589/194896477400625 − 219 (−1)m + 2
.
By putting in the above polynomial, one finds that
In[25]:= Q[10]
Out[25] = −.
In number form or to machine precision, Mathematica prints out
In[26]:= NumberForm[−4.7198 , 16]
Out[26]//NumberForm = −4.719798577692218 × .
On the other hand, for m equal to an odd value, say 11, one finds that gives a value of
In[27]:= Q[11]
Out[27] = −.
In decimal form to 16 places, the above value becomes .
Since the above trigonometric power sum can be expressed as
it can also be expressed in terms of the standard instructions in Mathematica as
VSum[m−]:= Sum[(−1)∧k Cos[k Pi/(2 m)]∧(24) Csc[k Pi/(2 m)]∧(18), {k, 1, 2 m − 1}].
Putting in the above form for yields
In[28]:= VSum[10]
.
If one asks for the number form value of the above expression to 16 decimal places, then Mathematica yields the following result:
In[29]:= NumberForm[−4.7198 × , 16]
Out[29]//NumberForm = −4.719798577691239 .
Therefore, we obtain the same numerical value as the algorithm for except for the last few decimal places, which is due to the fact that the above method has implemented far more machine precision. Moreover, if we set in VSum, then we obtain a similar expression in products of power of trigonometric functions as displayed above, but with no algebraic terms. In this instance, the denominators of the arguments of the trigonometric functions are either 11 or 22. In number form to 16 decimal places, we find that VSum[11] equals , which equals Q[11] to 13 decimal places.
Now that we have created an algorithm for , we can turn our attention to the creation of an algorithm for the general twisted trigonometric power sum defined in the introduction. This is accomplished in the following theorem.
Theorem 2. For r, an integer lying in range of [1,…,], the general twisted trigonometric power sum, , as defined by (9), can be expressed as a sum of various forms of the trigonometric power sum, , given by (66) as follows:where Proof. To prove the above theorem, we require No. I.1.10 in [
24] which, as mentioned previously, was used in the derivation of (
46). On this occasion, however, we replace
n and
x by
and
, respectively. Hence, we arrive at
where, without loss of generality,
r is an integer lying between 1 and
. For
or the untwisted case, one needs to insert an additional term of
into (
92) as a result of No. 4.2.1.8 in [
24].
If one introduces (
92) into (
2), then one obtains
where
is given by (
91). Now, it is readily observed that the summations over
k represent different forms of (
66). Therefore, by replacing the summations by the corresponding form of
, we arrive at (
90). □
From (
90), we see that the general twisted trigonometric power sum reduces to a finite sum involving different forms of
. Therefore, we can call the Mathematica module for
, given earlier in this section, inside another module that handles only (
92). Such a module appears below:
Tpm[sgn−, l−, v−, m−, r−]:= Module[{}, Vpm[sgn, l, v, r, m];
sumval = 2∧(2 r − 1) totval;
Print[“The value of the trigonometric power sum Vpm is ”, sumval];
Do[Crj = (−1)∧(j + 1) r Binomial[2 r − j − 2, j] 2∧(2 r − 2 j − 2)/(j + 1);
Print[“The value of the coefficient Crj is ”, Crj];
Vpm[sgn, l, v, r − j − 1, m]; e5 = totval Crj;
Print[“The value of e5 is ”, e5]; sumval = sumval + e5, {j, 0, r − 1}];
Print[“The value of Tpm[”, sgn,“,”, l, “,”, v, “,”, m, “,”, r“] is ”, Expand[
FullSimplify[sumval]]]].
For this module to yield values, one needs to specify values for all the input variable except m, which can remain algebraic.
The module begins with the evaluation of the first term on the rhs of (
90). This involves the
form of
multiplied by
, and is set equal to the variable sumval, which will ultimately yield the value of the entire twisted trigonometric power sum. Next, the summation over
j on the rhs of (
90) is evaluated in a Do loop. For each value of
j, the coefficient,
is calculated first and printed out. Then, a call to
is made. With each call a new value of totval is calculated. In each instance, the variable is multiplied by the appropriate value of
, since it is not local in the module, Vpm[sgn
−,l
−,v
−,j−,m
−]. The resulting value denoted by e5 is printed out before being added to sumval. After exiting the Do loop, the final value of sumval is printed out yielding the value of
.
Now, we confirm that the module does give correct values of
by considering a few examples. To facilitate this study, we shall remove all diagnostic Print statements or instructions in both modules. That is, we shall only maintain the output provided by the last Print instruction in Tpm[sgn
−, l
−, v
−, m
−, r
−]. In the first example, we shall consider twisted trigonometric power sums in the Dowker case. Specifically, we shall study
In terms of standard Mathematica instructions, this sum can be expressed as
TSumP[m−, v−, r−]:= Sum[Cos[2 k r Pi/m] Csc[k Pi/m]∧(2 v), {k, 1, m − 1}].
The corresponding sum for the alternating case becomes TSumM[m−, v−, r−], and has an extra phase factor of in the summand.
If we put and , then we find that Mathematica prints out the following result for TSumP[m,9,3]:
In[30]:= TSumP[m, 9, 3]
Out[30] = (12964140545731 − 11467298304000 m2 − 1421455464576 m4 −
112614327264 m6 + 24754314312 m8 + 10826441262 m10 + 1620381180 m12 +
39314268 m14 − 12988647 m16 + 87734 m18).
On the other hand, if we put sgn = 1, , and in the module Tpm[sgn−, l−, v−, m−, r−], then Mathematica prints out
In[31]:= Tpm[1, 1, 9, m, 3]
The value of Tpm[1,1,9,m,3 ] is
.
Both forms for are identical to each other, though they appear to be different due to the FullSimplify instruction being implemented in one of the algorithms.
An interesting situation occurs when 3 is replaced by r in the command for TSum. That is, typing
In[32]:= TSumP[m,9,r]
yields
.
Therefore, we see that Mathematica is able to produce not only the polynomials of degree
in
m as the module Tpm[sgn
−, l
−, v
−, m
−, r
−] does, but also polynomials of degree
in
r. In fact, the polynomials are composed of terms of the form
, where
i and
j are less than or equal to
. This issue forms the basis of the next section where the integral approach in [
21] is extended to
. For now, we are concerned with how the module Vpm[sgn
−,l
−,v
−,m
−,r
−] can be used to obtain values for the various twisted trigonometric power sums.
Before discussing an example of the Gardner–Fisher case, it should be mentioned that there is another representation of (
90). Instead of using (
92), one can use the intermediate form of No. I.1.10 in [
24], which can be expressed as
Introducing (
95) into (
2) yields
By interchanging the order of the summations, we can substitute (
66), thereby obtaining
This can be programmed in a slightly shorter Mathematica module as follows:
Tpm3[sgn−, l−, v−, m−, r−]:= Module[{}, e1 = 0;
Do[Vpm[sgn, l, v + j − r, j, m]; e2 = (−1)∧(r + j) totval Binomial[2 r, 2 j];
e1 = e1 + e2, j, 0, r];
Print[“The value of Tpm3[”,sgn,“,”,l,“,”,v,“,”,m,“,”,r,”] is ”, Expand[FullSimplify[e1]]]].
As expected, this module gives the same values for Tp[1,1,9,m,3] and TSum[m,9,3] presented above. Hence, we can use this form when we study the Gardner–Fisher case.
For , we shall consider the alternating case () with v and r again equal to 9 and 3, respectively. If one types in Tpm[−1, 2, 9, m, 3], then Mathematica prints out
The final value of the sum is
.
In this case, we need to modify TSumM[v−, m−, r−] to
TSumM2[v−, m−, r−]:= Sum[(−1)∧k Cos[k r Pi/m] Csc[k Pi/(2 m)]∧(2 v),
{k, 1, m − 1}].
If one types TSumM2[9,m,3] into Mathematica, then all that is generated is the original sum itself. That is, Mathematica is unable to generate the polynomials of degree or 18 in m as above. On the other hand, if one types in TSumM2[9,11,3], then the package prints out
1486025307131/177147 − Csc− Csc− Csc− Sec− Sec−
Sec.
In NumberForm this gives a value of compared with when m is set equal to 11 in the above polynomial expression.
6. Integral Approach Revisited
The previous section was aimed at constructing an algorithm for twisted trigonometric power sums,
, by using the general results for another important trigonometric power sum,
, 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
, 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 Gardner–Fisher 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
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 3. For r, a positive integer less than , the twisted trigonometric power sum, , as defined by (9) is given bywhere, as before, represents the Bernoulli polynomial of order 2n + 2. Proof. The proof begins with (
20), where we assume
for the time being. Multiplying this equation by
yields
Therefore, the summation over
k becomes
For the upper-signed case, one finds, by substituting
by
k in the sums with
and
r equal to an integer, that
In other words, we obtain the same sums involving
, which means that we can multiply the sums involving
by a factor of 2 and discard the complex conjugate terms. The upper-signed case of (
100) can be expressed as
where c.c. denotes the complex conjugate of the preceding sum over
k. The summation over
k can be easily evaluated, yielding
If we introduce (
103) into (
102) and carry out a little algebra, then we find that
Expressed in this form, one can cancel terms in the denominator. Consequently, (
102) reduces to
The integrals in (
105) are divergent at the lower limit, despite the fact that the lhs or
is finite. This means that the divergences must cancel. To observe this cancellation, we re-write (
105) as follows:
According to No. 4.271(15) in [
23], we have
where
represents the digamma function differentiated
n times. From No. 8.363(8) in [
23] and separating the
term, we find that
Thus, we observe that only one term is responsible for the divergence in the first integral.
The second integral in (
105) is evaluated by using No. 4.272(3) in [
23] subject to the condition that
. Then, we find that
Again, only the
term in the first summation on the rhs of (
109) is divergent. As expected, this term cancels the divergent term in (
108).
Now, we can take the limit as
without any issues. Consequently, (
106) becomes
Expanding the sine in the numerator of the first summation over
k results in the cancellation of the second summation over
k in (
110). So, (
110) reduces to
From No. 9.622(3) in [
23], we can identify the remaining summation over
k in (
111) as being related to the Bernoulli polynomial,
. Moreover, as the divergences have been removed, we can analytically continue the result from
to
, since the summation over
k is valid for these values of
r. Then, we obtain
From No. 9.616 in [
23], we can replace the first term in the parentheses by the Bernoulli number,
, which results in (
98) with
. For
or the Gardner–Fisher case, all that is required is to replace
m by
in (
112). Thus, we end up with (
98) for both cases. □
To verify (
98), all we need to do is construct a code and compare it with the output from the instruction for TSumP below (
94). Of course, this can only be performed in the Dowker or
case. A simple code for (
98) in Mathematica is
Tplus[m−, r−, v−]:= Expand[FullSimplify[(2∧(2 v)/Gamma[2 v])
Sum[(−1)∧n SymmetricPolynomial[v−n−1,Table[k∧2, {k,1,v−1}]]
(m∧(2 n + 2) BernoulliB[2n + 2,r/m] − BernoulliB[2n + 2])/(2 n + 2), {n,0,v−1}]]].
Note that the first argument in the SymmetricPolynomial instruction is now
instead of
n. This has occurred because previously when Newton’s identities were applied to the product term inside (
21) to yield (
23), the ordering over
n was reversed.
Let us consider an example by putting , and in the above compound instruction. Then, we find that
In[33]:= Tplus[m, r, 4]
.
This is the same result obtained when one types TSumP[m,4,r] into Mathematica. Nevertheless, it should be pointed out that (
98) applies to the Gardner–Fisher case (
), which cannot be determined by a simple Mathematica instruction as in TSumP.
On the other hand, it should be pointed out that the results for the Dowker case are more general in Mathematica, in the sense that
r is not restricted to being an integer less than
m. Whilst one obtains polynomial results via (
98) when
m and
v are specified, this does not apply to TSumP[m,v,r]. For example, typing
In[34]:= TSumP[5, r, 4]
produces the following result:
Out[34] =
The above result, of course, is simply an expression totaling the individual summands in
, and can be expressed in reduced form as
An expression for the second cosine in (
113) appears in Appendix I.11.5 of [
24], but it is misleading. The more correct version, which appears as (3.15) in [
25], is given by
The first cosine is simply obtained by replacing
r by
, which gives (3.16) in [
24]. In this case, the second term on the rhs of (
114) equals −1/4. Introducing (
114) into (
112) and carrying out some algebra, one obtains
where
Since both
and
are periodic or modulo 5,
is modulo 5. Moreover,
is zero for all values of
r greater than zero and less than 5, where Theorem 3 applies. The modulo 5 values of
r equal to zero can be handled with the results in
Section 2. Consequently, the
-term in (
115) vanishes, and the values of
are rational, as expected. In fact, for
r equal to 1, 2, 3 and 4,
equals 1024/25, −2816/25, −2816/25 and 1024/25, respectively. The above example can be extended to other values of
v and
m using other results in Appendix I.11 of [
24].
We now turn our attention to the alternating cases of the results in Theorem 3, which are presented in the following theorem.
Theorem 4. For r, a positive integer less than , the alternating twisted trigonometric power sum in the Dowker case, , is given bywhile the corresponding alternating twisted trigonometric power sum in the Gardner–Fisher case is given by Proof. The second result in the theorem will be proved first, since it will be used in the proof of the first result. As a consequence, we express
as
The first sum on the rhs of (
119) is the
or Gardner–Fisher version of (
98), while the second sum on the rhs of (
119) can also be expressed as
Hence, the second sum becomes the
or Dowker version of (
98). Introducing the two versions of (
98) into (
119) yields (
118) after some algebra.
If one assumes that
m is even, then we can put
in
, thereby obtaining
In other words, we arrive at
. Therefore, substituting
m by
in (
118) yields the second result in (
117).
Finally, we consider the situation when
m is odd. Already, we have seen that
vanishes as demonstrated in the proof of Theorem 1. Here, we let
, where
N is a non-negative integer, and write
as
In the second sum we replace
k by
. This gives
The above result cancels the first sum on the rhs of (
122), leaving us with zero for odd values of
m in the alternating twisted trigonometric power sum for the Dowker case. □
From the results in Theorems 3 and 4, it can be seen that the solutions to twisted trigonometric power sums in the Dowker case are only valid for integer values of
r from zero to
. However, it was mentioned at the beginning of
Section 5 that, for
r larger than
m, solutions of twisted trigonometric power sums could be obtained for the Dowker case by assigning
r to become the modulo of
r with respect to
m. Thus, there are
m distinct values of this twisted trigonometric power sum. In other words, the twisted trigonometric power sum is cyclic over the integers.
In the Gardner–Fisher case, there are
distinct values for the twisted trigonometric power sum, but the upper
m values of the non-alternating version become the lowest
m values of the alternating version or vice versa. To see this more clearly, let
, where
p is an integer and
. Introducing this value of
r into (
9) yields
This equation can be simplified further, giving
Let us assume that , which means the summand has only a factor of . Therefore, whenever p is even, , while if p is odd, then . On the other hand, if , we find that when p is even, , while for p, odd, .
Following the descriptions around previous codes throughout this work, it is now a straightforward matter to combine the results in Theorems 3 and 4 into one Mathematica module/program. First, we note that the results in both theorems except the vanishing odd m result in the alternating version of the Dowker case are very similar. The main difference lies in the Bernoulli polynomial expression accompanying the symmetric polynomial term, . As we observed with the summand factor of the previous section, the Which instruction can be used to determine the appropriate Bernoulli polynomial expression, which will be called BrnTrm. Then, the Sum instruction can be utilized to sum over the symmetric polynomials multiplied by BrnTrm for the various values of n. Finally, we use the Print instruction to print out the value of the particular twisted trigonometric power sum requested in the input. An implementation of this algorithm appears below:
Ttwstd[sgn−, l−, m−, v−, r−]:= Module[{}, flg = 1;
If[1 + (−1)∧m == 0 1 + (−1)∧m,flg = −1]; Which[(sgn == +1),
BrnTrm = (l m)∧(2 n + 2) BernoulliB[2 n + 2, r/(l m)] − BernoulliB[2 n + 2],
(sgn == −1 && l == 1 && flg), Print[“The result below is not valid for odd
values of m.”];
BrnTrm = 2 (m/2)∧(2 n + 2) BernoulliB[2 n + 2, 2 r/m]− m∧(2 n + 2)
BernoulliB[2 n + 2, r/m] − BernoulliB[2 n + 2],
(sgn == −1 && l == 1 && 1 + (−1)∧m == 0 && flg), BrnTrm = 0,
(sgn == −1 && l == 1 && 1 + (−1)∧m ! = 0 && flg), BrnTrm = 2 (m/2)∧(2 n + 2)
BernoulliB[2 n + 2, 2 r/m] − m∧(2 n + 2) BernoulliB[2 n + 2, r/m]
− BernoulliB[2 n + 2],
(sgn == −1 && l == 2), BrnTrm = 2 m∧(2 n + 2) BernoulliB[2 n + 2,r/m]
− (2 m)∧(2 n + 2) BernoulliB[2 n + 2, r/(2 m)] − BernoulliB[2 n + 2] ];
e1 = (2∧(2 v)/Gamma[2 v]) Sum[((−1)∧n/(2 n + 2)) BrnTrm
SymmetricPolynomial[v−n−1, Table[k∧2,{k, 1, v−1}]], {n, 0, v−1}];
Print[“The value of T∧(”, sgn, “)−{”, v, “,”, l, “}(”, m, “,”, r, “)=”, Expand[e1]]].
Whilst the above module largely follows in a straightforward manner from the other modules presented earlier, there is one new feature that has been inserted above. This is the variable , which represents a flag that is initially set equal to 1. Its primary purpose is to determine whether m is algebraic or has been set equal to an integer. If m is algebraic, then remains positive and the module continues treating m as an algebraic quantity. Whether m is algebraic or not does not affect the Gardner–Fisher forms. However, it does affect the alternating Dowker results. If one should input , and , then will remain greater than zero and the module will print out a statement that the result for the twisted trigonometric power sums is not valid for odd values of m. On the other hand, if m has been given an integer value, then is set equal to −1 in the If statement at the beginning of the module. In this instance, the module prints out zero for the twisted trigonometric power sum if m is odd or its value for even values of m.
We now consider some examples of the above module before concluding this paper. Let us consider a relatively small value of m initially, say . By putting , , and , Ttwstd prints out
In[35]:= Ttwstd[+1, 2, 5, 9, 2]
Out[35] = The value of T∧(1)−{9,2}(5,2) =
In[36]:= N[ (117011644541/125)]
Out[36] = −
In[37]:= NumberForm[, 16]
Out[37] = −9.36093156328 .
On the other hand, if we consider the same values except set , then we obtain
In[38]:= Ttwstd[−1, 2, 5, 9, 2]
Out[38] = The value of T∧(−1)−{9,2}(5,7) =
In[39]:= N[−117017411709/125]
Out[39] =
In[40]:= NumberForm[, 16]
Out[40]:=.
It was mentioned above that when in the Gardner–Fisher case, where p is odd, the values of equal . If we replace by , in the first calculation, then we expect that calculated value will equal Ttwstd[−1,2,5,9,2]. Typing in the values of the variables, we find that:
In[41]:= Ttwstd[1, 2, 5, 9, 7]
The value of T∧(1)−{9,2}(5,7) = ,
which is indeed the value of .
To compare the above results with a direct evaluation in Mathematica, one requires the following instruction:
TSum[sgn−, l−, m−, v−, r−]:= Sum[sgn∧ k Cos[2 k r Pi/(l m)] Csc[k Pi/(l m)]∧(2 v),
{k, 1, l m − 1}].
Since m is relatively small in this case, we can expect to obtain a solution in terms of powers of as occurred earlier when evaluating the non-alternating Dowker case directly. Typing in
In[42]:= TSum[1, 2, 5, 9, 7]
Out[42] = −1 +
,
while for , one finds
In[43]:= TSum[−1, 2, 5, 9, 7]
Out[43] = 1 +
.
As expected, the terms in powers of cancel and we are left with the rational values given above for the two types of Gardner–Fisher twisted trigonometric power sums.
Let us now consider the alternating Dowker case. First, we shall let m remain algebraic. For and , we obtain
Ttwstd[−1, 1, m, 9, 7]
The result below is not valid for odd values of m.
The value of T∧(−1)−{9,1}(m,7)=
With the same input values, TSum yields
In[44]:= TSum[−1, 1, m, 9, 7]
Out[44] = (164099126349380386816 + 102582597615353856000 m2 −
25076595103059935232 m4 − 17009755041717485568 m6 + 5735325325405777920 m8 −
660845938604656896 m10 + 33720173366174592 m12 − 734362169827104 m14 +
5390920619154 m16 − 5749691557 m18)/2554547108585472000.
This result is identical to the corresponding result immediately above it, since subtracting the results from each other yields zero. Because both forms are in a different format, this implies the methods used to determine them are also different.
If we set , then we find that Ttwstd prints out
Ttwstd[−1, 1, 5, 9, 2]
The value of T∧(−1)−{9,1}(5,2) = 0,
while if , then the module prints out
In[45]:= Ttwstd[−1, 1, 6, 9, 2]
The value of T∧(−1)−{9,1}(6,2) = −.
On the other hand, putting and in TSum[−1,1,m,9,2], one obtains zero and −5160022813/19683, respectively, confirming the results generated by Ttwstd.