5
$\begingroup$

By this post we know $$\sum\limits_{n=1}^\infty \frac{\sin(nx)}n = \frac{\pi-x}2\,,$$ when $x \in (0, 2\pi)\,.$

However,

Input:

Sum[Sin[n x]/n, {n, ∞}]
% ~ FullSimplify ~ (Assumptions -> 0 < x < 2 π && x ∈ Reals)

Output:

$\frac{1}{2} i \left(\log \left(1-e^{i x}\right)-\log \left(e^{-i x} \left(-1+e^{i x}\right)\right)\right)\\ \frac{1}{2} i \left(\log \left(1-e^{i x}\right)-\log \left(1-e^{-i x}\right)\right)$


Those above is not the form I want as $\frac{\pi -x}{2}\,.$

I have tried ComplexExpand and PowerExpand, but it seems no use.


How to get it?

Be grateful for any help!



Conclusion

@Michael gives the fantastic mathematical solution.

@Akku14 gives the "no thinking needed" way, e.g. below.


Examples

1. To solve $\displaystyle \sum\limits_{n=1}^\infty \frac{\sin(nx)}n\,,$

Input:

Sum[Sin[n x]/n, {n, ∞}];
% // Exp // #^(2/I) & // PowerExpand // FullSimplify // #^(I/2) & // Log // PowerExpand[#, Assumptions -> 0 <= x <= 2π] & // FullSimplify[#, 0 < x <= 2π] &

Output:

$\displaystyle \frac{\pi-x}{2}$

2. To solve $\displaystyle 2\pi n \int_0^{\frac\pi2} \frac1{\cos^2(x)+n^6\sin^2(x)}\,dx\,,$

Input:

2 n π Integrate[1/(Cos[x]^2 + n^6 Sin[x]^2), {x, 0, π/2}];
% // #^(2/I) & // #^(I/2) & // PowerExpand

Output:

$\displaystyle \frac{\pi^2}{n^2}$


3. Cyclotomic.

Input:

n = 5;
cy = Product[x - E^((2 π I k)/n), {k, Select[Range[n], CoprimeQ[#, n] &]}]

Output:

$\left(x-e^{-\frac{2i\pi}5}\right) \left(x-e^{\frac{2i\pi}5}\right) \left(x-e^{-\frac{4i\pi}5}\right) \left(x-e^{\frac{4i\pi}5}\right)$

Input:

Cyclotomic[n, x]

cy // Exp // FullSimplify // Log // PowerExpand    (*Method 1*)

Collect[cy, x, FullSimplify]                       (*Method 2*)

Same outputs:

$x^4+x^3+x^2+x+1$

$\endgroup$
  • 1
    $\begingroup$ Shouldn't a new question be an actual new question? $\endgroup$ – Goofy Oct 19 '17 at 0:26
5
$\begingroup$

The easiest way I've found is to apply the Fundamental Theorem of Calculus:

Integrate[Evaluate@D[Sum[Sin[n x]/n, {n, ∞}], x], {x, Pi, x}]

Another approach is to apply a trig. function, simplify, apply the inverse function, and simplify again. The problem here is that ArcTan and ArcCot both have ranges of -Pi/2 to Pi/2, which are not suitable for the solution. So we can translate the solution to the appropriate range, and then translate back:

(FullSimplify[
    Sum[Sin[n x]/n, {n, ∞}] /. x -> Pi - u // Tan // 
     TrigExpand
    ] // FullSimplify[ArcTan[#], -Pi < u < Pi] &) /. u -> Pi - x
(*  (π - x)/2  *)

There are other ways to tease out the answer, which have a mathematical fault even though they get the right answer. For instance:

Normal@Series[Sum[Sin[n x]/n, {n, ∞}], {x, Pi, 100}]

Sum[Sin[n x]/n, {n, ∞}] // Cot // TrigExpand // 
 FullSimplify[Pi/2 - ArcTan[#], -Pi < x < Pi] &
$\endgroup$
  • $\begingroup$ @user52778 The number Pi is in the interval 0 < x < 2 Pi and when the upper limit x == Pi, the answer should be zero. If you want a solution over a different interval, change the initial point (lower limit) to be the corresponding number in the interval. $\endgroup$ – Michael E2 Oct 10 '17 at 13:58
  • $\begingroup$ @ooo The "full easiest way" is $s(x) = s(a) + \int_a^x s'(t)\;dt$ (by the FTC), where I used $a = \pi$ and the fact that the sum $s(\pi)$ is obviously zero since all the terms are zero. Is that what you mean? Or are you worried about whether to pick the interval $(0, 2\pi)$ or some other one? (The FTC way works over any interval for which the sum $s(x)$ is differentiable. The intervals are clear from the result of Sum[], i.e. the endpoints are where $1-e^{ix} = 0$.) $\endgroup$ – Michael E2 Oct 10 '17 at 15:41
  • $\begingroup$ @ooo Do you mean applying the identity $\log z = \log |z| + i\,\arg z$ to the result of the sum to derive $(\pi -x)/2$? $\endgroup$ – Michael E2 Oct 10 '17 at 18:05
  • 1
    $\begingroup$ @ooo For the sum, use Euler's identity $\sin nx = (e^{inx} - e^{-inx})/(2i)$ to convert the sum into two log series $\log(1-u)=\sum u^n/n$, with $u = e^{ix}, e^{-ix}$. If you're unfamiliar with complex analysis, it might seem a little tough going. -- Ref for the complex log: en.wikipedia.org/wiki/Logarithm#Complex_logarithm -- Geometric pic for $\arg(1-e^{ix})=-(\pi-x)/2$: i.stack.imgur.com/HD6xE.png $\endgroup$ – Michael E2 Oct 11 '17 at 11:49
  • $\begingroup$ So you gave the "complex analysis" way to get the result directly, which far faster than the FTC method! Amazing to me! I'll remember this way. But what does it have to do with the FTC? Could you show me the whole calculation progress of FTC way? Thanks~♥ $\endgroup$ – ooo Oct 11 '17 at 13:32
2
$\begingroup$

Here another simple, quite mechanical way.

Straightforword apply operators that are suited to simplify the expression, simplify and later apply the inverse operator.

t1 = Sum[Sin[n x]/n, {n, \[Infinity]}]

(*      1/2 I (Log[1 - E^(I x)] - Log[E^(-I x) (-1 + E^(I x))])     *)

t2 = t1 // Exp

(*     E^(1/2 I (Log[1 - E^(I x)] - Log[E^(-I x) (-1 + E^(I x))]))     *)

t3 = t2 // FullSimplify

(*     (1 - E^(-I x))^(-(I/2)) (1 - E^(I x))^(I/2)     *)

t4 = t3 // #^(2/I) &

(*     ((1 - E^(-I x))^(-(I/2)) (1 - E^(I x))^(I/2))^(-2 I)     *)

t5 = t4 // PowerExpand[#, Assumptions -> 0 <= x <= 2 Pi] &

(*     E^(4 \[Pi] Floor[
    1/2 + Re[Log[1 - E^(-I x)]]/(4 \[Pi]) - Re[Log[1 - E^(I x)]]/(
    4 \[Pi])])/(1 - E^(-I x)) - E^(
    I x + 4 \[Pi] Floor[
    1/2 + Re[Log[1 - E^(-I x)]]/(4 \[Pi]) - Re[Log[1 - E^(I x)]]/(
    4 \[Pi])])/(1 - E^(-I x))     *)

t6 = t5 // FullSimplify[#, 0 <= x <= 2 Pi] &

(*     -E^(I x)     *)

t7 = t6 // #^(I/2) &

(*     (-E^(I x))^(I/2)     *)

t8 = t7 // PowerExpand[#, Assumptions -> 0 <= x <= 2 Pi] &

 (*     E^(-(\[Pi]/2) - x/2 - \[Pi] Floor[-(x/(2 \[Pi]))])     *)

t9 = t8 // FullSimplify[#, 0 <= x <= 2 Pi] &

(*     E^(-(\[Pi]/2) - x/2 + \[Pi] Ceiling[x/(2 \[Pi])])     *)

t10 = t9 // Log

(*     Log[E^(-(\[Pi]/2) - x/2 + \[Pi] Ceiling[x/(2 \[Pi])])]     *)

t11 = t10 // PowerExpand[#, Assumptions -> 0 <= x <= 2 Pi] &

(*     -(Pi/2) - x/2 + Pi Ceiling[x/(2 Pi)]     *)

t12 = t11 // FullSimplify[#, 0 < x <= 2 Pi] &

(*     (Pi - x)/2     *)
$\endgroup$
1
$\begingroup$

You may like to proceed as follows. Here is your expression:

expr1 = Simplify[Sum[Sin[n x]/n, {n, 1, \[Infinity]}], 0 < x < 2 \[Pi]]

(*  1/2 I (-Log[1 - E^(-I x)] + Log[1 - E^(I x)]) *)

Mma does not collect logarithms by itself. I use for this purpose the function entitled collectLog:

collectLog[expr_] := Module[{rule1a, rule1b, rule2, g, a, b, x},
   rule1a = Log[a_] + Log[b_] -> Log[a*b];
   rule1b = Log[a_] - Log[b_] -> Log[a/b];
   rule2 = x_*Log[a_] -> Log[a^x];
   g[x_] := x /. rule1a /. rule1b /. rule2;
   FixedPoint[g, expr]
   ];

It should be applied to the second element of the expression. Further the resulting subexpression is worth simplifying:

expr2 = MapAt[Simplify[collectLog[#]] &, expr1, {2}]

(*   1/2 I Log[-E^(I x)]  *)

Now Mma should be instructed that -1==E^I*Pi and that Log[E^a]==a:

expr2 /. -E^a_ -> E^(a + I*\[Pi]) /. Log[E^a_] -> a // Expand

(*  -(\[Pi]/2) - x/2  *)

Done.

Have fun!

$\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.