Re: Simplyfing Sum[Mod[f(k),y],{k,k0,n}] type expressions? (Newbie question)
- To: mathgroup at smc.vnet.net
- Subject: [mg40235] Re: [mg40202] Simplyfing Sum[Mod[f(k),y],{k,k0,n}] type expressions? (Newbie question)
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Thu, 27 Mar 2003 06:49:32 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
First of all, your answer, if I understood it correctly, seems obviously wrong. If G= d - 2n + 2 then t= (n - 2 - G) mod 3 = -4 - d + 3 n mod 3 = 2 + 2d mod 3, which is independent of n. But the sum is clearly not independent of n. It is not clear to me what sort of answer you expect Mathematica to deliver. You can certainly do this: In[1]:= K = PolynomialMod[Sum[3*n - k - 4, {k, 2*n - 1, d}], 3] Out[1]= 2 + d^2 + 2*n + 2*n^2 Now, if you want to get an answer involving G= d - 2n + 2 you can do: In[2]:= G = d - 2*n + 2; In[3]:= PolynomialReduce[K, G, Modulus -> 3] Out[3]= {{1 + d + 2*n}, 0} So your sum can be written (mod 3) as (1+d+2n)G. This seems rather simpler than the answer you had in mind (??) Andrzej Kozlowski Yokohama, Japan http://www.mimuw.edu.pl/~akoz/ http://platon.c.u-tokyo.ac.jp/andrzej/ On Wednesday, March 26, 2003, at 04:50 am, prodogoss wrote: > I'm dealing with a problem that requires lots of summations of (x mod > y) type expressions. I had hoped that Mathematica (which I've just > started using) could simplify these but it doesn't seem to work. > > E.g., why won't (can't?) Mathematica simplify the expression: > > Sum[Mod[3n-k-4, 3],{k, 2n-1,d}] ? > > > By *hand* I can show that if > > S = SUM((3n-k-4) mod 3, k = 2n-1 to d) and > > G = d - 2n + 2, then S = f(t) where t = (n - 2 - G) mod 3, and > > (f(0), f(1), f(2)) = ({1, 0, 0}, {0, 1, 0}, {0, 0, 1})(G-1, G, G) > > ie 3x1 matrix = (3rd order unit matix) x (3x1 matrix) > > Hence, given values of d & n, S can be expressed in such a way that > its calculation is possible without having to labourously evaluate S > for each step, k. > > > I had heard so much about Mathematica and thought it would excel at > handling problems like this involving summations of Mod[] etc.? Is > there another way of doing this? Any help would be great! > > Thanks in advance! > > >