\documentclass{article}
\usepackage{ifxetex,ifluatex}
\newif\ifxetexorluatex
\ifxetex
\xetexorluatextrue
\else
\ifluatex
\xetexorluatextrue
\else
\xetexorluatexfalse
\fi
\fi
\ifxetexorluatex
\usepackage{fontspec}
\else
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\fi
\usepackage{hyperref}
\usepackage{amsmath}
\usepackage{graphicx}
\graphicspath{ {./ }}
\usepackage{caption}
\usepackage{enumitem}
\usepackage{verbatim}
\title{Lab 3 Report}
\author{Isaac Shaeffer and Satori Kubo}
\begin{document}
\maketitle
\begin{enumerate}
\item
\begin{enumerate}
\item Solving the normal equations, we obtain
\[
A = \left(\begin{array}{rr}
1 & 1 \\
1 & 2 \\
1 & 4 \\
1 & 5
\end{array}\right),
\hat{\beta} = \left(\begin{array}{r}
- \frac{3}{5}\\
\frac{7}{10}
\end{array}\right) \text{ and }
\textbf{b} =
\left(\begin{array}{r}
0 \\
1 \\
2 \\
3
\end{array}\right)
\]
\item The line of best fit is $y = \frac{7}{10}x - \frac{3}{5}$.
\begin{figure}[h]
\includegraphics[width=10cm]{plot1lab3_part1}
\centering
\captionof{figure}{ $y = \frac{7}{10}x - \frac{3}{5}$ }
\end{figure}
\end{enumerate}
\clearpage
\item Changing the the first two data points, we obtain a line with a negative slope that doesn't fit the data well. \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part2}
\centering
\captionof{figure}{$y = -\frac{3}{10} x + \frac{73}{20} $}
\end{minipage}
\item \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part3}
\centering
\captionof{figure}{$y = \frac{513}{2800} \, x + \frac{261}{280} $}
\end{minipage}
\item \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part4}
\centering
\captionof{figure}{Curve of best fit: $y = 2.342\cos{x} + 7.448\sin{x}$}
\end{minipage}
\item \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part5}
\centering
\captionof{figure}{Curve of best fit: $y = 19.94e^{-0.02t} + 10.10e^{-0.07t}$}
\end{minipage}
\clearpage
\item The systolic blood pressure of a child weighing 100 lbs is
\[ p(100) = 38.77 \, \log\left(10\right) + 17.92 = 107. \] \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part6}
\centering
\captionof{figure}{Curve of best fit: $p = 19.38\log\left(w\right) + 17.92$}
\end{minipage}
\item At time $t = 4.5$ seconds, the plane's velocity is 52.7 feet per second. \par
\begin{minipage}{\linewidth}
\includegraphics[width=10cm]{plot1lab3_part7}
\centering
\captionof{figure}{Curve of best fit: $y = - 0.00652t^{3} + 5.17t^{2} + 6.60t - 2.52$}
\end{minipage}
\clearpage
\item The main idea we explored was how to associate a data set with curve using a matrix. We then translated the matrix equation $A^T A\hat{\beta} = A^T\textbf{b}$ into Python code:
\begin{verbatim}
A = matrix(RDF, [[x-values and constants]])
b = matrix([[y-values]])
A1 = A.transpose()*A # the left side of the equation
b1 = A.transpose()*b # the right side of the equation
A1.augment(b1).rref() # the entries of the last
# column are the solutions
# to the equation
\end{verbatim}
We also learned about several new utility functions for this lab. First, we learned that defining a symbolic function is just like defining a normal python function. We explored plotted functions and data points with the `plot()` function. We also learned about Pythons anonymous lambda functions which we used to generate the large Matrix in part 7 with the command
\begin{verbatim}
A = matrix(QQ, 13, 4, lambda i, j: i^j)
\end{verbatim}
\end{enumerate}
\end{document}