Re: RE: Simplify a module

• To: mathgroup at smc.vnet.net
• Subject: [mg39507] Re: [mg39487] RE: Simplify a module
• From: Dr Bob <drbob at bigfoot.com>
• Date: Thu, 20 Feb 2003 05:13:58 -0500 (EST)
• References: <8EB1C3634596D6118952006008F711CD5BCCDD@debis.com>
• Reply-to: drbob at bigfoot.com
• Sender: owner-wri-mathgroup at wolfram.com

```I had left out the definition of 'mytab'.  Sorry.

Flip's function is apparently a generalized inverse modulo 3, 8 and 49.

It satisfies the following tests:

test[i_] := And @@ (Mod[#*f@#, i] == If[GCD[#, i] == 1, 1, 0] & /@
Range[1176])
test /@ {3, 8, 49}

{True, True, True}

Evaluate the following to see where the constants come from (I think):

3*8*49
{1176/#, PowerMod[1176/#, -1, #]} & /@ {3, 8, 49}
Times @@@ %
Mod[#, {3, 8, 49}] & /@ %

The function can also be written as

m = If[GCD[#1, #2] == 1, PowerMod[#1, -1, #2], 0] &;
f[e_] := Mod[784 m[e, 3] + 441 m[e, 8] + 1128 m[e, 49], 1176]

Maybe Flip can clarify what the function is used for.

Bobby

On Wed, 19 Feb 2003 17:20:54 +0100, Wolf, Hartmut <Hartmut.Wolf@t-
systems.com> wrote:

> Hey Bobby,
>
> try to evaluate the appending notebook. It works with me. A problem with
> mytab? (I didn't like to spend time on this thread).
>
>
>> -----Original Message-----
>> From: Dr Bob [mailto:drbob at bigfoot.com]
To: mathgroup at smc.vnet.net
>> Sent: Wednesday, February 19, 2003 4:55 PM
>> To: Wolf, Hartmut; mathgroup at smc.vnet.net
>> Subject: [mg39507] Re: [mg39487] RE: Simplify a module
>>
>>
>> That doesn't work, at least not here on my computer:
>>
>> sw[{{a_, base_}, seq_}] := (a = Switch[Mod[e, base],
>> Evaluate[Sequence @@ seq], _, 0])
>> dcalc4[ein_] := Block[{a1, a2, a3, e = ein}, {T1, M1, T2, M2, T3, M3} =
>> {2, 392, 3, 147, 47, 24};
>> Evaluate[sw /@ mytab];
>> Mod[a1*T1*M1 + a2*T2*M2 + a3*T3*M3, 1176]]
>> dcalc4[5]
>>
>> Mod[784 a1 + 441 a2 + 1128 a3, 1176]
>>
>> For simplicity, I like this one:
>>
>> m = If[Mod[#, 7] == 0, 0, PowerMod[#, -1, 49]] & /@ Range[0, 48];
>> f[e_] := Mod[784Mod[e, 3] + 441Mod[e, 8]Mod[e, 2] + 1128 m[[1 + Mod[e,
>> 49]]], 1176]
>
> Yes, something to the like, my instinct told me. Yet I didn't like to
> delve
> into that. And not dwell on this. What I wanted to show was (1) a trick
> as
> to get at the relevant data from Flips code (2) How to seperate data from
> code and (3) that Switch[...] expr. Finis.
>
> Perhaps you can better see what Flip's doing. These Numbers 784, 1176 ...
> are a mystery to me.
>
>> f[5]
>>
>> 941
>>
>> I was interested in versions of your solution for other reasons.
>>
>> Bobby
>>
>
> Sure, Bobby, this was meant for Flip!
>
> Yours,
> Hartmut
>
>

--
majort at cox-internet.com
Bobby R. Treat

```

• Prev by Date: Converting Animations to QuickTime Movies Using iView MediaPro
• Next by Date: RE: Showing thick lines - a problem?
• Previous by thread: Re: RE: Simplify a module
• Next by thread: Re: RE: Simplify a module