Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi}]~Table~{n, 10} // Timing
- {2.17188, {π, 2π, 3π, 4π, 5π, 6π, 7π, 8π, 9π, 10π}}
- Integrate[(Sin[n t/2]/Sin[t/2])^2, {t, 0, Pi},
- Assumptions -> n ∈ Integers] // Timing
- %[[-1]] ~ FunctionExpand ~ (Assumptions -> n ∈ Integers)
- % // FullSimplify
- -(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])
- 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]
- $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 π}} *)
- (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]} *)
- 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 π} *)
- (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} *)
Add Comment
Please, Sign In to add comment