3
$\begingroup$

This question already has an answer here:

Here is the sum:

$$\sum_{j=0}^{n-1}r^{a+b}\cos^a\left(\frac{2\pi j}{n}+t\right)\sin^b\left(\frac{2\pi j}{n}+t\right)$$

Code:

F[n_, a_, b_, r_, t_] := 
        Sum[r^(a + b)*Cos[2*Pi/n*j + t]^a*Sin[2*Pi/n*j + t]^b, {j, 0, n - 1}]

I do not expect it to have a simple formula for general n, but Mathematica gives this one:

F[n, 2, 2, r, t]

(n r^4)/8

The issue here is that the generic formula is incorrect. For example, the correct expression for n=4:

F[4, 2, 2, r, t]

4 r^4 Cos[t]^2 Sin[t]^2 

Why is an obviously wrong result generated in symbolic summation? Is it a bug or feature?

Would appreciate any help.

$\endgroup$

marked as duplicate by MarcoB, m_goldberg, Mr.Wizard Jul 28 '16 at 18:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ It looks to be a generically correct result: With[{a = 2, b = 2}, Table[FullSimplify[Sum[r^(a + b) Cos[2 π/n j + t]^a Sin[2 π/n j + t]^b, {j, 0, n - 1}]] == n r^4/8, {n, 20}]] $\endgroup$ – J. M. will be back soon Jul 28 '16 at 4:05
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! $\endgroup$ – Michael E2 Jul 28 '16 at 4:16
  • $\begingroup$ I am pretty sure that Sum[...] in LHS was reduced to incorrect formula first. So that this example just proves the issue. $\endgroup$ – Pavel Holoborodko Jul 28 '16 at 6:53
  • $\begingroup$ It's a correct result, except possibly on a set of zero measure. That's the meaning of "generically correct". Your case of interest happens to be the case where the formula does not work. $\endgroup$ – J. M. will be back soon Jul 28 '16 at 6:58
  • $\begingroup$ Actually it doesn't work in all cases when a and b are both even. $\endgroup$ – Pavel Holoborodko Jul 28 '16 at 6:59
6
$\begingroup$

I believe this will cast some light on the problem.

F[n_, a_, b_, r_, t_] :=
  r^(a + b)*
    Sum[Cos[2*Pi/n*j + t]^a*Sin[2*Pi/n*j + t]^b, {j, 0, n - 1}, 
      GenerateConditions -> True]

 F[n, 2, 2, r, t]

ConditionalExpression[(n r^4)/8, n ∈ Integers && 4/n ∉ Integers && n >= 1]

This tells us the general case (n r^4)/8 won't be valid for n = 4 as indeed it is not. In fact, the general expression fails for n = 1, 2 & 4 and is valid for all other positive integers.

$\endgroup$
  • $\begingroup$ Absolutely, thank you! $\endgroup$ – Pavel Holoborodko Jul 28 '16 at 7:09

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