Results 1 to 5 of 5

Math Help - Mathematica: Matrices

  1. #1
    Junior Member
    Joined
    Oct 2008
    Posts
    49

    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.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Super Member
    Joined
    Aug 2008
    Posts
    903
    Hi Niles. That's not clear. What precisely are you trying to do with the matrix. Here's one:

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

  3. #3
    Junior Member
    Joined
    Oct 2008
    Posts
    49
    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

    <br />
\begin{array}{*{20}c}<br />
    \bullet  &  \bullet  &  \bullet   \\<br />
    \bullet  &  \bullet  &  \bullet   \\<br />
    \bullet  &  \bullet  &  \bullet   \\<br />
\end{array}<br />

    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

    <br />
\left( {\begin{array}{*{20}c}<br />
   0 & \alpha  & 0 & \alpha  & 0 & 0 & 0 & 0 & 0  \\<br />
   \alpha  & 0 & \alpha  & 0 & \alpha  & 0 & 0 & 0 & 0  \\<br />
\end{array}} \right)<br />

    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?
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Super Member
    Joined
    Aug 2008
    Posts
    903
    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.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Junior Member
    Joined
    Oct 2008
    Posts
    49
    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.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: November 25th 2010, 06:34 PM
  2. Total matrices and Commutative matrices in GL(r,Zn)
    Posted in the Advanced Algebra Forum
    Replies: 8
    Last Post: August 16th 2010, 02:11 AM
  3. Mathematica
    Posted in the Math Software Forum
    Replies: 2
    Last Post: March 24th 2010, 07:13 AM
  4. Mathematica Help
    Posted in the Math Software Forum
    Replies: 1
    Last Post: March 5th 2010, 07:12 AM
  5. MLE and Mathematica
    Posted in the Math Software Forum
    Replies: 0
    Last Post: June 21st 2008, 01:27 AM

Search Tags


/mathhelpforum @mathhelpforum