Writing a Matrix: Tips & Suggestions

  • Thread starter Thread starter trap101
  • Start date Start date
  • Tags Tags
    Matrix Writing
Click For Summary

Homework Help Overview

The discussion revolves around how to effectively write and display matrices on the forum, with a focus on using LaTeX formatting and plain text representations. Participants are exploring different methods for presenting matrices clearly in a digital format.

Discussion Character

  • Exploratory, Conceptual clarification, Mathematical reasoning

Approaches and Questions Raised

  • Participants suggest using LaTeX for matrix representation, discussing the syntax and formatting options available. Some express curiosity about the best practices for displaying matrices, while others share examples of LaTeX code and its output.

Discussion Status

Several participants have provided examples of LaTeX code that successfully produce matrices, indicating a productive exchange of ideas. There is a recognition of the versatility of different LaTeX styles for various matrix types, though no consensus on a single best method has been reached.

Contextual Notes

Some participants mention the potential application of these formatting techniques in programming contexts, suggesting an interest in learning these skills for future use. There is also a reference to additional resources for learning LaTeX available online.

trap101
Messages
339
Reaction score
0
My apologies if this is in the wring place, but is there any way that I can write a matrix out on this forum? Maybe set up a table in excel or word and copy over? Any suggestions?
 
Physics news on Phys.org
trap101 said:
My apologies if this is in the wring place, but is there any way that I can write a matrix out on this forum? Maybe set up a table in excel or word and copy over? Any suggestions?

You can use plain text, like this: A = [[a,b],[c,d]] (and explain that this means [row1,row2]), or you can use tex, like this:
[tex]A = \left[ \begin{array}{cc} a & b \\ c & d \end{array} \right].[/tex]

The instructions used for the latter are:
"[t e x] A = \left[ \b e g i n{a r r a y}{cc} a & b \\ c & d \e n d{a r r a y} \right]. [/ t e x]"
When you type it out, remove the quotation marks and remove the spaces within words, so type 'tex' instead of 't e x', type 'begin' instead of 'b e g i n', type 'array' instead of 'a r r a y', etc. You don't need to remove spaces inside formulas, so it is OK to type a & b \\ c & d, etc. If you prefer rounded brackets, change '\left[' to '\left(', and similarly for '\right'. That would give
[tex]A = \left( \begin{array}{cc} a & b \\ c & d \end{array} \right).[/tex]

RGV
 
trap101 said:
My apologies if this is in the wring place, but is there any way that I can write a matrix out on this forum? Maybe set up a table in excel or word and copy over? Any suggestions?

The nicest way is to use LaTeX. Here's an example with the tags showing (with extra spaces in the tags so that they will show).

[ tex] \ begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \ end{bmatrix}[ /tex]

Removing the extra spaces in the tex tags and the begin and end statements produces this 3 x 3 matrix:
[tex]\begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}[/tex]
 
Thank you gentlemen.
 
[tex]\begin{bmatrix}2&0&6\\6&8&8\\0&6&8\end{bmatrix}[/tex]
 
\ begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \ end{bmatrix}
 
begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \ end{bmatrix}
 
begin{bmatrix}2&0&6\\6&8&8\\0&6&8\end{bmatrix}
 
[tex]A = \left[ \begin{array}{cc} 3&4\\ 2&2\end{array}\right].[/tex]
 
  • #10
[ tex]\begin{bmatrix} 2&6&0\\0&2&0\\0&0&3\end{bmatrix}[ /tex]
 
  • #11
\begin{bmatrix} 1 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 3 \end{bmatrix}
 
  • #12
Looks good.

As you can see, the LaTeX that Ray Vickson and I wrote, both produce matrices. For simple matrices, the \begin{bmatrix} ... \end{bmatrix} style is easier, IMO.

The b in bmatrix stands for bracket - []. There's also a pmatrix style that uses parentheses () to surround the matrix. There's another form that I don't recall at the moment - I think it surrounds the matrix with vertical lines, like you would use for a determinant.

There are lots of summaries and tutorials on the Web, so a search for "latex tutorial" will get you a bunch of links. There's also a sticky post in Forum Feedback and Announcements here at PF (https://www.physicsforums.com/showthread.php?t=546968) that gives an overview of the things you can do.

If you need to do more complicated matrices, then the style that Ray showed is more versatile, allowing you to write augmented matrices and other stuff.
 
  • #13
Appreciated. Definitely something I'll probably have to use in the future when it comes to programming too, so i might as well get a fix on it.

Cheers
 
  • #14
trap101 said:
Appreciated. Definitely something I'll probably have to use in the future when it comes to programming too, so i might as well get a fix on it.

Cheers

It might not have been obvious to you, but between the column separators " & " you can put any formula; and, if you use the "array" form you can justify the columns (separately); for example, "{ccc}" means "center" the items in each column; "lcr" means left-justify column 1, center column 2 and right-justify column 3; you might want to do this for something like:
[tex] A = \left[ \begin{array}{lcr} <br /> abba & a_{11}x_1^2 + \ln(x_2) & 12.0 \\ <br /> aaabbbaa & \sqrt{x_1^2 + x_2^2} & 125.4 \end{array} \right].[/tex]

RGV
 

Similar threads

Replies
4
Views
2K
Replies
15
Views
3K
  • · Replies 2 ·
Replies
2
Views
1K
  • · Replies 1 ·
Replies
1
Views
1K
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
2K
Replies
5
Views
2K
Replies
20
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K