1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
% A
>> A = [1  -1  -1  -1  -1;
-1   1  -1  -1  -1;
-1  -1   1  -1  -1;
-1  -1  -1   1  -1;
-1  -1  -1  -1   1];
 
>> B = A;
 
>> C = [-1  -1   1   1  -1
-1  -1  -1   1   1
 1  -1  -1  -1   1
 1   1  -1  -1  -1
-1   1   1  -1  -1];
 
>> D = [-1  1  -1  -1  1;
 1  -1   1  -1  -1
-1   1  -1   1  -1;
-1  -1   1  -1   1
 1  -1  -1   1  -1];
 
>> [eig(A), eig(B), eig(C), eig(D)]
ans =
 
  -3.00000  -3.00000  -3.23607  -3.23607
   2.00000   2.00000  -3.23607  -3.23607
   2.00000   2.00000  -1.00000  -1.00000
   2.00000   2.00000   1.23607   1.23607
   2.00000   2.00000   1.23607   1.23607
 
>> [eig(A^2), eig(B^2), eig(C^2), eig(D^2)]
ans =
 
    4.00000    4.00000    1.00000    1.00000
    4.00000    4.00000    1.52786    1.52786
    4.00000    4.00000    1.52786    1.52786
    4.00000    4.00000   10.47214   10.47214
    9.00000    9.00000   10.47214   10.47214
 
>> eig(A^2 + B^2 + C^2+ D^2)
ans =
 
   20
   20
   20
   20
   20
Comments Off on Williamson Matrix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
% test matrix
>> A = [1 2 3 4 5;
 6 7 8 9 10;
 11 12 13 14 15;
 16 17 18 19 20;
 21 22 23 24 25]
 
A =
 
    1    2    3    4    5
    6    7    8    9   10
   11   12   13   14   15
   16   17   18   19   20
   21   22   23   24   25
 
% downshift matrix
>> D = [0 0 0 0 1; 1 0 0 0 0; 0 1 0 0 0; 0 0 1 0 0; 0 0 0 1 0]
D =
 
   0   0   0   0   1
   1   0   0   0   0
   0   1   0   0   0
   0   0   1   0   0
   0   0   0   1   0
 
% downshift test
>> D*A
ans =
 
   21   22   23   24   25
    1    2    3    4    5
    6    7    8    9   10
   11   12   13   14   15
   16   17   18   19   20
 
% downshift twice
>>  D*D*A
ans =
 
   16   17   18   19   20
   21   22   23   24   25
    1    2    3    4    5
    6    7    8    9   10
   11   12   13   14   15
 
% the trace of downshift is merely upshift
>>  D'
ans =
 
   0   1   0   0   0
   0   0   1   0   0
   0   0   0   1   0
   0   0   0   0   1
   1   0   0   0   0
 
% which can be verified as follows:
>> A, D'*A
A =
 
    1    2    3    4    5
    6    7    8    9   10
   11   12   13   14   15
   16   17   18   19   20
   21   22   23   24   25
 
ans =
 
    6    7    8    9   10
   11   12   13   14   15
   16   17   18   19   20
   21   22   23   24   25
    1    2    3    4    5
 
% putting the input matrix to the left of the downshift matrix.
% then it became a left-shift operation.
>> A*D
ans =
 
    2    3    4    5    1
    7    8    9   10    6
   12   13   14   15   11
   17   18   19   20   16
   22   23   24   25   21
 
%% Combining together, D'*A*D is down-and-left shift.
>> D'*A*D
A =
 
    1    2    3    4    5
    6    7    8    9   10
   11   12   13   14   15
   16   17   18   19   20
   21   22   23   24   25
 
ans =
 
    7    8    9   10    6
   12   13   14   15   11
   17   18   19   20   16
   22   23   24   25   21
    2    3    4    5    1
Comments Off on Downshift and Upshift Matrix

matrix

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
\documentclass[12pt]{article}
 
\usepackage[papersize={35mm, 45mm}, text={30mm, 40mm}]{geometry}
\usepackage{concrete}
\usepackage{amsmath}
 
\DeclareMathOperator*{\AAbf}{\ensuremath{\mathbf{A}}}
\DeclareMathOperator*{\xxbf}{\ensuremath{\mathbf{x}}}
\DeclareMathOperator*{\bbbf}{\ensuremath{\mathbf{b}}}
 
\begin{document}
\begin{equation*}
\AAbf_{\scriptscriptstyle m\times n} \medspace
\xxbf_{\scriptscriptstyle n\times 1} =
\bbbf_{\scriptscriptstyle m\times 1}
\end{equation*}
 
\begin{equation*}
\AAbf_{m\times n} \medspace
\xxbf_{n\times 1} =
\bbbf_{m\times 1}
\end{equation*}
 
\end{document}
Comments Off on LaTeX Matrix with dimensions

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage{amsmath,amssymb,amsthm}
\usepackage[papersize={100mm, 130mm}, text={90mm, 120mm}]{geometry}
  
% order: \order[st]{1}, \order{k}
\newcommand{\order}[2][th]{\ensuremath{{#2}^{\mathrm{#1}}}}
  
\newcommand{\Abf}{\ensuremath{\mathbf{A}}}
\newcommand{\Bbf}{\ensuremath{\mathbf{B}}}
\newcommand{\fpd}[2]{\ensuremath{\frac{\partial{#1}}{\partial{#2}}}}
  
\begin{document}
We prove the product rule of matrix derivative.
\begin{equation*}
\fpd{}{t}\Abf\Bbf = \fpd{\Abf}{t}\Bbf + \Abf\fpd{\Bbf}{t}
\end{equation*}
Let $[\boldsymbol{*}]_{ij}$ be the element of $\boldsymbol{*}$ in the
$\order{i}$ row and $\order{j}$ column. Then it's enough to prove
\begin{equation*}
\fpd{}{t}\left[\Abf\Bbf\right]_{ij} =
\left[\fpd{\Abf}{t}\Bbf + \Abf\fpd{\Bbf}{t}\right]_{ij.}
\end{equation*}
Note that $[\Abf\Bbf]_{ij=}=\sum_ka_{ij}b_{kj}$.
  
\begin{align*}
  \fpd{}{t}[\Abf\Bbf]_{ij} &= \fpd{}{t}\sum_ka_{ik}b_{ij} \\
  &= \sum_k\left(
  \fpd{a_{ik}}{t}b_{kj} + a_{ik}\fpd{b_{kj}}{t}
  \right) \\
  &= \sum_k\left(\fpd{a_{ik}}{t}b_{kj}\right) +
  \sum_k\left(a_{ik}\fpd{b_{kj}}{t}\right) \\
  &= \left[\fpd{\Abf}{t}\Bbf\right]_{ij} +
  \left[\Abf\fpd{\Bbf}{t}\right]_{ij} \\
  &= \left[ \fpd{\Abf}{t}\Bbf + \Abf\fpd{\Bbf}{t} \right]_{ij}
\end{align*}
\end{document}
Comments Off on matrix calculus: product rule of matrix derivative