Matrices in Latex

Discussion in 'Physics & Math' started by Green Destiny, Nov 2, 2010.

Thread Status:
Not open for further replies.
  1. Green Destiny Banned Banned

    Messages:
    1,211
    I need to express this as columns

    \begin{pmatrix}1\\0\\0\\0\
    0\\1\\0\\1\
    0\\1\\0\\-1\
    3\\0\\5\\1\
    0\\0\\0\\0\end{pmatrix}

    I've forgotten how to write it in latex, will someone assist me please. Thanks in advance!
     
  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. CptBork Valued Senior Member

    Messages:
    6,465
    I did it by making multiple {pmatrix} environments, one for each column. Feel free to click "quote" on the post where I did this. When setting up your reply, you'll see the LaTeX code I used.
     
  4. Google AdSense Guest Advertisement



    to hide all adverts.
  5. Green Destiny Banned Banned

    Messages:
    1,211
    Yes... that gave you individual column vectors... I wanted to augment them into one large matrix. How would you do this?
     
  6. Google AdSense Guest Advertisement



    to hide all adverts.
  7. prometheus viva voce! Registered Senior Member

    Messages:
    2,045
    You do it like this:

    \begin{pmatrix}1 & 0 & 0 & 0 \\
    0 & 1 & 0 & 1 \\
    0 & 1 & 0 & -1\\
    3 & 0 & 5 & 1 \\
    0 & 0 & 0 & 0 \end{pmatrix}

    It produces this:
    \(\begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & -1\\ 3 & 0 & 5 & 1 \\ 0 & 0 & 0 & 0 \end{pmatrix} \)

    although a better way is to use the matrix environment with manual brackets - it produces slightly less crazy brackets:

    \left(\begin{matrix}1 & 0 & 0 & 0 \\
    0 & 1 & 0 & 1 \\
    0 & 1 & 0 & -1\\
    3 & 0 & 5 & 1 \\
    0 & 0 & 0 & 0 \end{matrix} \right)

    \(\left(\begin{matrix}1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 1 \\ 0 & 1 & 0 & -1\\ 3 & 0 & 5 & 1 \\ 0 & 0 & 0 & 0 \end{matrix} \right)\)
     
  8. Green Destiny Banned Banned

    Messages:
    1,211
    Oh, I need the row of zero's as a fourth column, it's orientated incorrectly to the way I want it.
     
  9. prometheus viva voce! Registered Senior Member

    Messages:
    2,045
    I forgot to say that what I wrote outputs data in the same order as in the code, ie, rows become rows and columns become columns. A & indicates the next entry in a row while a \\ moves you onto the next line.
     
  10. Green Destiny Banned Banned

    Messages:
    1,211
    For instance, I was these

    1\\0\\0\\0\
    0\\1\\0\\1\
    0\\1\\0\\-1\
    3\\0\\5\\1\
    0\\0\\0\\0\

    to be represented vertically, with the 0000 column expressed as the last vertical column.
     
  11. CptBork Valued Senior Member

    Messages:
    6,465
    Code:
    \begin{pmatrix}
    1 & 0 & 0 & 3 & 0\\
    0 & 1 & 1 & 0 & 0\\
    0 & 0 & 0 & 5 & 0\\
    0 & 1 & -1 & 1 & 0\\
    \end{pmatrix}
    
    Result: \(\begin{pmatrix} 1 & 0 & 0 & 3 & 0\\ 0 & 1 & 1 & 0 & 0\\ 0 & 0 & 0 & 5 & 0\\ 0 & 1 & -1 & 1 & 0\\ \end{pmatrix}\)
     
  12. Green Destiny Banned Banned

    Messages:
    1,211
    Ah, thank you.
     
  13. prometheus viva voce! Registered Senior Member

    Messages:
    2,045
    Are you seriously saying you can't take the transpose of a matrix?!
     
  14. Green Destiny Banned Banned

    Messages:
    1,211
    What are you talking about? This is about expressing latex.
     
  15. Green Destiny Banned Banned

    Messages:
    1,211
    If by transpose, there is some intimate connection to the name and latex, then yes, I do not know. I've never really studied latex to the degree you have, or possibly even used it to the degree you have.

    So yes, it's all very serious.
     
  16. prometheus viva voce! Registered Senior Member

    Messages:
    2,045
    Do you know what the transpose of a matrix is?
     
  17. Pinwheel Banned Banned

    Messages:
    2,424
    Who is transposing matrices? I thought this was about using LaTex to display matrices.

    \(\begin{pmatrix}A & B \\ C & D & \end{pmatrix} \)

    Transpose

    \(\begin{pmatrix}A & C \\ B & D & \end{pmatrix} \)
     
  18. prometheus viva voce! Registered Senior Member

    Messages:
    2,045
    GD wrote the columns of a matrix out in rows, and as you know, when you write matrices in latex you need to write rows in rows.
     
  19. Pinwheel Banned Banned

    Messages:
    2,424
    Oh right I see what you mean.
     
  20. temur man of no words Registered Senior Member

    Messages:
    1,330
    Next time should ask please put this food in my mouth.
     
  21. Green Destiny Banned Banned

    Messages:
    1,211
    Yes, when writing mathematics. This is latex, twit. I don't get you at all.
     
  22. Green Destiny Banned Banned

    Messages:
    1,211
    When someone says, you don't know how to transpose, you take that very literally as what it means in real life. I am asking how to write latex, not to transpose.
     
  23. Pinwheel Banned Banned

    Messages:
    2,424
    Surely it was obvious that all you needed to do was tranpose the values in your LaTex script.
     
Thread Status:
Not open for further replies.

Share This Page