summaryrefslogtreecommitdiff
path: root/homeworks
diff options
context:
space:
mode:
Diffstat (limited to 'homeworks')
-rw-r--r--homeworks/hw-5.org59
-rw-r--r--homeworks/hw-5.pdfbin0 -> 81313 bytes
-rw-r--r--homeworks/hw-5.tex95
3 files changed, 154 insertions, 0 deletions
diff --git a/homeworks/hw-5.org b/homeworks/hw-5.org
new file mode 100644
index 0000000..d650375
--- /dev/null
+++ b/homeworks/hw-5.org
@@ -0,0 +1,59 @@
+#+TITLE: Homework 5
+#+AUTHOR: Elizabeth Hunt
+#+LATEX_HEADER: \notindent \notag \usepackage{amsmath} \usepackage[a4paper,margin=1in,portrait]{geometry}
+#+LATEX: \setlength\parindent{0pt}
+#+OPTIONS: toc:nil
+
+* Question One
+See LIZFCM \rightarrow Matrix Routines \rightarrow ~lu decomp~ & ~bsubst~.
+
+The test ~UTEST(matrix, lu_decomp)~ is a unit test for the ~lu_decomp~ routine,
+and ~UTEST(matrix, bsubst)~ verifies back substitution on an upper triangular
+3 \times 3 matrix with a known solution that can be verified manually.
+
+Both can be found in ~tests/matrix.t.c~.
+
+* Question Two
+Unless the following are met, the resulting solution will be garbage.
+
+1. The matrix $U$ must be not be singular.
+2. $U$ must be square (or it will fail the ~assert~).
+3. The system created by $Ux = b$ must be consistent.
+4. $U$ is in (obviously) upper-triangular form.
+
+Thus, the actual calculation performing the $LU$ decomposition
+(in ~lu_decomp~) does a sanity
+check for 1-3 will fail an assert, should a point along the diagonal (pivot) be
+zero, or the matrix be non-factorable.
+
+* Question Three
+See LIZFCM \rightarrow Matrix Routines \rightarrow ~fsubst~.
+
+~UTEST(matrix, fsubst)~ verifies forward substitution on a lower triangular 3 \times 3
+matrix with a known solution that can be verified manually.
+
+* Question Four
+
+See LIZFCM \rightarrow Matrix Routines \rightarrow ~gaussian_elimination~ and ~solve_gaussian_elimination~.
+
+* Question Five
+See LIZFCM \rightarrow Matrix Routines \rightarrow ~m_dot_v~, and the ~UTEST(matrix, m_dot_v)~ in
+~tests/matrix.t.c~.
+
+* Question Six
+See ~UTEST(matrix, solve_gaussian_elimination)~ in ~tests/matrix.t.c~, which generates a diagonally dominant 10 \times 10 matrix
+and shows that the solution is consistent with the initial matrix, according to the steps given. Then,
+we do a dot product between each row of the diagonally dominant matrix and the solution vector to ensure
+it is near equivalent to the input vector.
+
+* Question Seven
+See ~UTEST(matrix, solve_matrix_lu_bsubst)~ which does the same test in Question Six with the solution according to
+~solve_matrix_lu_bsubst~ as shown in the Software Manual.
+
+* Question Eight
+No, since the time complexity for Gaussian Elimination is always less than that of the LU factorization solution by $O(n^2)$ operations
+(in LU factorization we perform both backwards and forwards substitutions proceeding the LU decomp, in Gaussian Elimination we only need
+back substitution).
+
+* Question Nine, Ten
+See LIZFCM Software manual and shared library in ~dist~ after compiling.
diff --git a/homeworks/hw-5.pdf b/homeworks/hw-5.pdf
new file mode 100644
index 0000000..ce43787
--- /dev/null
+++ b/homeworks/hw-5.pdf
Binary files differ
diff --git a/homeworks/hw-5.tex b/homeworks/hw-5.tex
new file mode 100644
index 0000000..8b9d24b
--- /dev/null
+++ b/homeworks/hw-5.tex
@@ -0,0 +1,95 @@
+% Created 2023-10-30 Mon 19:05
+% Intended LaTeX compiler: pdflatex
+\documentclass[11pt]{article}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{graphicx}
+\usepackage{longtable}
+\usepackage{wrapfig}
+\usepackage{rotating}
+\usepackage[normalem]{ulem}
+\usepackage{amsmath}
+\usepackage{amssymb}
+\usepackage{capt-of}
+\usepackage{hyperref}
+\notindent \notag \usepackage{amsmath} \usepackage[a4paper,margin=1in,portrait]{geometry}
+\author{Elizabeth Hunt}
+\date{\today}
+\title{Homework 5}
+\hypersetup{
+ pdfauthor={Elizabeth Hunt},
+ pdftitle={Homework 5},
+ pdfkeywords={},
+ pdfsubject={},
+ pdfcreator={Emacs 28.2 (Org mode 9.7-pre)},
+ pdflang={English}}
+\begin{document}
+
+\maketitle
+\setlength\parindent{0pt}
+
+\section{Question One}
+\label{sec:org88abf18}
+See LIZFCM \(\rightarrow\) Matrix Routines \(\rightarrow\) \texttt{lu decomp} \& \texttt{bsubst}.
+
+The test \texttt{UTEST(matrix, lu\_decomp)} is a unit test for the \texttt{lu\_decomp} routine,
+and \texttt{UTEST(matrix, bsubst)} verifies back substitution on an upper triangular
+3 \texttimes{} 3 matrix with a known solution that can be verified manually.
+
+Both can be found in \texttt{tests/matrix.t.c}.
+
+\section{Question Two}
+\label{sec:org098a7f1}
+Unless the following are met, the resulting solution will be garbage.
+
+\begin{enumerate}
+\item The matrix \(U\) must be not be singular.
+\item \(U\) must be square (or it will fail the \texttt{assert}).
+\item The system created by \(Ux = b\) must be consistent.
+\item \(U\) is in (obviously) upper-triangular form.
+\end{enumerate}
+
+Thus, the actual calculation performing the \(LU\) decomposition
+(in \texttt{lu\_decomp}) does a sanity
+check for 1-3 will fail an assert, should a point along the diagonal (pivot) be
+zero, or the matrix be non-factorable.
+
+\section{Question Three}
+\label{sec:org40d5983}
+See LIZFCM \(\rightarrow\) Matrix Routines \(\rightarrow\) \texttt{fsubst}.
+
+\texttt{UTEST(matrix, fsubst)} verifies forward substitution on a lower triangular 3 \texttimes{} 3
+matrix with a known solution that can be verified manually.
+
+\section{Question Four}
+\label{sec:orgf7d23bb}
+
+See LIZFCM \(\rightarrow\) Matrix Routines \(\rightarrow\) \texttt{gaussian\_elimination} and \texttt{solve\_gaussian\_elimination}.
+
+\section{Question Five}
+\label{sec:org54e966c}
+See LIZFCM \(\rightarrow\) Matrix Routines \(\rightarrow\) \texttt{m\_dot\_v}, and the \texttt{UTEST(matrix, m\_dot\_v)} in
+\texttt{tests/matrix.t.c}.
+
+\section{Question Six}
+\label{sec:org413b527}
+See \texttt{UTEST(matrix, solve\_gaussian\_elimination)} in \texttt{tests/matrix.t.c}, which generates a diagonally dominant 10 \texttimes{} 10 matrix
+and shows that the solution is consistent with the initial matrix, according to the steps given. Then,
+we do a dot product between each row of the diagonally dominant matrix and the solution vector to ensure
+it is near equivalent to the input vector.
+
+\section{Question Seven}
+\label{sec:orgd3d7443}
+See \texttt{UTEST(matrix, solve\_matrix\_lu\_bsubst)} which does the same test in Question Six with the solution according to
+\texttt{solve\_matrix\_lu\_bsubst} as shown in the Software Manual.
+
+\section{Question Eight}
+\label{sec:orgf8ac9bf}
+No, since the time complexity for Gaussian Elimination is always less than that of the LU factorization solution by \(O(n^2)\) operations
+(in LU factorization we perform both backwards and forwards substitutions proceeding the LU decomp, in Gaussian Elimination we only need
+back substitution).
+
+\section{Question Nine, Ten}
+\label{sec:orgb270171}
+See LIZFCM Software manual and shared library in \texttt{dist} after compiling.
+\end{document} \ No newline at end of file