###################################################################### ## TrigSums.txt Save this file as TrigSums.txt to use it, # # stay in the # ## same directory, get into Maple (by typing: maple ) # ## and then type: read TrigSums.txt # ## Then follow the instructions given there # ## # ## Written by Doron Zeilberger, Rutgers University , # ## DoronZeil at gmail dot com # ###################################################################### print(`Written: March 2022: tested for Maple 2020 `): print(): print(`This is TrigSums.txt, A Maple package`): print(`accompanying Jean-Paul Allouche and Doron Zeilberger's article: `): print(`" Human and automated approaches for finite trigonometric sums" `): print(): print(`The most current version is available on WWW at:`): print(` http://sites.math.rutgers.edu/~zeilberg/tokhniot/TrigSums.txt .`): print(`Please report all bugs to: DoronZeil at gmail dot com .`): print(): print(`For general help, and a list of the MAIN functions,`): print(` type "ezra();". For specific help type "ezra(procedure_name);" `): print(`For a list of the supporting functions type: ezra1();`): print(): with(orthopoly): ezraSp:=proc() if args=NULL then print(`The procedures for specific trig expressions are: ProveSp`): print(` `): else ezra(args): fi: end: ezra1:=proc() if args=NULL then print(`The SUPPORTING procedures are`): print(` CheckPni1, CheckPni2, CheckPniR1, CheckPniR2, CheckPni3, CheckPniR3, Eni1, Eni2, Eni3, Eni4, EniR1, EniR2, EniR3, EniR4, PniD1, PniD2, PniD3, PniD4, `): print(`PniR1seq,PniR2seq,PniR3seq, PniR3ChuMarini, PniR4seq, PniR3seqChuMarini`): print(`Unx, U1nx(n,x), U1Rnx(n,x) `): else ezra(args): fi: end: ezra:=proc() if args=NULL then print(` TrigSum.txt: A Maple package for explicit computation of certain trigonometric sums `): print(`The MAIN procedures are:`): print(` Paper1, Paper2, Paper3, Paper4, PaperR1, PaperR2, PaperR3, PaperR4, Pni1, Pni2, Pni3, Pni4, PniR1, PniR2, PniR3, PniR4, PniRv1, ProveProp10a, ProveProp10b `): elif nargs=1 and args[1]=CheckPni1 then print(`CheckPni1(N,A): checks Pni1(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=CheckPni2 then print(`CheckPni2(N,A): checks Pni2(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=CheckPni3 then print(`CheckPni3(N,A): checks Pni3(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=CheckPniR1 then print(`CheckPniR1(N,A): checks PniR1(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=CheckPniR2 then print(`CheckPniR2(N,A): checks PniR2(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=CheckPniR3 then print(`CheckPniR3(N,A): checks PniR3(n,i) for n from 1 to N and i from 1 to A`): elif nargs=1 and args[1]=Eni1 then print(`Eni1(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {sin(j*Pi/(2*n+1))^2,j=1..n)}. Try:`): print(`Eni1(n,1)`): elif nargs=1 and args[1]=Eni2 then print(`Eni2(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {sin((2*j+1)*Pi/(4*n))^2,j=1..n)}. Try:`): print(`Eni2(n,1)`): elif nargs=1 and args[1]=Eni3 then print(`Eni3(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {sin(j*Pi/(2*n))^2,j=1..n-1)}. Try:`): print(`Eni3(n,1)`): elif nargs=1 and args[1]=Eni4 then print(`Eni4(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {sin((2*j-1)*Pi/(2*(2*n+1)))^2,j=1..n)}. Try:`): print(`Eni4(n,1)`): elif nargs=1 and args[1]=EniR1 then print(`EniR1(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {1/sin(j*Pi/(2*n+1))^2,j=1..n)}. Try:`): print(`EniR1(n,3)`): elif nargs=1 and args[1]=EniR2 then print(`EniR2(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {1/sin((2*j+1)*Pi/(4*n))^2,j=1..n)}. Try:`): print(`EniR2(n,1)`): elif nargs=1 and args[1]=EniR3 then print(`EniR3(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {csc(j*Pi/(2*n))^2,j=1..n-1)}. Try:`): print(`EniR3(n,1)`): elif nargs=1 and args[1]=EniR4 then print(`EniR4(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {csc((2*j-1)*Pi/(2*(2*n+1)))^2,j=1..n)}. Try:`): print(`EniR4(n,1)`): elif nargs=1 and args[1]=Paper1 then print(`Paper1(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n+1))^(2*i),j=1..n)) for i from 1 to A`): print(`Note that it confirms that it equals to 1/4^i*binomial(2*i,i)*(n+1/2):`): elif nargs=1 and args[1]=Paper2 then print(`Paper2(A): A paper with explicit expressions of Sum(sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n)) for i from 1 to A`): print(`Note that it confirms that it equals to 1/2^(2*i-1)*binomial(2*i-1,i)*n:`): elif nargs=1 and args[1]=Paper3 then print(`Paper3(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n))^(2*i),j=1..n-1)) for i from 1 to A`): print(`Note that it confirms that it equals to 1/4^i*binomial(2*i,i)*n -1/2 `): elif nargs=1 and args[1]=Paper4 then print(`Paper4(A): A paper with explicit expressions of Sum(sin(Pi*(2*j-1)/(4*n+2))^(2*i),j=1..n)) for i from 1 to A`): elif nargs=1 and args[1]=PaperR1 then print(`PaperR1(A): A paper with explicit expressions of Sum(1/sin(Pi*j/(2*n+1))^(2*i),j=1..n)) for i from 1 to A. Try:`): print(`PaperR1(10):`): elif nargs=1 and args[1]=PaperR2 then print(`PaperR2(A): A paper with explicit expressions of Sum(1/sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n)) for i from 1 to A. Try:`): print(`PaperR2(10):`): elif nargs=1 and args[1]=PaperR3 then print(`PaperR3(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n))^(-2*i),j=1..n-1)) for i from 1 to A. Try:`): print(`PaperR3(10):`): elif nargs=1 and args[1]=PaperR4 then print(`PaperR4(A): A paper with explicit expressions of Sum(sin(Pi*(2*j-1)/(4*n+2))^(-2*i),j=1..n)) for i from 1 to A.Try:`): print(`PaperR4(10):`): elif nargs=1 and args[1]=Pni1 then print(`Pni1(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}. Try:`): print(`Pni1(n,1);`): elif nargs=1 and args[1]=Pni2 then print(`Pni2(n,i): The sum of the i-th powers of of {sin((2*k-1)*Pi/(4*n))^2,k=1..n}. Try:`): print(`Pni2(n,2);`): elif nargs=1 and args[1]=Pni3 then print(`Pni3(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n))^2,k=1..n-1}. Try:`): print(`Pni3(n,2);`): elif nargs=1 and args[1]=Pni4 then print(`Pni4(n,i): The sum of the i-th powers of of {sin((2*k-1)*Pi/(4*n+2))^2,k=1..n}. Try:`): print(`Pni4(n,2);`): print(` Paper1, Paper2, Paper3, PaperR1, PaperR2, PaperR3, Pni1, Pni2, Pni3, Pni4, PniR1, PniR2, PniR3, PniR4, PniRv1, ProveProp10a, ProveProp10b `): elif nargs=1 and args[1]=PniR1 then print(`PniR1(n,i): The sum of the i-th powers of of {1/sin(k*Pi/(2*n+1))^2,k=1..n}. Try:`): print(`PniR1(n,3);`): elif nargs=1 and args[1]=PniR1seq then print(`PniR1seq(n,N): The first N terms of sum of the i-th powers of of {1/sin(k*Pi/(2*n+1))^2,k=1..n}. Try:`): print(`PniR1seq(n,3);`): elif nargs=1 and args[1]=PniR2 then print(`PniR2(n,i): The sum of the i-th powers of of {1/sin((2*k-1)*Pi/(4*n))^2,k=1..n}. Try:`): print(`PniR2(n,3);`): elif nargs=1 and args[1]=PniR2seq then print(`PniR2seq(n,N): The first N terms of sum of the i-th powers of of {1/sin((2*k-1)*Pi/(4*n))^2,k=1..n}. Try:`): print(`PniR2seq(n,3);`): elif nargs=1 and args[1]=PniR3 then print(`PniR3(n,i): The sum of the i-th powers of of {csc(k*Pi/(2*n))^2,k=1..n-1}. Try:`): print(`PniR3(n,2);`): elif nargs=1 and args[1]=PniR3ChuMarini then print(`PniR3ChuMarini(n,i): The sum of the i-th powers of of {csc(k*Pi/(2*n))^2,k=1..n-1}. Try:`): print(`PniR3ChuMarini(n,2);`): elif nargs=1 and args[1]=PniR3seq then print(`PniR3seq(n,N): The first N terms of the sum of the i-th powers of of {csc(k*Pi/(2*n))^2,k=1..n-1}. Try:`): print(`PniR3seq(n,2);`): elif nargs=1 and args[1]=PniR3seqChuMarini then print(`PniR3seqChuMarini(n,N): The first N terms of the sum of the i-th powers of of {csc(k*Pi/(2*n))^2,k=1..n-1}. According to the nice generating function given by`): print(` Chu and Marini,Partial Fractions and Trigonometric Identities,Advances in Applied Mathematics 23 (1999), 115--175 1999. Try:`): print(`PniR3seqChuMarini(n,2);`): elif nargs=1 and args[1]=PniR4 then print(`PniR4(n,i): The sum of the i-th powers of of {csc((2*k-1)*Pi/(4*n+2))^2,k=1..n}. Try:`): print(`PniR4(n,2);`): elif nargs=1 and args[1]=PniR4seq then print(`PniR4seq(n,N): The first N terms of the sum of the i-th powers of of {csc((2*k-1)*Pi/(4*n+2))^2,k=1..n}. Try:`): print(`PniR4seq(n,10);`): elif nargs=1 and args[1]=PniRv1 then print(`PniRv1(n,i): A verbose form of PniR1(n,i). Try:`): print(`PniRv1(n,3);`): elif nargs=1 and args[1]=PniD1 then print(`PniD1(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}, done directly for NUMERIC n. Just for checking`): print(`PniD1(5,1);`): elif nargs=1 and args[1]=PniD2 then print(`PniD2(n,i): The sum of the i-th powers of of {sin((2*k+1)*Pi/(4*n))^2,k=1..n}, done directly for NUMERIC n. Just for checking`): print(`PniD2(5,1);`): elif nargs=1 and args[1]=PniD3 then print(`PniD3(n,i): The sum of the i-th powers of of {sin((k*Pi/(2*n))^2,k=1..n-1}, done directly for NUMERIC n. Just for checking`): print(`PniD3(5,1);`): elif nargs=1 and args[1]=PniD4 then print(`PniD4(n,i): The sum of the i-th powers of of {sin(((2*k-1)*Pi/(4*n+2))^2,k=1..n}, done directly for NUMERIC n. Just for checking`): print(`PniD4(5,1);`): elif nargs=1 and args[1]=ProveProp10a then print(`ProveProp10a(): Computer-proof of the first part of Proposition 10 of the paper: Type:`): print(`ProveProp10a();`): elif nargs=1 and args[1]=ProveProp10b then print(`ProveProp10b(): Computer-proof of the second part of Proposition 10 of the paper: Type:`): print(`ProveProp10b();`): elif nargs=1 and args[1]=ProveSp then print(`ProveSp(): A bunch of examples taken from out paper and the the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita. Type:`): print(`ProveSp();`): elif nargs=1 and args[1]=Unx then print(`Unx(n,x): U_{2*n+1}(sqrt(x))/sqrt(x), where U_m(x) is the m-th Chebychev polynomial of the SECOND kind. Try: `): print(`Unx(5,x);`): elif nargs=1 and args[1]=U1nx then print(`U1nx(n,x): The polynomial Unx(1-x), normalized to have leading coefficient 1. Try: `): print(`U1nx(4,x)`): elif nargs=1 and args[1]=U1Rnx then print(` U1Rnx(n,x): x^n*U1nx(n,1/x) normalized to have leading coeff. 1. Try:`): print(`U1Rnx(5,x);`): else print(`There is no such thing as`, args): fi: end: #Unx(n,x): U_{2*n+1}(sqrt(x))/sqrt(x) Unx:=proc(n,x) local k: add((-1)^(n-k)*binomial(n+k,2*k)*4^k*x^k,k=0..n): end: Eni1:=proc(n,k1) local k: factor(expand(subs(k=k1,(-1)^(2*k)*4^(-k)*(2*n-k)!/k!/(2*n-2*k+1)!*(2*n+1)))): end: #Pni1(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}. Try: #Pni1(n,1); Pni1:=proc(n,i) local i1: option remember: if i=1 then Eni1(n,i): else factor((-1)^(i-1)*i*Eni1(n,i)+add((-1)^(i-1+i1)*Pni1(n,i1)*Eni1(n,i-i1),i1=1..i-1)): fi: end: #PniD1(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}, done directly for numeric n. Just for checking #PniD1(n,1); PniD1:=proc(n,i) local k2: simplify(add(sin(k2*Pi/(2*n+1))^(2*i),k2=1..n)): end: #EniR1(n,i): The polynomial in n that gives you the i-th elementary symmetric function of {1/sin(j*Pi/(2*n+1))^2,j=1..n)}. Try: #EniR1(n,1) EniR1:=proc(n,k1) local k: factor(expand((-1)^k1*subs(k=k1,(-1)^(-k)*(n+k)!/(n-k)!/(2*k+1)!*4^k))): end: #PniR1(n,i): The sum of the i-th powers of of {1/sin(k*Pi/(2*n+1))^2,k=1..n}. Try: #PniR1(n,1); PniR1:=proc(n,i) local i1: option remember: if i=1 then EniR1(n,i): else factor((-1)^(i-1)*i*EniR1(n,i)+add((-1)^(i-1+i1)*PniR1(n,i1)*EniR1(n,i-i1),i1=1..i-1)): fi: end: #CheckPniR1(N,A): checks PniR1(n,i) for n from 1 to N and i from 1 to A CheckPniR1:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=PniR1(n,i): print([seq(evalf(subs(n=n1,gu)-PniD1(n1,-i)),n1=1..N)]): od: end: #CheckPni1(N,A): checks Pni1(n,i) for n from 1 to N and i from 1 to A CheckPni1:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=Pni1(n,i): print([seq(evalf(subs(n=n1,gu)-PniD1(n1,i)),n1=trunc((i+1)/2)..N)]): od: end: #PniRv1(n,i): A verbose form of PniR1(n,i) PniRv1:=proc(n,i) local gu,j: gu:=PniR1(n,i): print(`An evaluation of `, Sum(1/sin(Pi*j/(2*n+1))^(2*i),j=1..n)): print(``): print(`By Shalosh B. Ekhad `): print(`Theorem :` , Sum(1/sin(Pi*j/(2*n+1))^(2*i),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): end: #PaperR1(A): A paper with explicit expressions of Sum(1/sin(Pi*j/(2*n+1))^(2*i),j=1..n)) for i from 1 to A PaperR1:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(1/sin(Pi*j/(2*n+1))^(2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): for i1 from 1 to A do gu:=PniR1(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: `, Sum(1/sin(Pi*j/(2*n+1))^(2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: #Paper1(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n+1))^(2*i),j=1..n)) for i from 1 to A Paper1:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*j/(2*n+1))^(2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(`Comment: It can be easily shown that for each positive integer i`): print(Sum(sin(Pi*j/(2*n+1))^(2*i),j=1..n)= 1/4^i*binomial(2*i,i)*(n+1/2)): print(``): print(`This paper confirms it, via a different method for i from 1 to`, A): for i1 from 1 to A do gu:=Pni1(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: for n>=`,trunc((i1+1)/2), `we have :`, Sum(sin(Pi*j/(2*n+1))^(2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: ez:=proc(): print(` Check10a(k) , ProveProp10a(), ProveProb10b() `):end: #Prop. 10 #ProveProp10a(): Computer-proof of the first part of Proposition 10 of the paper ProveProp10a:=proc() local k,z,j,L,R,gu,w: assume(k,integer): #z:=exp(I*Pi/(8*k+2)) L:=sum((-1)^j* ( (z^(2*j+1)-1/z^(2*j+1))/2/I )^2, j=0..2*k-1): R:=-((z^(4*k)-1/z^(4*k))/(2*I))^2/(z^2+1/z^2): gu:=expand(numer(normal(L-R))): gu:=subs(z=w^(1/(8*k+2)),gu): evalb(simplify(gu)=0): end: #ProveProp10b(): Computer-proof of the second part of Proposition 10 of the paper ProveProp10b:=proc() local k,z,j,L,R,gu,w: assume(k,integer): #z:=exp(I*Pi/(8*k+6)) L:=sum((-1)^j* ( (z^(2*j+1)-1/z^(2*j+1))/2/I )^2, j=0..2*k): R:=1/2-((z^(4*k+2)+1/z^(4*k+2))/2)^2/(z^2+1/z^2): gu:=expand(numer(normal(L-R))): gu:=subs(z=w^(1/(8*k+6)),gu): evalb(simplify(gu)=0): end: ##start Sum(sin(Pi*(2*j+1)/(4*n))^2,j=1..n) based on the T_{2n}(sqrt(x)) #PniD2(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}, done directly for numeric n. Just for checking #PniD2(n,1); PniD2:=proc(n,i) local k2: simplify(add(sin((2*k2-1)*Pi/(4*n))^(2*i),k2=1..n)): end: Eni2:=proc(n,k1) local k: factor(expand(subs(k=k1,2*4^(-k)*(2*n-k-1)!/k!/(2*n-2*k)!*n))): end: EniR2:=proc(n,k1) local k: factor(expand(subs(k=k1,n*(n+k-1)!*4^k/((n-k)!*(2*k)!)))): end: #Pni2(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}. Try: #Pni2(n,1); Pni2:=proc(n,i) local i1: option remember: if i=1 then Eni2(n,i): else factor((-1)^(i-1)*i*Eni2(n,i)+add((-1)^(i-1+i1)*Pni2(n,i1)*Eni2(n,i-i1),i1=1..i-1)): fi: end: #CheckPni2(N,A): checks Pni2(n,i) for n from 1 to N and i from 1 to A CheckPni2:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=Pni2(n,i): print([seq(evalf(subs(n=n1,gu)-PniD2(n1,i)),n1=trunc(i/2)+1..N)]): od: end: #PniR2(n,i): The sum of the i-th powers of of {1/sin(k*Pi/(2*n+1))^2,k=1..n}. Try: #PniR2(n,1); PniR2:=proc(n,i) local i1: option remember: if i=1 then EniR2(n,1): else factor((-1)^(i-1)*i*EniR2(n,i)+add((-1)^(i-1+i1)*PniR2(n,i1)*EniR2(n,i-i1),i1=1..i-1)): fi: end: #CheckPniR2(N,A): checks PniR2(n,i) for n from 1 to N and i from 1 to A CheckPniR2:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=PniR2(n,i): print([seq(evalf(subs(n=n1,gu)-PniD2(n1,-i)),n1=1..N)]): od: end: #Paper2(A): A paper with explicit expressions of Sum(sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n)) for i from 1 to A Paper2:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(`Comment: It can be easily shown that for each positive integer i`): print(Sum(sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n-1)= 1/2^(2*i-1)*binomial(2*i-1,i)*n): print(``): print(`This paper confirms it directly for i from 1 to `, A): for i1 from 1 to A do gu:=Pni2(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: for n>=`,trunc((i1+2)/2), `we have :`, Sum(sin(Pi*(2*j-1)/(4*n))^(2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: #PaperR2(A): A paper with explicit expressions of Sum(1/sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n)) for i from 1 to A PaperR2:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(1/sin(Pi*(2*j-1)/(4*n))^(2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): for i1 from 1 to A do gu:=PniR2(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: `, Sum(1/sin(Pi*(2*j-1)/(4*n))^(2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: ##End Sum(sin(Pi*(2*j+1)/(4*n))^2,j=1..n) based on the T_{2n}(sqrt(x)) ##start Sum(sin(Pi*j/(2*n))^2,j=1..n-1) based on the degree n-1 polynomial U_{2n-1}(sqrt(x))/sqrt(x) #PniD3(n,i): The sum of the i-th powers of of {sin(k*Pi/(2*n+1))^2,k=1..n}, done directly for numeric n. Just for checking #PniD3(n,1); PniD3:=proc(n,i) local k2: simplify(add(sin(k2*Pi/(2*n))^(2*i),k2=1..n-1)): end: Eni3:=proc(n,k1) local gu,k: factor(expand(subs(k=k1,4^(-k)*(2*n-k-1)!/(2*n-2*k-1)!/k!))): end: EniR3:=proc(n,k1) local gu,k: factor(expand(simplify(subs(k=k1,4^k*(n+k)!/(2*k+1)!/(n-k-1)!/n!*(n-1)!)))): end: #Pni3(n,i): The sum of the i-th powers of of {sin(j*Pi/(2*n))^2,j=1..n-1}. Try: #Pni3(n,1); Pni3:=proc(n,i) local i1: option remember: if i=1 then Eni3(n,i): else factor((-1)^(i-1)*i*Eni3(n,i)+add((-1)^(i-1+i1)*Pni3(n,i1)*Eni3(n,i-i1),i1=1..i-1)): fi: end: #CheckPni3(N,A): checks Pni3(n,i) for n from 1 to N and i from 1 to A CheckPni3:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=Pni3(n,i): print([seq(evalf(subs(n=n1,gu)-PniD3(n1,i)),n1=trunc(i/2)+1..N)]): od: end: #PniR3(n,i): The sum of the i-th powers of of {1/sin(k*Pi/(2*n+1))^2,k=1..n}. Try: #PniR3(n,1); PniR3:=proc(n,i) local i1: option remember: if i=1 then EniR3(n,1): else factor((-1)^(i-1)*i*EniR3(n,i)+add((-1)^(i-1+i1)*PniR3(n,i1)*EniR3(n,i-i1),i1=1..i-1)): fi: end: #CheckPniR3(N,A): checks PniR2(n,i) for n from 1 to N and i from 1 to A CheckPniR3:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=PniR3(n,i): print([seq(evalf(subs(n=n1,gu)-PniD3(n1,-i)),n1=1..N)]): od: end: #Paper3(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n))^(2*i),j=1..n-1)) for i from 1 to A Paper3:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*j/(2*n))^(2*i),j=1..n-1) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(`Comment: It can be easily shown that for each positive integer i`): print(Sum(sin(Pi*j/(2*n))^(2*i),j=1..n-1)=binomial(2*i,i)/4^i*n-1/2): print(``): print(`This paper confirms it directly for i from 1 to `, A): print(``): for i1 from 1 to A do gu:=Pni3(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: for n>=`,trunc((i1+2)/2), `we have :`, Sum(sin(Pi*j/(2*n))^(2*i1),j=1..n-1)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: #PaperR3(A): A paper with explicit expressions of Sum(sin(Pi*j/(2*n))^(-2*i),j=1..n-1)) for i from 1 to A PaperR3:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*j/(2*n))^(-2*i),j=1..n-1) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(``): for i1 from 1 to A do gu:=PniR3(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1,` we have :`, Sum(sin(Pi*j/(2*n))^(-2*i1),j=1..n-1)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: ##End Sum(sin(Pi*j/(2*n))^2,j=1..n-1) based on the degree n-1 polynomial U_{2n-1}(sqrt(x))/sqrt(x) ##start Sum(sin(Pi*(2*j-1)/(2*(2*n+1)))^2,j=1..n) based on the degree n polynomial U_{2n}(sqrt(x)) #PniD4(n,i): The sum of the i-th powers of of {sin((2*k-1)*Pi/(2*(2*n+1))^2,k=1..n}, done directly for numeric n. Just for checking #PniD4(n,1); PniD4:=proc(n,i) local k2: simplify(add(sin((2*k2-1)*Pi/(2*n+1)/2)^(2*i),k2=1..n)): end: Eni4:=proc(n,k1) local gu,k: factor(expand(simplify(subs(k=k1,4^(-k)*(2*n-k)!/(2*n-2*k)!/k!)))): end: EniR4:=proc(n,k1) local k: factor(expand(subs(k=k1,(n+k)!/(2*k)!/(n-k)!*4^k))): end: #Pni4(n,i): The sum of the i-th powers of of {sin((2*j-1)*Pi/(4*n+2))^2,j=1..n}. Try: #Pni4(n,1); Pni4:=proc(n,i) local i1: option remember: if i=1 then Eni4(n,i): else factor((-1)^(i-1)*i*Eni4(n,i)+add((-1)^(i-1+i1)*Pni4(n,i1)*Eni4(n,i-i1),i1=1..i-1)): fi: end: #CheckPni4(N,A): checks Pni4(n,i) for n from 1 to N and i from 1 to A CheckPni4:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=Pni4(n,i): print([seq(evalf(subs(n=n1,gu)-PniD4(n1,i)),n1=trunc(i/2)+1..N)]): od: end: #PniR4(n,i): The sum of the i-th powers of of {csc((2*j-1)*Pi/(4*n+2))^2,j=1..n}. Try: #PniR4(n,2); PniR4:=proc(n,i) local i1: option remember: if i=1 then EniR4(n,i): else factor((-1)^(i-1)*i*EniR4(n,i)+add((-1)^(i-1+i1)*PniR4(n,i1)*EniR4(n,i-i1),i1=1..i-1)): fi: end: #CheckPniR4(N,A): checks PniR4(n,i) for n from 1 to N and i from 1 to A CheckPniR4:=proc(N,A) local n,n1,i,gu: for i from 1 to A do gu:=PniR4(n,i): print([seq(evalf(subs(n=n1,gu)-PniD4(n1,-i)),n1=1..N)]): od: end: #Paper4(A): A paper with explicit expressions of Sum(sin(Pi*(2*j-1)/(4*n+2))^(2*i),j=1..n)) for i from 1 to A Paper4:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*(2*j-1)/(4*n+2))^(2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(``): print(`Comment: It can be easily shown that for each positive integer i`): print(Sum(sin(Pi*(2*j-1)/(4*n+2))^(2*i),j=1..n)=binomial(2*i,i)/(4^i)*n+binomial(2*i-1,i)/(4^i)-1/2): print(``): print(`This paper confirms it directly for i from 1 to `, A): print(``): for i1 from 1 to A do gu:=Pni4(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: for n>=`,trunc((i1+2)/2), `we have :`, Sum(sin(Pi*(2*j-1)/(4*n+2))^(2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: #PaperR4(A): A paper with explicit expressions of Sum(csc(Pi*(2*j-1)/(4*n+2))^(2*i),j=1..n)) for i from 1 to A PaperR4:=proc(A) local n,i,gu,j,t0,i1: t0:=time(): print(` evaluations of `, Sum(sin(Pi*(2*j-1)/(4*n+2))^(-2*i),j=1..n) , `for i from 1 to `, A): print(``): print(`By Shalosh B. Ekhad `): print(``): for i1 from 1 to A do gu:=PniR4(n,i1): print(``): print(`------------------------------`): print(``): print(`Theorem `,i1, `: for n>=1, we have :`, Sum(sin(Pi*(2*j-1)/(4*n+2))^(-2*i1),j=1..n)=gu): print(``): print(`and in Maple notation: `): print(``): lprint(gu): print(``): od: print(`------------------------------`): print(``): print(`This ends this book that took`, time()-t0, `seconds to generate `): end: #Start specific #ProveSp(): A bunch of examples taken from out paper and the the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita. Type: #ProveSp(); ProveSp:=proc() local f,t0: t0:=time(): print(`Maple proofs for some specific identities proved in `): print(`the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita. Palestinian J. of Mathematics 11(1)(2022), 130-134`): print(``): print(`First as a warm-up, this is the identity at the bottom of p.1 of the Allouche-Zeilberger paper`): f:=sin(3*Pi/7)^2/sin(2*Pi/7)-sin(2*Pi/7)^2/sin(Pi/7)+sin(Pi/7)^2/sin(3*Pi/7): print(``): print(f , ` equals `, simplify(f)): print(``): print(`This is the identity (1.1) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:=sin(2*Pi/7)/sin(Pi/7)-sin(3*Pi/7)/sin(2*Pi/7)+sin(Pi/7)/sin(3*Pi/7): print(f , ` equals `, simplify(f)): print(`This is the identity (1.2) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita. Palestinian J. Math. 11(1)(2022), 130-134`): print(``): f:=sin(Pi/7)/sin(2*Pi/7)-sin(2*Pi/7)/sin(3*Pi/7)+sin(3*Pi/7)/sin(Pi/7): print(f , ` equals `, simplify(f)): print(`This is the identity (1.3) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:=sin(4*Pi/13)/sin(2*Pi/13)-sin(6*Pi/13)/sin(3*Pi/13)-sin(2*Pi/13)/sin(Pi/13)+sin(5*Pi/13)/sin(4*Pi/13)-sin(3*Pi/13)/sin(5*Pi/13)+sin(Pi/13)/sin(6*Pi/13): print(f , ` equals `, simplify(f)): print(`This is the identity (1.4) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(4*Pi/13)*sin(6*Pi/13)/sin(2*Pi/13)/sin(3*Pi/13) -sin(2*Pi/13)*sin(3*Pi/13)/sin(Pi/13)/sin(5*Pi/13) -sin(5*Pi/13)*sin(Pi/13)/sin(4*Pi/13)/sin(6*Pi/13): print(f , ` equals `, simplify(f)): print(`This is the identity (1.5) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(2*Pi/13)*sin(3*Pi/13)/sin(4*Pi/13)/sin(6*Pi/13) -sin(Pi/13)*sin(5*Pi/13)/sin(2*Pi/13)/sin(3*Pi/13) -sin(4*Pi/13)*sin(6*Pi/13)/sin(5*Pi/13)/sin(Pi/13): print(f , ` equals `, simplify(f)): print(`This is the identity (1.6) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(6*Pi/13)*sin(2*Pi/13)*sin(5*Pi/13)/sin(3*Pi/13)/sin(Pi/13)/sin(4*Pi/13) -sin(4*Pi/13)*sin(3*Pi/13)*sin(Pi/13)/sin(2*Pi/13)/sin(5*Pi/13)/sin(6*Pi/13): print(f , ` equals `, simplify(f)): print(`This is the identity (1.7) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(2*Pi/15)/sin(Pi/15)-sin(7*Pi/15)/sin(4*Pi/15)-sin(3*Pi/15)/sin(6*Pi/15): print(f , ` equals `, simplify(f)): print(`This is the identity (1.8) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(6*Pi/17)/sin(3*Pi/17)-sin(4*Pi/17)/sin(2*Pi/17)-sin(8*Pi/17)/sin(4*Pi/17)+sin(2*Pi/17)/sin(Pi/17) +sin(7*Pi/17)/sin(5*Pi/17)-sin(5*Pi/17)/sin(6*Pi/17)+sin(3*Pi/17)/sin(7*Pi/17)-sin(Pi/17)/sin(8*Pi/17): print(f , ` equals `, simplify(f)): print(`This is the identity (1.9) of the paper "Non-trivial trigonometric sums arising from some of Ramanujan theta function identities" by G. Vinay, H.T. Shwetha and K.N. Harhita.`): print(``): f:= sin(6*Pi/17)*sin(7*Pi/17)/(sin(3*Pi/17)*sin(5*Pi/17)) +sin(4*Pi/17)*sin(Pi/17)/(sin(2*Pi/17)*sin(8*Pi/17)) -sin(8*Pi/17)*sin(2*Pi/17)/(sin(4*Pi/17)*sin(Pi/17)) -sin(5*Pi/17)*sin(3*Pi/17)/(sin(6*Pi/17)*sin(7*Pi/17)): print(f , ` equals `, simplify(f)): print(``): print(`----------------------------------------`): print(``): print(`This took`, time()-t0 , `seconds. `): end: #PniR1seq(n,K): PniR1seq:=proc(n,K) local k: [seq(PniR1(n,k),k=1..K)]: end: #PniR2seq(n,K): PniR2seq:=proc(n,K) local k: [seq(PniR2(n,k),k=1..K)]: end: #PniR3seq(n,K): PniR3seq:=proc(n,K) local k: [seq(PniR3(n,k),k=1..K)]: end: #PniR4seq(n,K): PniR4seq:=proc(n,K) local k: [seq(PniR4(n,k),k=1..K)]: end: #PniR3seq1ChuMarini(n,K): PniR3seqChuMarini:=proc(n,K) local k,f,y: f:=1-2*n*y/sqrt(1-y^2)*cot(2*n*arcsin(y)): f:=taylor(f,y=0,2*K+7): factor([seq(expand((coeff(f,y,2*k)-1)/2),k=1..K)]): end: PniR3ChuMarini:=proc(n,k) local m,f,r: f:= -1/2*add( (-4)^k/(2*n)^m*binomial(1+2*k,1+m)* add( (-1)^r*binomial(1+m,r)* (1+m-2*r)/(1+m) *binomial(k+r*2*n+(m-1)/2,2*k+m), r=0..1+m), m=0..2*k) : factor(expand((f-1)/2)): end: