➩ x * y is \(x y\), x / y or y \ x are \(\dfrac{x}{y}\).
➩ x ^ y is \(x^{y}\), sqrt(x) is \(\sqrt{x}\).
➩ exp(x) is \(e^{x}\), log(x) is natural log or \(\ln\left(x\right)\), log10(x) is \(\log_{10}\left(x\right)\).
➩ sin(x) is \(\sin\left(x\right)\) in radians, sind(x) is \(\sin\left(x\right)\) in degrees, asin(y) is \(arcsin\left(y\right)\) in radians, asind(y) is \(arcsin\left(y\right)\) in degrees. Same for cos(x) and tan(x).
TopHat Discussion
📗 Are you joining the lecture in person or on Zoom?
📗 \(\begin{bmatrix} a \\ b \end{bmatrix} \odot \begin{bmatrix} c \\ d \end{bmatrix} = \begin{bmatrix} a c \\ b d \end{bmatrix}\) is the element-wise product.
📗 \(\begin{bmatrix} a \\ b \end{bmatrix} \cdot \begin{bmatrix} c \\ d \end{bmatrix} = \begin{bmatrix} a & b \end{bmatrix} \begin{bmatrix} c \\ d \end{bmatrix} = a c + b d\) is the inner product, also called the dot product.
📗 \(\begin{bmatrix} a \\ b \end{bmatrix} \otimes \begin{bmatrix} c \\ d \end{bmatrix} = \begin{bmatrix} a \\ b \end{bmatrix} \begin{bmatrix} c & d \end{bmatrix} = \begin{bmatrix} a c & a d \\ b c & b d \end{bmatrix}\) is the outer product.
📗 Suppose \(M\) and \(W\) are two row vectors having the same size, and \(c\) is a scalar.
➩ M + W and M - W are element-wise and also vector addition and subtraction.
➩ M .* W is the element-wise product \(M \odot W\).
➩ M * W' or dot(M, W) are the inner product \(M \cdot W = M W^\top\).
➩ M' * W is the outer product \(M \otimes W = M^\top W\).
➩ M .^ W and M .^ c are element-wise exponentiation.
📗 \(\begin{bmatrix} a & b \\ c & d \end{bmatrix} \odot \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} a e & b f \\ c g & d h \end{bmatrix}\) is the element-wise product.
📗 \(\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} e \\ f \end{bmatrix} = \begin{bmatrix} a e + b f \\ c e + d f \end{bmatrix}\) and \(\begin{bmatrix} e & f \end{bmatrix} \begin{bmatrix} a & b \\ c & d \end{bmatrix} = \begin{bmatrix} e a + f c & e b + f d \end{bmatrix}\) and \(\begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} a e + b g & a f + b h \\ c e + d g & c f + d h \end{bmatrix}\) are matrix products.
📗 Suppose \(M\) and \(W\) are two matrices, and \(c\) is a scalar.
➩ M + W and M - W are element-wise and also matrix addition and subtraction.
➩ M .* W, when \(M\) and \(W\) have the same size, is the element-wise product \(M \odot W\), and M * W, when the number of columns of \(M\) is the same as the number of rows of \(W\), is the matrix product \(M W\).
➩ M ./ W and W .\ M are element-wise, and M / W and W \ M find the matrix \(X\) such that \(M X = W\), the solution of a system of linear equations.
➩ M .^ W and M .^ c are element-wise, and M ^ c is matrix exponentiation, for example, M ^ 2 is M * M.
TopHat Quiz
📗 What is the second column of \(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}\) ?
➩ m = [1 2 3; 4 5 6; 7 8 9]
📗 \(\begin{bmatrix} 2 \\ 5 \\ 8 \end{bmatrix}\)
➩ A: m * [0 1 0]
➩ B: m * [0; 1; 0]
➩ C: [0 1 0] * m
➩ D: [0; 1; 0] * m
TopHat Quiz
📗 What is the row 2 column 3 entry of \(\begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}\) ?
➩ m = [1 2 3; 4 5 6; 7 8 9]; ei = [0; 1; 0]; ej = [0; 0; 1]
📗 Most of the built-in operations are element-wise when applied to matrices.
➩ sqrt([a b; c d]) is \(\begin{bmatrix} \sqrt{a} & \sqrt{b} \\ \sqrt{c} & \sqrt{d} \end{bmatrix}\).
➩ [a b; c d] .^ 0.5 is also \(\begin{bmatrix} \sqrt{a} & \sqrt{b} \\ \sqrt{c} & \sqrt{d} \end{bmatrix}\).
➩ [a b; c d] ^ 0.5 is the actual square root of the matrix, it finds a matrix \(\begin{bmatrix} e & f \\ g & h \end{bmatrix}\) such that \(\begin{bmatrix} e & f \\ g & h \end{bmatrix} \begin{bmatrix} e & f \\ g & h \end{bmatrix} = \begin{bmatrix} a & b \\ c & d \end{bmatrix}\).
📗 Notes and code adapted from the course taught by Professors Beck Hasti and Michael O'Neill.
📗 You can expand all TopHat Quizzes and Discussions: .
📗 If there is an issue with TopHat during the lectures, please submit your answers on paper (include your Wisc ID and answers) or this Google form Form at the end of the lecture.