       Re: Simplyfing Sum[Mod[f(k),y],{k,k0,n}] type expressions? (Newbie question)

• To: mathgroup at smc.vnet.net
• Subject: [mg40238] 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:49 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```I looked again at your answer and noticed that I indeed misunderstood
it and it is not in fact independent of n. (It's just the way you wrote
it as f(t) where t does not depend on n, but f itself does!). In fact
your answer is correct but unnecessarily complicated, unless you have
some reason that you do not mention for wanting to express it in that
particular form.

Andrzej Kozlowski
Yokohama, Japan
http://www.mimuw.edu.pl/~akoz/
http://platon.c.u-tokyo.ac.jp/andrzej/

On Wednesday, March 26, 2003, at 06:47  pm, Andrzej Kozlowski wrote:

> 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:=
> K = PolynomialMod[Sum[3*n - k - 4, {k, 2*n - 1, d}], 3]
>
> Out=
> 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:=
> G = d - 2*n + 2;
>
> In:=
> PolynomialReduce[K, G, Modulus -> 3]
>
> Out=
> {{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!
>>
>>
>>
>
>

```

• Prev by Date: Re: Simplyfing Sum[Mod[f(k),y],{k,k0,n}] type expressions? (Newbie question)
• Next by Date: Solving recurrence relations in two variables
• Previous by thread: Re: Simplyfing Sum[Mod[f(k),y],{k,k0,n}] type expressions? (Newbie question)
• Next by thread: Unbelievable bug in ConstrainedMin, ConstrainedMax and LinearProgramming