       Help Providing a Module

• To: mathgroup at smc.vnet.net
• Subject: [mg39696] Help Providing a Module
• From: "flip" <flip_alpha at safebunch.com>
• Date: Sat, 1 Mar 2003 22:06:16 -0500 (EST)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello,

can someone help with this?

I have

a = {-1, 2, 3, 61};
q = {{{-1, 1}, {3, 2}}, {{-1, 1}, {2, 3}, {3, 6}, {61, 1}}, {{2, 2}, {61,
1}}}

I want a module vects[a_, q_ ] that will  produce (notice, the number of
vectors is the length of q and the number of values within each vector is
the length of "a":

evects = {{1 , 0, 0, 0} , {1, 0, 0, 1}, {0, 1, 0, 0}}

We see that the first values of the submatrices in q have -1 and 3, and
those exist in "a", so in each position where the values in a exists, we
take the mod base 2 of the second value of that value.

So for example, we have {-1, 1} and {-1} exists in a, thus we take Mod[1, 2]
= 1 as the first evect.  Then we see that there is no 2 in q, so we have a
zero,  Then we have 3 in q and that does exist, so we take Mod[2, 2] = 0 as
the value in the evect.  Then, there is no 61, so we have a zero.

Thus, the first vector is {1, 0, 0, 0}. (The values in this vector are
either zero if the value in the first position of the submatrix doesn't
exist, otherwise we take the Mod[*, 2] of the second value for the value in
the vector).  I hope that makes sense.

We then look at he second submatrix in q and it contains as the first value
of each submatrix, so we can take Mod[*, 2] of each second value and get {1,
1, 0, 1}.

The tird would be {0, 0, 0, 1}.  And so on (as q could be larger).

Thus, the vect[a, q] will return (in this example): {{1, 0, 0, 0}, {1, 1, 0,
1}, {0, 0, 0, 1}}

The length of a varies and the length of q varies.

We could have a = {-1, 2} and q = {{{-1, 1},{2, 3}, {5, 6}, {7, 8}}, {{-1,
1}, {3, 2}}}, for example.

I tried doing this, but made a mess of things.  Can someone provide such a
module?

Thank you, Flip

To email me remove "_alpha".

```

• Prev by Date: Re: Testing for invertible matrix
• Next by Date: how use NDSolve with an ODE having parameters
• Previous by thread: Re: signal detector question
• Next by thread: Re: Help Providing a Module