1. ## Mathematica: Matrices

Hi guys

I have to work with a large matrix in Mathematica. Instead of writing to the elements by using coordinates, i.e. [i,j], I wish to enumerate the entries starting from e.g. the lower left corner with 1, 2, 3, etc all the way up to the upper right entry.

Is there a smart way to do that? I thought of using MatrixForm on a 1D list, but I would have to split it up somehow, and I am not sure MatrixForm can do that.

2. Hi Niles. That's not clear. What precisely are you trying to do with the matrix. Here's one:

$\left(
\begin{array}{cccccccc}
1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\
9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 \\
17 & 18 & 19 & 20 & 21 & 22 & 23 & 24 \\
25 & 26 & 27 & 28 & 29 & 30 & 31 & 32 \\
33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 \\
41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 \\
49 & 50 & 51 & 52 & 53 & 54 & 55 & 56 \\
57 & 58 & 59 & 60 & 61 & 62 & 63 & 64
\end{array}
\right)$

3. Hi

My question was very ill posed, and partly because I did not understand the question I had to answer. Here is my question:

Say I have the following 3x3 grid

$
\begin{array}{*{20}c}
\bullet & \bullet & \bullet \\
\bullet & \bullet & \bullet \\
\bullet & \bullet & \bullet \\
\end{array}
$

Each dot couples to its nearest point, i.e. point (1,1) couples to (1,2) and (2,1). Likewise, point (1,2) couples to (1,1), (1,3) and (2,2) and so on.

Now, this I express as a 9x9 matrix (1 row for each black dot, where each entry in the row describes the coupling with the other dots.) If we denote the coupling by alpha, then the first two rows in the 9x9 matrix are

$
\left( {\begin{array}{*{20}c}
0 & \alpha & 0 & \alpha & 0 & 0 & 0 & 0 & 0 \\
\alpha & 0 & \alpha & 0 & \alpha & 0 & 0 & 0 & 0 \\
\end{array}} \right)
$

Now, I wish to write a function in Mathematica, which can generate this matrix. I have tried using a primitive (i.e. ugly) way by using a bunch of "if"-statements. I did not succeed by this method, but partly because I believe there has to be a much better and efficient way.

Can you guys guide me in the right direction? I have only used Mathematica for some days now, so I do not believe I am capable of determining how to do this most efficiently. Do you have any thoughts on how to do this properly?

4. Very good then Niles. That is an interesting function and looks like cellular automatons right? I don't have an immediate reply but as you know Wolfram is steep in cellular automatons, got that whole book he wrote some time ago about it.

Look, here's what to do: Hook up with the Mathematica user's group. Those guys are tops. Just email your question to:

mathgroup@smc.vnet.net

which is somehow connected with the forum at Drexel:

Math Forum Discussions - comp.soft-sys.math.mathematica

That news group and the connection to the forum is a little confusing to me but they'll know exactly what to do. I may also look at it a little but I'm nowhere as good as they are.

5. I think I solved the problem; at least I haven't found an example, where my code gives me the wrong result.

But I will have to implement periodic boundary conditions as well, which seems a little more difficult, so I will use your advice if it gets too confusing.

Thanks.

Best,
Niles.