Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 15
1
\documentclass{article}
2
3
% set font encoding for PDFLaTeX, XeLaTeX, or LuaTeX
4
\usepackage{ifxetex,ifluatex}
5
\newif\ifxetexorluatex
6
\ifxetex
7
\xetexorluatextrue
8
\else
9
\ifluatex
10
\xetexorluatextrue
11
\else
12
\xetexorluatexfalse
13
\fi
14
\fi
15
16
\ifxetexorluatex
17
\usepackage{fontspec}
18
\else
19
\usepackage[T1]{fontenc}
20
\usepackage[utf8]{inputenc}
21
\usepackage{lmodern}
22
\fi
23
24
\usepackage{hyperref}
25
26
27
\usepackage{amsmath}
28
\usepackage{graphicx}
29
\graphicspath{ {./ }}
30
\usepackage{caption}
31
\usepackage{enumitem}
32
\usepackage{verbatim}
33
34
\title{Lab 3 Report}
35
\author{Isaac Shaeffer and Satori Kubo}
36
37
% Enable SageTeX to run SageMath code right inside this LaTeX file.
38
% http://mirrors.ctan.org/macros/latex/contrib/sagetex/sagetexpackage.pdf
39
% \usepackage{sagetex}
40
41
\begin{document}
42
\maketitle
43
44
\begin{enumerate}
45
46
% Part 1
47
\item
48
49
% Part 1.a
50
\begin{enumerate}
51
\item Solving the normal equations, we obtain
52
\[
53
A = \left(\begin{array}{rr}
54
1 & 1 \\
55
1 & 2 \\
56
1 & 4 \\
57
1 & 5
58
\end{array}\right),
59
\hat{\beta} = \left(\begin{array}{r}
60
- \frac{3}{5}\\
61
\frac{7}{10}
62
\end{array}\right) \text{ and }
63
\textbf{b} =
64
\left(\begin{array}{r}
65
0 \\
66
1 \\
67
2 \\
68
3
69
\end{array}\right)
70
\]
71
72
% Part 1.b
73
\item The line of best fit is $y = \frac{7}{10}x - \frac{3}{5}$.
74
\begin{figure}[h]
75
\includegraphics[width=10cm]{plot1lab3_part1}
76
\centering
77
\captionof{figure}{ $y = \frac{7}{10}x - \frac{3}{5}$ }
78
\end{figure}
79
\end{enumerate}
80
81
\clearpage
82
% Part 2
83
\item Changing the the first two data points, we obtain a line with a negative slope that doesn't fit the data well. \par
84
85
\begin{minipage}{\linewidth}
86
\includegraphics[width=10cm]{plot1lab3_part2}
87
\centering
88
\captionof{figure}{$y = -\frac{3}{10} x + \frac{73}{20} $}
89
\end{minipage}
90
91
% Part 3
92
\item \par
93
94
\begin{minipage}{\linewidth}
95
\includegraphics[width=10cm]{plot1lab3_part3}
96
\centering
97
\captionof{figure}{$y = \frac{513}{2800} \, x + \frac{261}{280} $}
98
\end{minipage}
99
100
% Part 4
101
\item \par
102
103
\begin{minipage}{\linewidth}
104
\includegraphics[width=10cm]{plot1lab3_part4}
105
\centering
106
\captionof{figure}{Curve of best fit: $y = 2.342\cos{x} + 7.448\sin{x}$}
107
\end{minipage}
108
109
% Part 5
110
\item \par
111
\begin{minipage}{\linewidth}
112
\includegraphics[width=10cm]{plot1lab3_part5}
113
\centering
114
\captionof{figure}{Curve of best fit: $y = 19.94e^{-0.02t} + 10.10e^{-0.07t}$}
115
\end{minipage}
116
117
% Part 6
118
\clearpage
119
\item The systolic blood pressure of a child weighing 100 lbs is
120
\[ p(100) = 38.77 \, \log\left(10\right) + 17.92 = 107. \] \par
121
\begin{minipage}{\linewidth}
122
\includegraphics[width=10cm]{plot1lab3_part6}
123
\centering
124
\captionof{figure}{Curve of best fit: $p = 19.38\log\left(w\right) + 17.92$}
125
\end{minipage}
126
127
% Part 7
128
\item At time $t = 4.5$ seconds, the plane's velocity is 52.7 feet per second. \par
129
\begin{minipage}{\linewidth}
130
\includegraphics[width=10cm]{plot1lab3_part7}
131
\centering
132
\captionof{figure}{Curve of best fit: $y = - 0.00652t^{3} + 5.17t^{2} + 6.60t - 2.52$}
133
\end{minipage}
134
135
\clearpage
136
% Part 8
137
\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:
138
139
\begin{verbatim}
140
A = matrix(RDF, [[x-values and constants]])
141
b = matrix([[y-values]])
142
143
A1 = A.transpose()*A # the left side of the equation
144
b1 = A.transpose()*b # the right side of the equation
145
146
A1.augment(b1).rref() # the entries of the last
147
# column are the solutions
148
# to the equation
149
\end{verbatim}
150
151
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
152
\begin{verbatim}
153
A = matrix(QQ, 13, 4, lambda i, j: i^j)
154
\end{verbatim}
155
156
157
\end{enumerate}
158
159
\end{document}
160
161