diff options
author | Puneeth Chaganti | 2009-11-05 13:13:58 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2009-11-05 13:13:58 +0530 |
commit | 32089af016a0cdf42b394b6b5e55663af3b5c541 (patch) | |
tree | fb97418b4ebef6e1073f6282eabb874642a23e9a /day1/session4.tex | |
parent | c2576a2aa7c0f6643ab59cbe7ecfdff65cba669b (diff) | |
download | workshops-32089af016a0cdf42b394b6b5e55663af3b5c541.tar.gz workshops-32089af016a0cdf42b394b6b5e55663af3b5c541.tar.bz2 workshops-32089af016a0cdf42b394b6b5e55663af3b5c541.zip |
Moved Solving Linear Equations to session 6.
Diffstat (limited to 'day1/session4.tex')
-rw-r--r-- | day1/session4.tex | 154 |
1 files changed, 0 insertions, 154 deletions
diff --git a/day1/session4.tex b/day1/session4.tex index 576c759..22de88f 100644 --- a/day1/session4.tex +++ b/day1/session4.tex @@ -476,160 +476,6 @@ In []: plot(L, Tline) \end{lstlisting} \end{frame} -\section{Solving linear equations} - -\begin{frame}[fragile] -\frametitle{Solution of equations} -Consider, - \begin{align*} - 3x + 2y - z & = 1 \\ - 2x - 2y + 4z & = -2 \\ - -x + \frac{1}{2}y -z & = 0 - \end{align*} -Solution: - \begin{align*} - x & = 1 \\ - y & = -2 \\ - z & = -2 - \end{align*} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Solving using Matrices} -Let us now look at how to solve this using \kwrd{matrices} - \begin{lstlisting} - In []: A = array([[3,2,-1], - [2,-2,4], - [-1, 0.5, -1]]) - In []: b = array([[1], [-2], [0]]) - In []: x = solve(A, b) - In []: Ax = dot(A,x) - \end{lstlisting} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Solution:} -\begin{lstlisting} -In []: x -Out[]: -array([[ 1.], - [-2.], - [-2.]]) -\end{lstlisting} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Let's check!} -\begin{lstlisting} -In []: Ax -Out[]: -array([[ 1.00000000e+00], - [ -2.00000000e+00], - [ 2.22044605e-16]]) -\end{lstlisting} -\begin{block}{} -The last term in the matrix is actually \alert{0}!\\ -We can use \kwrd{allclose()} to check. -\end{block} -\begin{lstlisting} -In []: allclose(Ax, b) -Out[]: True -\end{lstlisting} -\inctime{15} -\end{frame} - -\subsection{Exercises} - -\begin{frame}[fragile] -\frametitle{Problem 1} -Given the matrix:\\ -\begin{center} -$\begin{bmatrix} --2 & 2 & 3\\ - 2 & 1 & 6\\ --1 &-2 & 0\\ -\end{bmatrix}$ -\end{center} -Find: -\begin{itemize} - \item[i] Transpose - \item[ii]Inverse - \item[iii]Determinant - \item[iv] Eigenvalues and Eigen vectors - \item[v] Singular Value decomposition -\end{itemize} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Problem 2} -Given -\begin{center} -A = -$\begin{bmatrix} --3 & 1 & 5 \\ -1 & 0 & -2 \\ -5 & -2 & 4 \\ -\end{bmatrix}$ -, B = -$\begin{bmatrix} -0 & 9 & -12 \\ --9 & 0 & 20 \\ -12 & -20 & 0 \\ -\end{bmatrix}$ -\end{center} -Find: -\begin{itemize} - \item[i] Sum of A and B - \item[ii]Elementwise Product of A and B - \item[iii] Matrix product of A and B -\end{itemize} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Solution} -Sum: -$\begin{bmatrix} --3 & 10 & 7 \\ --8 & 0 & 18 \\ -17 & -22 & 4 \\ -\end{bmatrix}$ -,\\ Elementwise Product: -$\begin{bmatrix} -0 & 9 & -60 \\ --9 & 0 & -40 \\ -60 & 40 & 0 \\ -\end{bmatrix}$ -,\\ Matrix product: -$\begin{bmatrix} -51 & -127 & 56 \\ --24 & 49 & -12 \\ -66 & -35 & -100 \\ -\end{bmatrix}$ -\end{frame} - -\begin{frame}[fragile] -\frametitle{Problem 3} -Solve the set of equations: -\begin{align*} - x + y + 2z -w & = 3\\ - 2x + 5y - z - 9w & = -3\\ - 2x + y -z + 3w & = -11 \\ - x - 3y + 2z + 7w & = -5\\ -\end{align*} -\inctime{10} -\end{frame} - -\begin{frame}[fragile] -\frametitle{Solution} -Use \kwrd{solve()} -\begin{align*} - x & = -5\\ - y & = 2\\ - z & = 3\\ - w & = 0\\ -\end{align*} -\end{frame} - \section{Summary} \begin{frame} \frametitle{What did we learn??} |