Skip to content

Commit b0cef0a

Browse files
committed
main.Rmds added
1 parent c4740c4 commit b0cef0a

38 files changed

+2195
-1107
lines changed

.gitignore

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
*.[jJ][pP][gG]
2+
# *.[cC][sS][vV]
3+
*.[tT][xX][tT]
4+
*.[pP][yY][cC]
5+
16
###################
27
# RMD
38
###################
@@ -6,6 +11,19 @@ _img/
611
*.Rmd
712
!index.Rmd
813
!title.Rmd
14+
!main.Rmd
15+
16+
###################
17+
# R markdown
18+
###################
19+
20+
.Rproj.user
21+
.Rhistory
22+
.RData
23+
_publish.R
24+
_book
25+
_bookdown_files
26+
rsconnect
927

1028
###################
1129
# Images CSV

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ Please contact [FanWangEcon](https://fanwangecon.github.io/) for issues or probl
116116
3. [System of Linear Equations Row Echelon Form](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_row_echelon_form.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html)
117117
+ Two equations and two unknowns.
118118
+ Elementary row operations and row echelon form.
119+
4. [Matrix Inverse](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_inverse.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html)
120+
+ Find the inverse of a matrix.
119121

120122
# 7 Matrix Applications
121123

README_appendix.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@
104104
3. [System of Linear Equations Row Echelon Form](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_row_echelon_form.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html)
105105
+ Two equations and two unknowns.
106106
+ Elementary row operations and row echelon form.
107+
4. [Matrix Inverse](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_inverse.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html)
108+
+ Find the inverse of a matrix.
107109

108110
## Matrix Applications links
109111

README_toc.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
3. [System of Linear Equations Row Echelon Form](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_row_echelon_form.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_row_echelon_form.html)
101101
+ Two equations and two unknowns.
102102
+ Elementary row operations and row echelon form.
103+
4. [Matrix Inverse](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html): [**mlx**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_inverse.mlx) \| [**m**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.m) \| [**pdf**](https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.pdf) \| [**html**](https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html)
104+
+ Find the inverse of a matrix.
103105

104106
# 7 Matrix Applications
105107

REconTools-Ex.timings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ff_sup_git_status_check 0.00 0.00 0.11

_bookdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ rmd_files:
4242
- matrix_system_of_equations/matrix_linear_equations.Rmd
4343
- matrix_system_of_equations/matrix_linear_system_2.Rmd
4444
- matrix_system_of_equations/matrix_row_echelon_form.Rmd
45+
- matrix_system_of_equations/matrix_inverse.Rmd
4546

4647
- matrix_application/main.Rmd
4748
- matrix_application/KL_borrowhire_firm.Rmd
Binary file not shown.

bookdown/Introductory-Mathematics-for-Economists-with-Matlab.tex

Lines changed: 126 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
% Allow footnotes in longtable head/foot
5656
\IfFileExists{footnotehyper.sty}{\usepackage{footnotehyper}}{\usepackage{footnote}}
5757
\makesavenoteenv{longtable}
58-
\usepackage{graphicx,grffile}
58+
\usepackage{graphicx}
5959
\makeatletter
6060
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
6161
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
@@ -104,7 +104,7 @@
104104

105105
\title{Introductory Mathematics for Economists with Matlab}
106106
\author{Fan Wang}
107-
\date{2020-05-31}
107+
\date{2020-06-08}
108108

109109
\begin{document}
110110
\maketitle
@@ -361,7 +361,7 @@ \section{Function Notations}\label{function-notations}}
361361
there are multiple functional relationships in an economic model,
362362
different letters could be used, for example:
363363

364-
\[y=f(h),l=g(h),u=w(h)\]
364+
\[y=Y(h),l=L(h),u=U(h)\]
365365

366366
These three equations could be from a model where:
367367

@@ -378,26 +378,27 @@ \section{Function Notations}\label{function-notations}}
378378
\(u\) is the overall level of utility as a function of work hours.
379379
\end{itemize}
380380

381-
Sometimes we have to write down many functions, and we can potentially
382-
run out of letters. Hence, you might potentially want to use
383-
superscripts:
381+
Or you might potentially want to use superscripts:
384382

385383
\[y=f^y (h),l=f^l (h),u=f^w (h)\]
386384

387-
or we could use the same letter for function as the letter for the value
388-
of the function, although this could be confusing because the function
389-
mapping would have the same notation as a value of the function:
385+
Or we could use the same letter (small cap) for function as the letter
386+
for the value of the function:
390387

391388
\[y=y(h),l=l(h),u=u(h)\]
392389

393-
if the above notation seems unclear, you can perhaps use more cursive
394-
letters for functions, latex offers different fonts/typesetting options:
390+
Or maybe even more letters:
395391

396-
\[y=\mathcal{y}(h),l=\mathcal{l}(h),u=\mathcal{u}(h)\]
392+
\[y=PROD(h),l=LEIS(h),u=UTIL(h)\]
397393

398-
Again, make sure you are clear about what your notations mean. Math
399-
should help make our econ ideas more clear to ourselves and others, and
400-
that starts with clear functional notations.
394+
Or perhaps different single letters than the output:
395+
396+
\[y=f(h),l=g(h),u=v(h)\]
397+
398+
Each notation structure could be confusing, make sure you are clear
399+
about what your notations mean. Math should help make our ideas more
400+
clear to ourselves and others, and that starts with clear functional
401+
notations.
401402

402403
\hypertarget{monomial-and-polynomial}{%
403404
\section{Monomial and Polynomial}\label{monomial-and-polynomial}}
@@ -3839,6 +3840,108 @@ \subsection{Reduced Row Echelon Form with 2 Equations and 2 Unknowns}\label{redu
38393840
\(\displaystyle x_2 =\frac{pa-od}{ea-db}\)
38403841
\end{itemize}
38413842

3843+
\hypertarget{matrix-inverse}{%
3844+
\section{Matrix Inverse}\label{matrix-inverse}}
3845+
3846+
\begin{quote}
3847+
Go back to \href{http://fanwangecon.github.io/}{fan}'s \href{https://fanwangecon.github.io/CodeDynaAsset/}{CodeDynaAsset} Package, \href{https://fanwangecon.github.io/M4Econ/}{Matlab Code Examples} Repository (\href{https://fanwangecon.github.io/M4Econ/bookdown}{bookdown site}), or \href{https://fanwangecon.github.io/Math4Econ/}{Math for Econ with Matlab} Repository (\href{https://fanwangecon.github.io/Math4Econ/bookdown}{bookdown site}).
3848+
\end{quote}
3849+
3850+
\hypertarget{inverse-of-a-matrix}{%
3851+
\subsection{Inverse of a Matrix}\label{inverse-of-a-matrix}}
3852+
3853+
The inverse of \(5\) is \(\frac{1}{5}\), multiplying the two numbers
3854+
together gives us 1. What is the inverse of a matrix?
3855+
3856+
The product of the inverse of a matrix and the matrix itself is the
3857+
identity matrix.
3858+
3859+
\begin{itemize}
3860+
\item
3861+
\(\displaystyle X^{-1} X=I\)
3862+
\item
3863+
\(\displaystyle XX^{-1} =I\)
3864+
\end{itemize}
3865+
3866+
If we generate any random square matrix in matlab, there is always an
3867+
inverse:
3868+
3869+
\begin{verbatim}
3870+
X = rand(3,3)
3871+
3872+
X = 3x3
3873+
0.5824 0.8004 0.9848
3874+
0.0707 0.2859 0.7157
3875+
0.9227 0.5437 0.8390
3876+
3877+
Xinverse = X^(-1)
3878+
3879+
Xinverse = 3x3
3880+
-0.8663 -0.7903 1.6911
3881+
3.4905 -2.4393 -2.0163
3882+
-1.3091 2.4499 0.6386
3883+
3884+
Identity = X*Xinverse
3885+
3886+
Identity = 3x3
3887+
1.0000 0.0000 0.0000
3888+
-0.0000 1.0000 0
3889+
0 -0.0000 1.0000
3890+
\end{verbatim}
3891+
3892+
\hypertarget{rank-of-a-matrix}{%
3893+
\subsection{Rank of a Matrix}\label{rank-of-a-matrix}}
3894+
3895+
\begin{itemize}
3896+
\tightlist
3897+
\item
3898+
(SB P142) \textbf{Rank:} The rank of a matrix is the number of non-zero
3899+
rows in its row echelon form
3900+
\end{itemize}
3901+
3902+
The Rank of a matrix is the number of non-zero rows in the row-echelon
3903+
form of the matrix. With 2 equations and 2 unknowns, it just means the
3904+
two lines are not parallel to each other. If two lines are parallel,
3905+
then through elementary row operations, one will become all zero, and
3906+
the system of equations will have no solution.
3907+
3908+
\hypertarget{invertible-matrix}{%
3909+
\subsection{Invertible Matrix}\label{invertible-matrix}}
3910+
3911+
A square matrix that is invertible has full rank, which means the number
3912+
of rows equals to the number of columns and the rank of the matrix. This
3913+
matrix is full-ranked, non-singular and invertible.
3914+
3915+
\hypertarget{solving-system-of-equations-using-inverse}{%
3916+
\subsection{Solving System of Equations using Inverse}\label{solving-system-of-equations-using-inverse}}
3917+
3918+
Given the \(N\) by \(N\) coefficient matrix \(W\) from a system of linear
3919+
equations, a \(N\) by \(1\) vector of unkonwns \(X\), and \(N\) by \(1\) vector of
3920+
outcome values \(v\):
3921+
3922+
\begin{itemize}
3923+
\tightlist
3924+
\item
3925+
\(\displaystyle W\cdot X=v\)
3926+
\end{itemize}
3927+
3928+
We can solve for the unknowns by using inverse:
3929+
3930+
\begin{enumerate}
3931+
\def\labelenumi{\arabic{enumi}.}
3932+
\item
3933+
\emph{multiply inverse both
3934+
sides}:\((W^{-1} \cdot W)\cdot X=W^{-1} \cdot v\)
3935+
\item
3936+
left-hand side bomces: \(I\cdot X=W^{-1} \cdot v\)
3937+
\item
3938+
Identity times a matrix is that matrix, hence: \(X=W^{-1} \cdot v\)
3939+
\end{enumerate}
3940+
3941+
When we use matlab, as an alternative to using the function linsolve, we
3942+
can solve for the unknown \(X\) just by taking the inverse of the
3943+
coefficient matrix \(W^{-1}\) and multiply it by \(v\).
3944+
38423945
\hypertarget{matrix-applications}{%
38433946
\chapter{Matrix Applications}\label{matrix-applications}}
38443947

@@ -8751,6 +8854,14 @@ \section{System of Equations links}\label{system-of-equations-links}}
87518854
\item
87528855
Elementary row operations and row echelon form.
87538856
\end{itemize}
8857+
\item
8858+
\href{https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html}{Matrix Inverse}: \href{https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/matrix_inverse.mlx}{\textbf{mlx}} \textbar{} \href{https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.m}{\textbf{m}} \textbar{} \href{https://github.com/FanWangEcon/Math4Econ/blob/master/matrix_system_of_equations/htmlpdfm/matrix_inverse.pdf}{\textbf{pdf}} \textbar{} \href{https://fanwangecon.github.io/Math4Econ/matrix_system_of_equations/htmlpdfm/matrix_inverse.html}{\textbf{html}}
8859+
8860+
\begin{itemize}
8861+
\tightlist
8862+
\item
8863+
Find the inverse of a matrix.
8864+
\end{itemize}
87548865
\end{enumerate}
87558866

87568867
\hypertarget{matrix-applications-links}{%

0 commit comments

Comments
 (0)