3
$\begingroup$

Integrate the Fejér kernel from 0 to $\pi\,,$ will get $\pi\,,$ which can be written as

$$\int_0^\pi \left( \frac{\sin(nt/2)}{\sin(t/2)} \right)^2 \,dt = n\pi$$

We can simply verify the equation by

Input:

Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi}]~Table~{n, 10} // Timing

Output:

{2.17188, {π, 2π, 3π, 4π, 5π, 6π, 7π, 8π, 9π, 10π}}


Now let's do the formal calculation with the bizarre MMA.

Input:

Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi}, 
Assumptions -> n ∈ Integers] // Timing
%[[-1]] ~ FunctionExpand ~ (Assumptions -> n ∈ Integers)
% // FullSimplify

The last one of Out[1]:

-(1/2) I E^(-I n π) (1 + E^(2 I n π) + 
2 E^(I n π) n π Cot[n π] + n PolyGamma[0, 1/2 - n/2] - 
n PolyGamma[0, -(n/2)] + E^(2 I n π) n PolyGamma[0, n/2] - 
E^(2 I n π) n PolyGamma[0, (1 + n)/2])

Question (All Solved ✅)

Q1. What is the approach to get rid of these complicated outputs? Or how to simplify them into $n\pi$?

Q2. Why it take so long to calculate? Any accelerate method? (Solved by @bob-hanlon and @akku14)

Many thanks!

P.S. FindSequenceFunction is pointless.


Solution of Q1

f[e_] := Count[e, _PolyGamma, Infinity]
Integrate[(Sin[n t/2]/Sin[t/2])^2 // TrigReduce, {t, 0, Pi}]
FullSimplify[%, ComplexityFunction -> f]
FullSimplify[%, n ∈ Integers]

(Chance encounter in 2017-12-31 15:00, when reading the penultimate one in this topic in the official document~)

$\endgroup$
  • 1
    $\begingroup$ FindSequenceFunction[ Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi}]~Table~{n, 10}, n] $\endgroup$ – Bob Hanlon Oct 19 '17 at 1:52
  • 1
    $\begingroup$ Note that the integral can be reformulated in terms of the Chebyshev polynomial of the second kind (ChebyshevU[]). $\endgroup$ – J. M. will be back soon Oct 31 '17 at 8:09
  • 1
    $\begingroup$ Table[2 Integrate[(ChebyshevU[n - 1, Cos[t]])^2, {t, 0, Pi/2}], {n, 10}] $\endgroup$ – J. M. will be back soon Mar 10 '18 at 1:31
  • $\begingroup$ @J.M. Thanks for the knowledge, though Mma doesn't perform symbolic computation for this. 😂 $\endgroup$ – ooo Mar 10 '18 at 16:03
1
$\begingroup$

This addresses the request for an acceleration method.

$Version

(* "11.2.0 for Mac OS X x86 (64-bit) (September 11, 2017)" *)

Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi}]~
  Table~{n, -5, 5} // AbsoluteTiming

(* {0.684515, {5 π, 4 π, 3 π, 2 π, π, 0, π, 2 π, 3 π, 4 π, 5 π}} *)

Note that the integrals are Abs[n] π rather than n π

You can accelerate the integration for general n using TrigReduce

(int[n_] = 
   Integrate[(Sin[n t/2]/Sin[t/2])^2 // TrigReduce, {t, 0, Pi}] // 
       ComplexExpand // FullSimplify // FunctionExpand // 
    FullSimplify) // AbsoluteTiming

(* {12.12901, (1/2)*(2 + n*Pi*Cot[(n*Pi)/2] - 
        n*(PolyGamma[0, 1/2 - n/2] - 2*PolyGamma[0, n/2] + 
             PolyGamma[0, (1 + n)/2]))*Sin[n*Pi]} *)

This representation is Indeterminate for integer n; however, the limits provide the expected results.

int[1]

(* Infinity::indet: Indeterminate expression 0 ComplexInfinity encountered.

Indeterminate *)

Table[Limit[int[n], n -> m], {m, -5, 5}]

(* {5 π, 4 π, 3 π, 2 π, π, 0, π, 2 π, 3 π, 4 π, 5 π} *)
$\endgroup$
1
$\begingroup$

Apply TrigReduce to the integrand an you get the integral quite fast. For unknown reasons the integral has singularities at n, therefore apply Limit.

(int[n_] = Integrate[(Sin[n t/2]/Sin[t/2])^2 // TrigReduce, {t, 0, Pi}, 
                      Assumptions -> n \[Element] Integers && n > 0]) // Timing

(*     {10.094, -(1/2)
   I E^(-I n \[Pi]) (1 + 2 E^(I n \[Pi]) n \[Pi] Cot[n \[Pi]] + 
   n PolyGamma[0, 1/2 - n/2] - n PolyGamma[0, -(n/2)] + 
   E^(2 I n \[Pi]) (1 + n PolyGamma[0, n/2] - 
   n PolyGamma[0, (1 + n)/2]))}     *)

Table[Limit[int[n], n -> j] // FullSimplify, {j, 0, 10}]

(*     {0, Pi, 2 Pi, 3 Pi, 4 Pi, 5 Pi, 6 Pi, 7 Pi, 
         8 Pi, 9 Pi, 10 Pi}     *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.