# How to get Mathematica to simplify/refine a Polygamma expression of fractions

I got the following ugly ev[n] as the least complicated answer to a Fourier coefficient integral

      Integrate[Cos[t]*Sin [(2 n + 1)*t]/Sin[t], {t, 0, Pi/2}


But it refuses to refine /simplify further

 ev[n : _] =
Refine[FullSimplify[
1/4 (-1)^
n (4/(1 + 2 n) - PolyGamma[1/4 - n/2] + PolyGamma[3/4 - n/2] +
PolyGamma[1/4 + n/2] - PolyGamma[3/4 + n/2]), {n \[Element]
Integers, n > -1}], {n \[Element] Integers, n > -1}]


Just gives me the same thing back whereas

 FullSimplify[{ev[0], ev[1], ev[2], ev[3], ev[5]}]

{1, 5/3, 23/15, 167/105, 5471/3465}


evaluation gives simple fractions.Surely there must be some rational function of n that is a simplication of these PolyGamma's for integers. How do I get Mathematica to simplify to it?

Amazingly comprehensive beautiful answers. To those who have already put so much time into their answers I should have at least explainned this problem is the wingwise integral of the negative correction to wing circulation in first order lifting line theory for rectangular wing. Its suprising difficulty shows how hard it is to work lifting line theory through analytically.

Clear["Global*"]

int[n_] = Assuming[{Element[n, Integers], n > -1},
Integrate[Cos[t]*Sin[(2 n + 1)*t]/Sin[t], {t, 0, Pi/2}]]

(* 1/4 (-1)^n (4/(1 + 2 n) - PolyGamma[0, 1/4 - n/2] + PolyGamma[0, 3/4 - n/2] +
PolyGamma[0, 1/4 + n/2] - PolyGamma[0, 3/4 + n/2]) *)


Generating a sequence

seq = {#, int[#]} & /@ Range[0, 10] // FullSimplify

(* {{0, 1}, {1, 5/3}, {2, 23/15}, {3, 167/105}, {4, 491/315}, {5, 5471/3465}, {6,
70493/45045}, {7, 14191/9009}, {8, 1200229/765765}, {9, 22894441/
14549535}, {10, 22821511/14549535}} *)


Using FindSequenceFunction to find a closed-form for the sequence

int2[n_] = FindSequenceFunction[seq, n] // Simplify

(* (-2 (-1)^n + π + 2 n π +
2 (-1)^n (1 + 2 n) LerchPhi[-1, 1, 3/2 + n])/(2 + 4 n) *)


Checking that the functions are equivalent for a wider range of values for n

And @@ Table[int[n] == int2[n] // FullSimplify, {n, 0, 100}]

(* True *)


Consequently, the result is simplified to a single LerchPhi function rather than four PolyGamma functions.

DiscreteLimit[int2[n], n -> Infinity]

(* π/2 *)

nmax = 25;

DiscretePlot[int[n], {n, 0, nmax},
PlotRange -> All,
Epilog -> {Red, Dashed, Line[{{0, Pi/2}, {nmax, Pi/2}}]}]


Zooming in

DiscretePlot[int[n], {n, 0, nmax},
Epilog -> {Red, Dashed, Line[{{0, Pi/2}, {nmax, Pi/2}}]}]


One way is to use the OEIS. The first 4 denominators of ev[n] look like odd double factorials. Multipliying by that gives the OEIS sequence A167576. To be more precise the code

{1, 5, 23, 167, 1473, 16413, 211479, 3192975}/Range[1, 15, 2]!! // InputForm


returns

{1, 5/3, 23/15, 167/105, 491/315, 5471/3465, 70493/45045, 14191/9009}


which are the first 8 terms of your sequence.

The information in the entry gives a finite summation which Mathematica converts to LerchPhi[]. The final result after FullSimplify[] is:

ev[n] == (-1)^n LerchPhi[-1, 1, n + 3/2] - (-1)^n/(2 n + 1) + Pi/2


Here is the first data line from the OEIS

1,5,23,167,1473,16413,211479,3192975,54010305,1030249845,21566327895,


and here is a summation formula

a(n) = (-1)^(n)*(2*n-3)!!*((1)+(4*n-2)*sum((-1)^(k+n)/(2*k+1), k=0..n-1))


Note that (2 n - 1)!! are the "odd double factorials" OEIS sequence A001147. Also see Factorial2[2 n - 1]`.

• Sorry I don't see where (2 n - 1)!! appears or generally the relevance of these similiar OEIS but not identical to ev[n] sequences. – simon Feb 3 '19 at 0:40