All materials on our website are shared by users. If you have any questions about copyright issues, please report us to resolve them. We are always happy to assist you.

Description

Typesetting latex for matrices.

Tags

Transcript

How to typeset complex yet aesthetically rejoicingmatrices without getting a headache ?
Vincent
Hugot
19th March 2005
1 Make one’s life easier...
Here are listed, higgledy-piggledy, some commands I found useful to deﬁne. I feel almoststupid giving them (almost) but I found that obvious though they are, they really help.Besides, as I shall use them a lot later on, I have to explain them anyway, even thoughmost of them are not directly related to matrices.
1.1 Delimiters commands
\p
adjusts a couple of parenthesis to it’s argument. For instance,
\p a
produces (
a
), and
\p{\f12}
produces
12
(one may notice the fraction command
\f
). There are numerousversions of this command, some of which are listed below :
\newcommand{\p}[1]{\left( #1 \right)} %couple de parenth`eses\newcommand{\pd}[1]{\left\lvert #1 \right\rvert} %couple ||\newcommand{\pdd}[1]{\left\lVert #1 \right\rVert} %couple || ||\newcommand{\pc}[1]{\left[ #1 \right]} %couple []\newcommand{\pa}[1]{\left\{ #1 \right\}} %couple {}\newcommand{\pb}[1]{\left\langle #1 \right\rangle} %couple de par bris´ees\newcommand{\lp}[1]{\left( #1 \right.} %parenth`ese gauche%etc...\newcommand{\rp}[1]{\left. #1 \right)} %parenth`ese droite%etc...
1.2 Matrices-related commands
ã
\M
provides a convenient way to produce a naked matrix (without delimiters) :
$\M{1&0\\0&1}$
gives1 00 1
ã
It’s variant
\pM
adds the parenthesis. It is equivalent to
\p{\M{...}}
.Ex :
$\pM{1&0\\0&1}$
produces
1 00 1
ã
\mM
produces a mini-matrix, suitable for inline use :
$\mM{1&0\\0&1}$
donne
1 00 1
1
Vincent
Hugot
Matrices
Licence deMaths 4
ã
The variant
pmM
, obviously enough, produces a small matrix automatically sur-rounded by parenthesis.
$\pmM{1&0\\0&1}$
produces (
1 00 1
)
2 Diagonal Matrices
You might think that those are not really diﬃcult to typeset. And I quite agree withyou on that point. But a ﬁnal result like this one
a
1
0...0
a
n
which was produced by the following code, simple but long for as basic an output,
\[\pM{{a_1 } & {} & 0 \\{} & \ddots & {} \\0 & {} & {a_n } \\}\]
is nevertheless unﬁt for unleashing torrents of enthusiasm. Compare it with this :
\[ \p{\matdiag {a_1}{a_n}} \]
a
1
0 0000 0
a
n
Please notice the beautiful grey color of the non-diagonal terms...which are slightlysmaller than the diagonal ones! Isn’t that marvellous? It is to note that the
\matdiag
command admits an optional argument. The complete syntax is given below :
\[\matdiag[opt]{a_1}{b_2}\]
a
1
opt optoptoptopt opt
b
2
Keep in mind that this function does
not
provide any delimiter. It is therefore up to youto use commands such as
\p{}
whenever you need them.
3 Simple triangular matrices
The
\mattrig
function provides you with a convenient way to typeset ﬁne simple trian-gular matrices ; it demands no less than ﬁve arguments which are respectively : the
a
11
and
a
nn
terms of the matrix, the contents of the upper part of the matrix, that of thelower part of the matrix. As for the last one, it is a very special argument, which mustbe an integer and determines which part of the matrix should be emphasized (typically
19th March 2005
Amusing L
A
TEX
Page 2 sur 4
Vincent
Hugot
Matrices
Licence deMaths 4
the non-null part). A value of 0 emphasizes the lower part whereas 1 emphasizes theupper part. If the value is neither 0 nor 1, then both parts stay grey.Example :
\[ \mattrig abcd1 \quad \mattrig abcd0 \quad \mattrig abcd2 \]
a
c cdcd d
ba
c cdcd d
ba
c cdcd d
b
4 More complex matrices : deﬁning ”blocs”.
4.1 A concrete example meant to entice the customer : TheMatrix of Froebenius
\[\pM{\mn a0 & \mn e0 & {} & \mn f0 & {a_1 } \\\mn c1 & {} & {} & {} & \mn k{a_2} \\\mn h0 & {} & {} & \mn g0 & {} \\{} & {} & {} & \mn b0 & \mn l{a_{n - 1} } \\\mn i0 & {} & \mn j0 & \mn d1 & {a_{n - 2} } \\}\matdrawline ab \matdrawline cd\matdrawtri efg \matdrawtri hij\matdrawdottedline kl \]
is enough to code the magniﬁcent matrix of Froebenius which follows :
0 0 0
a
1
1
a
2
0 00
a
n
−
2
0 0 1
a
n
−
1
to compare with
0 0
···
0
a
1
1.........
a
2
0......0............0
a
n
−
2
0
···
0 1
a
n
−
1
produced by the following code
\pM{0 & 0 & \cdots & 0 & {a_1 } \\1 & \ddots & \ddots & \vdots & {a_2 } \\0 & \ddots & \ddots & 0 & \vdots \\\vdots & \ddots & \ddots & 0 & {a_{n - 2} } \\0 & \cdots & 0 & 1 & {a_{n - 1} } \\}
One doesn’t need glasses to see which one is legible and which one is not...
4.2 Generalist macros
The
\mn{id}{value}
function, (where
mn
stands for matrix node), sets a node in thematrix under the name
id
. The value
value
appears in the body of the matrix. The code
\[ \pM{1&0\\0&1}\quad\pM{\mn a1&0\\0&1} \]
will produce the following output :
1 00 1
1 00 1
19th March 2005
Amusing L
A
TEX
Page 3 sur 4
Vincent
Hugot
Matrices
Licence deMaths 4
The one and only diﬀerence between the two matrices is that in the right one the 1 inthe upper-left corner is marked as the
a
node, whereas it is a plain, ordinary 1 in the leftone. One can’t tell them apart with the mere output, as the presence of the nodes hasno inﬂuence whatsoever on it.As soon as two, three or four such nodes are deﬁned, you may :
⋄
link two of them by a plain line.
⋄
link two of them by dots.
⋄
link three of them by dots.
⋄
link four of them by dots.by the means of, respectively :
ã
\matdrawline
Id
1
Id
2
Id
3
Id
4
ã
\matdrawdottedline
[
size
]
Id
1
Id
2
Id
3
Id
4
ã
\matdrawtri
[
size
]
Id
1
Id
2
Id
3
Id
4
ã
\matdrawbloc
[
size
]
Id
1
Id
2
Id
3
Id
4
It is obvious that a single node can be used as many times as necessary. The last threemacros listed do also have an optional argument specifying the size of the dots involved.Example :
\[\pM{\mn a{a_{11} } & & \mn b{a_{1n} } \\& & \\\mn c{a_{m1} } & & \mn d{a_{mn} } \\}\matdrawdottedline[.5pt]ad\matdrawbloc abdc\]
a
11
a
1
n
a
m
1
a
mn
An amusing property of these functions is that they work everywhere. Example :
En d’autres \mn ttermes, les vap de $A$ sont lesracines du polyn^ome caract´eristique de $A$.\\\mn LLe polyn^ome caract´eristique est un invariant de similitude,c’est-`a-dire que deux matrices semblables ont le m^eme polyn^ome\mn ccaract´eristique.\matdrawtri tLc
En d’autres termes, les vap de
A
sont les racines du polynˆome caract´eristique de
A
.Le polynˆome caract´eristique est un invariant de similitude, c’est-`a-dire que deux matricessemblables ont le mˆeme polynˆome caract´eristique.It is, however, sure that this misuse of those functions isn’t of great interest. It is possiblethanks to the magic of
pstricks
, which is the only one to blame...or to praise.A matrix of Froebenius or of similar complexity is the typical ﬁeld of these macros.Thanks to them, they become simple to type, and easy to read.
19th March 2005
Amusing L
A
TEX
Page 4 sur 4

Related Search

Similar documents

We Need Your Support

Thank you for visiting our website and your interest in our free products and services. We are nonprofit website to share and download documents. To the running of this website, we need your help to support us.

Thanks to everyone for your continued support.

No, Thanks