Re: Assuming non-integer values in Mathematica simplifications
- To: mathgroup at smc.vnet.net
- Subject: [mg71094] Re: Assuming non-integer values in Mathematica simplifications
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Wed, 8 Nov 2006 06:14:40 -0500 (EST)
- Organization: The Open University, Milton Keynes, UK
- References: <eihm5b$ou6$1@smc.vnet.net>
vladimir wrote: > I just started using Mathematica. I need to simplify the following expressions assuming that w/Pi is not integer (see below). I used the command Element(w/Pi,Rationals] and Element[w/Pi,Reals], but I still get the answer containing If(w/Pi is Integers ...) in many places, making it difficult to extract the answer for non-integer w/Pi. It seems that the simplification commands in Mathematica do not listen to the assumption statements even when such a statement is given within the simplification command. Does anybody know how to tell Mathematice to stop evaluating the integer cases? Thanks in advance. > > Here is my expression: Surely, what Mathematic cannot do is reading your mind! FullSimplify *does* take in account the assumptions you gave; however, contrary to what you seem to believe, these assumptions does *not* -- and have *no* reason to -- exclude integer solutions. In standard mathematics, an integer *is* a rational. The set of rational numbers Q is equal to {x = p/q | p and q are integers and q != 0}. Therefore, every natural number {1, 2, 3, ... } is a rational, zero is a rational, every negative integer is a rational (and also a real, and also a complex). > FullSimplify[(Sum[1, {k, 0, n - 1}]*Sum[ > Cos[w*k]*Sin[w*k], {k, 0, n - 1}]*Sum[Sin[w*k]*x[k], {k, > 0, n - 1}] - Sum[1, {k, 0, n - 1}]*Sum[Cos[w*k]*x[ > k], {k, 0, n - 1}]*Sum[Sin[w*k]^2, {k, > 0, n - 1}] - Sum[Cos[w*k], {k, 0, > n - 1}]*Sum[Sin[w*k], {k, 0, n - 1}]*Sum[Sin[w*k]*x[ > k], {k, 0, n - 1}] - Sum[Cos[w*k]*Sin[w*k], {k, 0, n - 1}]* > Sum[Sin[w*k], {k, 0, n - 1}]*Sum[x[k], {k, 0, n - 1}] + Sum[Cos[w* > k], {k, 0, n - 1}]*Sum[x[k], {k, 0, n - 1}]*Sum[Sin[w*k]^2, {k, 0, > n - 1}] + Sum[Cos[w* > k]*x[k], {k, > 0, n - 1}]*Sum[Sin[w*k], {k, 0, n - 1}]^2)/(-2*Sum[Cos[ > w*k], {k, 0, n - 1}]*Sum[Sin[w* > k], {k, 0, n - 1}]*Sum[Cos[w*k]*Sin[w*k], {k, 0, > n - 1}] + Sum[Sin[w*k], {k, 0, > n - 1}]^2*Sum[Cos[w*k]^2, {k, 0, n - 1}] + Sum[Cos[w*k]* > Sin[w*k], {k, 0, n - 1}]^2*Sum[1, {k, 0, n - 1}] + Sum[ > Cos[w*k], {k, 0, n - 1}]^2* > Sum[Sin[w*k]^2, {k, 0, n - 1}] - Sum[1, {k, 0, n - > 1}]*Sum[Cos[w*k]^2, {k, 0, n - 1}]*Sum[Sin[w*k]^2, {k, 0, n - > 1}]), w/Ï? â?? Rationals] Consequently, the correct assumption is Not[w/Pi \[Element] Integers] Now, compare FullSimplify[Sum[1, {k, 0, n - 1}]* Sum[Cos[w*k]*Sin[w*k], {k, 0, n - 1}]* Sum[Sin[w*k]*x[k], {k, 0, n - 1}], w/Pi \[Element] Rationals] that yields (1/2)*n*If[w/Pi \[Element] Integers, (I^((2*(-1 + n)*w)/Pi)*(-1 + n) + Cos[(-1 + n)*w])* Sin[(-1 + n)*w], (-Csc[w])*Sin[n*w]*Sin[w - n*w]]* Sum[Sin[k*w]*x[k], {k, 0, -1 + n}] against FullSimplify[Sum[1, {k, 0, n - 1}]* Sum[Cos[w*k]*Sin[w*k], {k, 0, n - 1}]* Sum[Sin[w*k]*x[k], {k, 0, n - 1}], !w/Pi \[Element] Integers] that yields (-(1/2))*n*Csc[w]*Sin[n*w]*Sin[w - n*w]* Sum[Sin[k*w]*x[k], {k, 0, -1 + n}] Regards, Jean-Marc