diff --git a/lectures/lagrangian_lqdp.md b/lectures/lagrangian_lqdp.md index 248f0f2fa..f1e680cc6 100644 --- a/lectures/lagrangian_lqdp.md +++ b/lectures/lagrangian_lqdp.md @@ -206,29 +206,29 @@ It is useful to proceed with the following steps: * arrange the resulting equation and the second equation of {eq}`lag-lqdp-eq2` into the form $$ -L\ \begin{pmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{pmatrix}\ = \ N\ \begin{pmatrix}x_t\cr \mu_t\cr\end{pmatrix}\ +L\ \begin{bmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{bmatrix}\ = \ N\ \begin{bmatrix}x_t\cr \mu_t\cr\end{bmatrix}\ ,\ t \geq 0, $$ (eq:systosolve) where $$ -L = \ \begin{pmatrix}I & BQ^{-1} B^\prime \cr 0 & A^\prime\cr\end{pmatrix}, \quad N = \ -\begin{pmatrix}A & 0\cr -R & I\cr\end{pmatrix}. +L = \ \begin{bmatrix}I & BQ^{-1} B^\prime \cr 0 & A^\prime\cr\end{bmatrix}, \quad N = \ +\begin{bmatrix}A & 0\cr -R & I\cr\end{bmatrix}. $$ When $L$ is of full rank (i.e., when $A$ is of full rank), we can write system {eq}`eq:systosolve` as $$ -\begin{pmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{pmatrix}\ = M\ \begin{pmatrix}x_t\cr\mu_t\cr\end{pmatrix} +\begin{bmatrix}x_{t+1}\cr \mu_{t+1}\cr\end{bmatrix}\ = M\ \begin{bmatrix}x_t\cr\mu_t\cr\end{bmatrix} $$ (eq4orig) where $$ -M\equiv L^{-1} N = \begin{pmatrix}A+B Q^{-1} B^\prime A^{\prime-1}R & --B Q^{-1} B^\prime A^{\prime-1}\cr -A^{\prime -1} R & A^{\prime -1}\cr\end{pmatrix}. +M\equiv L^{-1} N = \begin{bmatrix}A+B Q^{-1} B^\prime A^{\prime-1}R & +-B Q^{-1} B^\prime A^{\prime-1}\cr -A^{\prime -1} R & A^{\prime -1}\cr\end{bmatrix}. $$ (Mdefn) +++ @@ -262,7 +262,7 @@ To proceed, we study properties of the $(2n \times 2n)$ matrix $M$ defined in {e It helps to introduce a $(2n \times 2n)$ matrix $$ -J = \begin{pmatrix}0 & -I_n\cr I_n & 0\cr\end{pmatrix}. +J = \begin{bmatrix}0 & -I_n\cr I_n & 0\cr\end{bmatrix}. $$ The rank of $J$ is $2n$. @@ -308,12 +308,12 @@ $$ y_{t+1} = M y_t $$ (eq658) -where $y_t = \begin{pmatrix}x_t\cr \mu_t\cr\end{pmatrix}$. +where $y_t = \begin{bmatrix}x_t\cr \mu_t\cr\end{bmatrix}$. Consider a **triangularization** of $M$ $$ -V^{-1} M V= \begin{pmatrix}W_{11} & W_{12} \cr 0 & W_{22}\cr\end{pmatrix} +V^{-1} M V= \begin{bmatrix}W_{11} & W_{12} \cr 0 & W_{22}\cr\end{bmatrix} $$ (eqn:triangledecomp) where @@ -353,9 +353,9 @@ and where $W^t_{ii}$ is $W_{ii}$ raised to the $t$th power. Write equation {eq}`eq6510` as $$ -\begin{pmatrix}y^\ast_{1t}\cr y^\ast_{2t}\cr\end{pmatrix}\ =\ \left[\begin{matrix} W^t_{11} & -W_{12, t}\cr 0 & W^t_{22}\cr\end{matrix}\right]\quad \begin{pmatrix}y^\ast_{10}\cr -y^\ast_{20}\cr\end{pmatrix} +\begin{bmatrix}y^\ast_{1t}\cr y^\ast_{2t}\cr\end{bmatrix}\ =\ \left[\begin{matrix} W^t_{11} & +W_{12, t}\cr 0 & W^t_{22}\cr\end{matrix}\right]\quad \begin{bmatrix}y^\ast_{10}\cr +y^\ast_{20}\cr\end{bmatrix} $$ where $y^\ast_t = V^{-1} y_t$, and in particular where @@ -394,7 +394,7 @@ But notice that because $(V^{21}\ V^{22})$ is the second row block of the inverse of $V,$ it follows that $$ -(V^{21} \ V^{22})\quad \begin{pmatrix}V_{11}\cr V_{21}\cr\end{pmatrix} = 0 +(V^{21} \ V^{22})\quad \begin{bmatrix}V_{11}\cr V_{21}\cr\end{bmatrix} = 0 $$ which implies diff --git a/lectures/lake_model.md b/lectures/lake_model.md index 0f71dd614..dd801a1a5 100644 --- a/lectures/lake_model.md +++ b/lectures/lake_model.md @@ -155,10 +155,10 @@ $$ X_{t+1} = A X_t \quad \text{where} \quad A := -\begin{pmatrix} +\begin{bmatrix} (1-d)(1-\lambda) + b & (1-d)\alpha + b \\ (1-d)\lambda & (1-d)(1-\alpha) -\end{pmatrix} +\end{bmatrix} $$ This law tells us how total employment and unemployment evolve over time. @@ -170,16 +170,16 @@ Now let's derive the law of motion for rates. To get these we can divide both sides of $X_{t+1} = A X_t$ by $N_{t+1}$ to get $$ -\begin{pmatrix} +\begin{bmatrix} U_{t+1}/N_{t+1} \\ E_{t+1}/N_{t+1} -\end{pmatrix} = +\end{bmatrix} = \frac1{1+g} A -\begin{pmatrix} +\begin{bmatrix} U_{t}/N_{t} \\ E_{t}/N_{t} -\end{pmatrix} +\end{bmatrix} $$ Letting diff --git a/lectures/multi_hyper.md b/lectures/multi_hyper.md index b25b14571..a44ee4d32 100644 --- a/lectures/multi_hyper.md +++ b/lectures/multi_hyper.md @@ -71,7 +71,7 @@ Things have to add up so $\sum_{i=1}^c k_i = n$. Under the hypothesis that the selection process judges proposals on their quality and that quality is independent of continent of the author's continent of residence, the administrator views the outcome of the selection procedure as a random vector $$ -X = \begin{pmatrix} k_1 \cr k_2 \cr \vdots \cr k_c \end{pmatrix}. +X = \begin{bmatrix} k_1 \cr k_2 \cr \vdots \cr k_c \end{bmatrix}. $$ To evaluate whether the selection procedure is **color blind** the administrator wants to study whether the particular realization of $X$ drawn can plausibly @@ -94,7 +94,7 @@ So $n = 15$. The administrator wants to know the probability distribution of outcomes $$ -X = \begin{pmatrix} k_1 \cr k_2 \cr \vdots \cr k_4 \end{pmatrix}. +X = \begin{bmatrix} k_1 \cr k_2 \cr \vdots \cr k_4 \end{bmatrix}. $$ In particular, he wants to know whether a particular @@ -272,7 +272,7 @@ K_arr = [5, 10, 15] urn = Urn(K_arr) ``` -Now use the Urn Class method `pmf` to compute the probability of the outcome $X = \begin{pmatrix} 2 & 2 & 2 \end{pmatrix}$ +Now use the Urn Class method `pmf` to compute the probability of the outcome $X = \begin{bmatrix} 2 & 2 & 2 \end{bmatrix}$ ```{code-cell} python3 k_arr = [2, 2, 2] # array of number of observed successes diff --git a/lectures/newton_method.md b/lectures/newton_method.md index 3af3b5f62..4f2788cf1 100644 --- a/lectures/newton_method.md +++ b/lectures/newton_method.md @@ -513,20 +513,20 @@ An equilibrium price vector $p^*$ satisfies $e_i(p^*) = 0$. We set $$ -A = \begin{pmatrix} +A = \begin{bmatrix} a_{00} & a_{01} \\ a_{10} & a_{11} - \end{pmatrix}, + \end{bmatrix}, \qquad - b = \begin{pmatrix} + b = \begin{bmatrix} b_0 \\ b_1 - \end{pmatrix} + \end{bmatrix} \qquad \text{and} \qquad - c = \begin{pmatrix} + c = \begin{bmatrix} c_0 \\ c_1 - \end{pmatrix} + \end{bmatrix} $$ for this particular question. @@ -539,10 +539,10 @@ Our first step is to define the excess demand function $$ e(p) = - \begin{pmatrix} + \begin{bmatrix} e_0(p) \\ e_1(p) - \end{pmatrix} + \end{bmatrix} $$ The function below calculates the excess demand for given parameters @@ -556,20 +556,20 @@ Our default parameter values will be $$ -A = \begin{pmatrix} +A = \begin{bmatrix} 0.5 & 0.4 \\ 0.8 & 0.2 - \end{pmatrix}, + \end{bmatrix}, \qquad - b = \begin{pmatrix} + b = \begin{bmatrix} 1 \\ 1 - \end{pmatrix} + \end{bmatrix} \qquad \text{and} \qquad - c = \begin{pmatrix} + c = \begin{bmatrix} 1 \\ 1 - \end{pmatrix} + \end{bmatrix} $$ ```{code-cell} ipython3 @@ -689,10 +689,10 @@ Here we manually calculate the elements of the Jacobian $$ J(p) = - \begin{pmatrix} + \begin{bmatrix} \frac{\partial e_0}{\partial p_0}(p) & \frac{\partial e_0}{\partial p_1}(p) \\ \frac{\partial e_1}{\partial p_0}(p) & \frac{\partial e_1}{\partial p_1}(p) - \end{pmatrix} + \end{bmatrix} $$ ```{code-cell} ipython3 @@ -850,11 +850,11 @@ np.max(np.abs(e(p, A, b, c))) Consider a three-dimensional extension of the Solow fixed point problem with $$ -A = \begin{pmatrix} +A = \begin{bmatrix} 2 & 3 & 3 \\ 2 & 4 & 2 \\ 1 & 5 & 1 \\ - \end{pmatrix}, + \end{bmatrix}, \quad s = 0.2, \quad α = 0.5, \quad δ = 0.8 $$ @@ -886,11 +886,11 @@ $$ - If you are unsure about your solution, you can start with the solved example: ```{math} -A = \begin{pmatrix} +A = \begin{bmatrix} 2 & 0 & 0 \\ 0 & 2 & 0 \\ 0 & 0 & 2 \\ - \end{pmatrix} + \end{bmatrix} ``` with $s = 0.3$, $α = 0.3$, and $δ = 0.4$ and starting value: @@ -999,23 +999,23 @@ In this exercise, let's try different initial values and check how Newton's meth Let's define a three-good problem with the following default values: $$ -A = \begin{pmatrix} +A = \begin{bmatrix} 0.2 & 0.1 & 0.7 \\ 0.3 & 0.2 & 0.5 \\ 0.1 & 0.8 & 0.1 \\ - \end{pmatrix}, + \end{bmatrix}, \qquad -b = \begin{pmatrix} +b = \begin{bmatrix} 1 \\ 1 \\ 1 - \end{pmatrix} + \end{bmatrix} \qquad \text{and} \qquad -c = \begin{pmatrix} +c = \begin{bmatrix} 1 \\ 1 \\ 1 - \end{pmatrix} + \end{bmatrix} $$ For this exercise, use the following extreme price vectors as initial values: diff --git a/lectures/opt_transport.md b/lectures/opt_transport.md index d8e19120f..9ce3215ef 100644 --- a/lectures/opt_transport.md +++ b/lectures/opt_transport.md @@ -185,12 +185,12 @@ The **Kronecker product** of $A$ and $B$ is defined, in block matrix form, by $$ A \otimes B = - \begin{pmatrix} + \begin{bmatrix} a_{11}B & a_{12}B & \dots & a_{1s}B \\ a_{21}B & a_{22}B & \dots & a_{2s}B \\ & & \vdots & \\ a_{m1}B & a_{m2}B & \dots & a_{ms}B \\ - \end{pmatrix}. + \end{bmatrix}. $$ $A \otimes B$ is an $mn \times st$ matrix. @@ -243,15 +243,15 @@ where $$ A = - \begin{pmatrix} + \begin{bmatrix} \mathbf{1}_n' \otimes \mathbf{I}_m \\ \mathbf{I}_n \otimes \mathbf{1}_m' \\ - \end{pmatrix} + \end{bmatrix} \quad \text{and} \quad - b = \begin{pmatrix} + b = \begin{bmatrix} p \\ q \\ - \end{pmatrix} + \end{bmatrix} $$ @@ -300,27 +300,27 @@ The numbers in the above table tell us to set $m = 3$, $n = 5$, and construct the following objects: $$ -p = \begin{pmatrix} +p = \begin{bmatrix} 50 \\ 100 \\ 150 - \end{pmatrix}, + \end{bmatrix}, \quad q = - \begin{pmatrix} + \begin{bmatrix} 25 \\ 115 \\ 60 \\ 30 \\ 70 - \end{pmatrix} + \end{bmatrix} \quad \text{and} \quad C = - \begin{pmatrix} + \begin{bmatrix} 10 &15 &20 &20 &40 \\ 20 &40 &15 &30 &30 \\ 30 &35 &40 &55 &25 - \end{pmatrix}. + \end{bmatrix}. $$ Let's write Python code that sets up the problem and solves it. @@ -576,7 +576,7 @@ We can write the dual problem as $$ \begin{aligned} \max_{u_i, v_j} \ & p u + q v \\ -\mbox{subject to } \ & A' \begin{pmatrix} u \\ v \\ \end{pmatrix} = \operatorname{vec}(C) \\ +\mbox{subject to } \ & A' \begin{bmatrix} u \\ v \\ \end{bmatrix} = \operatorname{vec}(C) \\ \end{aligned} $$ (dualproblem2) diff --git a/lectures/stats_examples.md b/lectures/stats_examples.md index 1d3a397b0..8e3f6bce4 100644 --- a/lectures/stats_examples.md +++ b/lectures/stats_examples.md @@ -105,7 +105,7 @@ Its distribution is $$ \begin{aligned} X & \sim NB(r,p) \\ -\textrm{Prob}(X=k;r,p) & = \begin{pmatrix}k+r-1 \\ r-1 \end{pmatrix}p^r(1-p)^{k} +\textrm{Prob}(X=k;r,p) & = \begin{bmatrix}k+r-1 \\ r-1 \end{bmatrix}p^r(1-p)^{k} \end{aligned} $$ diff --git a/lectures/svd_intro.md b/lectures/svd_intro.md index a24e43c7a..c4e1945bd 100644 --- a/lectures/svd_intro.md +++ b/lectures/svd_intro.md @@ -654,7 +654,7 @@ of rank $1$. Thus, we have $$ -X = \sigma_1 \begin{pmatrix}U_{11}V_{1}^\top \\U_{21}V_{1}^\top \\\cdots\\U_{m1}V_{1}^\top \\\end{pmatrix} + \sigma_2\begin{pmatrix}U_{12}V_{2}^\top \\U_{22}V_{2}^\top \\\cdots\\U_{m2}V_{2}^\top \\\end{pmatrix}+\ldots + \sigma_p\begin{pmatrix}U_{1p}V_{p}^\top \\U_{2p}V_{p}^\top \\\cdots\\U_{mp}V_{p}^\top \\\end{pmatrix} +X = \sigma_1 \begin{bmatrix}U_{11}V_{1}^\top \\U_{21}V_{1}^\top \\\cdots\\U_{m1}V_{1}^\top \\\end{bmatrix} + \sigma_2\begin{bmatrix}U_{12}V_{2}^\top \\U_{22}V_{2}^\top \\\cdots\\U_{m2}V_{2}^\top \\\end{bmatrix}+\ldots + \sigma_p\begin{bmatrix}U_{1p}V_{p}^\top \\U_{2p}V_{p}^\top \\\cdots\\U_{mp}V_{p}^\top \\\end{bmatrix} $$ (eq:PCA2) Here is how we would interpret the objects in the matrix equation {eq}`eq:PCA2` in