Commit 9d4efc62 authored by Jim Hefferon's avatar Jim Hefferon

make matrices and vectors right aligned

parent 26e45722
......@@ -30,6 +30,8 @@ TODO list for Linear Algebra http://joshua.smcvt.edu/linearalgebra
** mdframed
** mathtools
*** change all pmatrix to mat and all amatrix to amat, and also check all \vdots
to see if they need to be vdotswithin
** Change vector look?
http://www.reddit.com/r/LaTeX/comments/m4lxo/both_of_these_arrows_look_wrong_to_me_pic/
......
This diff is collapsed.
This diff is collapsed.
......@@ -1185,38 +1185,38 @@ beginfig(28) % equiv relation; some row-equiv mats shown double-arrowed
%input arrow
z0=(.8w,0v);
boxit.a0(btex \strut{\scriptsize $\displaystyle
\begin{pmatrix}
\begin{mat}
1 &0 \\
0 &1
\end{pmatrix}$} etex);
\end{mat}$} etex);
a0.c=z0;
z1=(0w,.4v);
boxit.a1(btex {\scriptsize $\displaystyle
\begin{pmatrix}
\begin{mat}
2 &2 \\
4 &3
\end{pmatrix}$} etex);
\end{mat}$} etex);
a1.c=z1;
z2=(.55w,.9v);
boxit.a2(btex {\scriptsize $\displaystyle
\begin{pmatrix}
\begin{mat}
2 &0 \\
0 &-1
\end{pmatrix}$} etex);
\end{mat}$} etex);
a2.c=z2;
z3=(1.35w,.75v);
boxit.a3(btex {\scriptsize $\displaystyle
\begin{pmatrix}
\begin{mat}
1 &1 \\
0 &-1
\end{pmatrix}$} etex);
\end{mat}$} etex);
a3.c=z3;
z4=(1.5w,.25v);
boxit.a4(btex {\scriptsize $\displaystyle
\begin{pmatrix}
\begin{mat}
2 &2 \\
0 &-1
\end{pmatrix}$} etex);
\end{mat}$} etex);
a4.c=z4;
% draw them w/o enclosing box shown
drawunboxed(a0,a1,a2,a3,a4);
......
This diff is collapsed.
......@@ -237,14 +237,14 @@ free vector that,
if it starts at \( (a_1,\ldots,a_n) \), ends at \( (b_1,\ldots,b_n) \),
is represented by this column
\begin{equation*}
\colvec{b_1-a_1 \\ \vdots \\ b_n-a_n}
\colvec{b_1-a_1 \\ \vdotswithin{b_1-a_1} \\ b_n-a_n}
\end{equation*}
(vectors are equal if they have the same representation),
we aren't too careful to distinguish between a point and the vector whose
canonical representation ends at that point,
\begin{equation*}
\Re^n=
\set{\colvec{v_1 \\ \vdots \\ v_n}\suchthat v_1,\ldots,v_n\in\Re}
\set{\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}\suchthat v_1,\ldots,v_n\in\Re}
\end{equation*}
and addition and scalar multiplication are done component-wise.
......@@ -574,23 +574,23 @@ namely by any particular solution.
\end{equation*}
Gauss' method
\begin{equation*}
\begin{amatrix}{4}
\begin{amat}{4}
1 &0 &0 &-2 &1 \\
1 &1 &-3 &0 &1 \\
1 &3 &0 &-4 &0
\end{amatrix}
\end{amat}
\;\grstep[-\rho_1+\rho_3]{-\rho_1+\rho_2}\;
\begin{amatrix}{4}
\begin{amat}{4}
1 &0 &0 &-2 &1 \\
0 &1 &-3 &2 &0 \\
0 &3 &0 &-2 &-1
\end{amatrix}
\end{amat}
\;\grstep{-3\rho_2+\rho_3}\;
\begin{amatrix}{4}
\begin{amat}{4}
1 &0 &0 &-2 &1 \\
0 &1 &-3 &2 &0 \\
0 &0 &9 &-8 &-1
\end{amatrix}
\end{amat}
\end{equation*}
gives \( k=-(1/9)+(8/9)m \), so \( s=-(1/3)+(2/3)m \) and \( t=1+2m \).
The intersection is this.
......@@ -1249,12 +1249,12 @@ Not every vector in each is orthogonal to all vectors in the other.
\partsitem Dot product is right-distributive.
\begin{align*}
(\vec{u}+\vec{v})\dotprod\vec{w}
&=[\colvec{u_1 \\ \vdots \\ u_n}
+\colvec{v_1 \\ \vdots \\ v_n}]\dotprod
\colvec{w_1 \\ \vdots \\ w_n} \\
&=[\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}
+\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}]\dotprod
\colvec{w_1 \\ \vdotswithin{w_1} \\ w_n} \\
&=
\colvec{u_1+v_1 \\ \vdots \\ u_n+v_n}\dotprod
\colvec{w_1 \\ \vdots \\ w_n} \\
\colvec{u_1+v_1 \\ \vdotswithin{u_1+v_1} \\ u_n+v_n}\dotprod
\colvec{w_1 \\ \vdotswithin{w_1} \\ w_n} \\
&=
(u_1+v_1)w_1+\cdots+(u_n+v_n)w_n \\
&=
......@@ -1268,10 +1268,12 @@ Not every vector in each is orthogonal to all vectors in the other.
The proof is just like the prior one.
\partsitem Dot product commutes.
\begin{equation*}
\colvec{u_1 \\ \vdots \\ u_n}\dotprod\colvec{v_1 \\ \vdots \\ v_n}
\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}\dotprod
\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}
=u_1v_1+\cdots+u_nv_n
=v_1u_1+\cdots+v_nu_n
=\colvec{v_1 \\ \vdots \\ v_n}\dotprod\colvec{u_1 \\ \vdots \\ u_n}
=\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}\dotprod
\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}
\end{equation*}
\partsitem Because \( \vec{u}\dotprod\vec{v} \)
is a scalar, not a vector,
......@@ -1459,9 +1461,9 @@ Not every vector in each is orthogonal to all vectors in the other.
\begin{answer}
Write
\begin{equation*}
\vec{u}=\colvec{u_1 \\ \vdots \\ u_n}
\vec{u}=\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}
\qquad
\vec{v}=\colvec{v_1 \\ \vdots \\ v_n}
\vec{v}=\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}
\end{equation*}
and then this computation works.
\begin{align*}
......@@ -1684,9 +1686,9 @@ Not every vector in each is orthogonal to all vectors in the other.
We can show the two statements together.
Let \( \vec{u}, \vec{v}\in\Re^n \), write
\begin{equation*}
\vec{u}=\colvec{u_1 \\ \vdots \\ u_n}
\vec{u}=\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}
\qquad
\vec{v}=\colvec{v_1 \\ \vdots \\ v_n}
\vec{v}=\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}
\end{equation*}
and calculate.
\begin{equation*}
......@@ -1707,20 +1709,20 @@ Not every vector in each is orthogonal to all vectors in the other.
\begin{answer}
Let
\begin{equation*}
\vec{u}=\colvec{u_1 \\ \vdots \\ u_n},
\vec{u}=\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n},
\quad
\vec{v}=\colvec{v_1 \\ \vdots \\ v_n}
\vec{v}=\colvec{v_1 \\ \vdotswithin{v_1} \\ v_n}
\quad
\vec{w}=\colvec{w_1 \\ \vdots \\ w_n}
\vec{w}=\colvec{w_1 \\ \vdotswithin{w_1} \\ w_n}
\end{equation*}
and then
\begin{align*}
\vec{u}\dotprod\bigl(k\vec{v}+m\vec{w}\bigr)
&=\colvec{u_1 \\ \vdots \\ u_n}\dotprod
\bigl( \colvec{kv_1 \\ \vdots \\ kv_n}
+\colvec{mw_1 \\ \vdots \\ mw_n} \bigr) \\
&=\colvec{u_1 \\ \vdots \\ u_n}\dotprod
\colvec{kv_1+mw_1 \\ \vdots \\ kv_n+mw_n} \\
&=\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}\dotprod
\bigl( \colvec{kv_1 \\ \vdotswithin{kv_1} \\ kv_n}
+\colvec{mw_1 \\ \vdotswithin{mw_1} \\ mw_n} \bigr) \\
&=\colvec{u_1 \\ \vdotswithin{u_1} \\ u_n}\dotprod
\colvec{kv_1+mw_1 \\ \vdotswithin{kv_1+mw_1} \\ kv_n+mw_n} \\
&=u_1(kv_1+mw_1)+\cdots+u_n(kv_n+mw_n) \\
&=ku_1v_1+mu_1w_1+\cdots+ku_nv_n+mu_nw_n \\
&=(ku_1v_1+\cdots+ku_nv_n)+(mu_1w_1+\cdots+mu_nw_n) \\
......
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,8 @@
% input all the math packages
\RequirePackage{mathrsfs}
% AMS math
\RequirePackage[reqno]{amsmath}
% \RequirePackage[reqno]{amsmath}
\RequirePackage[reqno,disallowspaces]{mathtools} % imports amsmath
\RequirePackage{amsfonts} %for Y&Y BSR AMS fonts
\RequirePackage{amssymb}
\RequirePackage[text]{amsthm}
......@@ -68,7 +69,7 @@
%-------------misc matrices
\newenvironment{mat}{\left(\begin{array}}{\end{array}\right)}
% \newenvironment{mat}{\left(\begin{array}}{\end{array}\right)}
\newenvironment{detmat}{\left|\begin{array}}{\end{array}\right|}
\newcommand{\deter}[1]{ \mathchoice{\left|#1\right|}{|#1|}{|#1|}{|#1|} }
\newcommand{\generalmatrix}[3]{ %arg1: low-case letter, arg2: rows, arg3: cols
......@@ -80,13 +81,22 @@
#1_{#3,1} &#1_{#3,2} &\ldots &#1_{#3,#2}
\end{array}
\right) }
% with mathtools we can have column entries right flushed
\newenvironment{mat}[1][r]{\begin{pmatrix*}[#1]}{\end{pmatrix*}}
\newenvironment{amat}[1]{%
\left(\begin{array}{@{}*{#1}{r}|r@{}}
}{%
\end{array}\right)
}
\newcommand\vdotswithin[1]{% Taken from mathtools.dtx because my TL is not 2011
{\mathmakebox[\widthof{\ensuremath{{}#1{}}}][c]{{\vdots}}}}
%------------colvec and rowvec
% Column vector and row vector. Usage:
% \colvec{1 \\ 2 \\ 3 \\ 4} and \rowvec{1 &2 &3}
\newcommand{\colvec}[1]{\begin{pmatrix} #1 \end{pmatrix}}
\newcommand{\rowvec}[1]{\begin{pmatrix} #1 \end{pmatrix}}
\newcommand{\colvec}[1]{\begin{mat} #1 \end{mat}}
\newcommand{\rowvec}[1]{\begin{mat} #1 \end{mat}}
%-------------making aligned columns
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment