Skip to content
Permalink
Newer
Older
100644 734 lines (552 sloc) 31.2 KB
Feb 23, 2017
1
2
% Default to the notebook output style
3
4
5
6
7
% Inherit from the specified cell style.
8
9
10
11
12
13
\documentclass[11pt]{article}
14
15
16
17
\usepackage[T1]{fontenc}
18
% Nicer default font (+ math font) than Computer Modern for most use cases
19
\usepackage{mathpazo}
20
21
% Basic figure setup, for now with no caption control since it's done
22
% automatically by Pandoc (which extracts ![](path) syntax from Markdown).
23
\usepackage{graphicx}
24
% We will generate all images so they have a width \maxwidth. This means
25
% that they will get their normal width if they fit onto the page, but
26
% are scaled down if they would overflow the margins.
27
\makeatletter
28
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth
29
\else\Gin@nat@width\fi}
30
\makeatother
31
\let\Oldincludegraphics\includegraphics
32
% Set max figure width to be 80% of text width, for now hardcoded.
33
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}}
34
% Ensure that by default, figures have no caption (until we provide a
35
% proper Figure object with a Caption API and a way to capture that
36
% in the conversion process - todo).
37
\usepackage{caption}
38
\DeclareCaptionLabelFormat{nolabel}{}
39
\captionsetup{labelformat=nolabel}
40
41
\usepackage{adjustbox} % Used to constrain images to a maximum size
42
\usepackage{xcolor} % Allow colors to be defined
43
\usepackage{enumerate} % Needed for markdown enumerations to work
44
\usepackage{geometry} % Used to adjust the document margins
45
\usepackage{amsmath} % Equations
46
\usepackage{amssymb} % Equations
47
\usepackage{textcomp} % defines textquotesingle
48
% Hack from http://tex.stackexchange.com/a/47451/13684:
49
\AtBeginDocument{%
50
\def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code
51
}
52
\usepackage{upquote} % Upright quotes for verbatim code
53
\usepackage{eurosym} % defines \euro
54
\usepackage[mathletters]{ucs} % Extended unicode (utf-8) support
55
\usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document
56
\usepackage{fancyvrb} % verbatim replacement that allows latex
57
\usepackage{grffile} % extends the file name processing of package graphics
58
% to support a larger range
59
% The hyperref package gives us a pdf with properly built
60
% internal navigation ('pdf bookmarks' for the table of contents,
61
% internal cross-reference links, web links for URLs, etc.)
62
\usepackage{hyperref}
63
\usepackage{longtable} % longtable support required by pandoc >1.10
64
\usepackage{booktabs} % table support for pandoc > 1.12.2
65
\usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment)
66
\usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout)
67
% normalem makes italics be italics, not underlines
68
69
70
71
72
% Colors for the hyperref package
73
\definecolor{urlcolor}{rgb}{0,.145,.698}
74
\definecolor{linkcolor}{rgb}{.71,0.21,0.01}
75
\definecolor{citecolor}{rgb}{.12,.54,.11}
76
77
% ANSI colors
78
\definecolor{ansi-black}{HTML}{3E424D}
79
\definecolor{ansi-black-intense}{HTML}{282C36}
80
\definecolor{ansi-red}{HTML}{E75C58}
81
\definecolor{ansi-red-intense}{HTML}{B22B31}
82
\definecolor{ansi-green}{HTML}{00A250}
83
\definecolor{ansi-green-intense}{HTML}{007427}
84
\definecolor{ansi-yellow}{HTML}{DDB62B}
85
\definecolor{ansi-yellow-intense}{HTML}{B27D12}
86
\definecolor{ansi-blue}{HTML}{208FFB}
87
\definecolor{ansi-blue-intense}{HTML}{0065CA}
88
\definecolor{ansi-magenta}{HTML}{D160C4}
89
\definecolor{ansi-magenta-intense}{HTML}{A03196}
90
\definecolor{ansi-cyan}{HTML}{60C6C8}
91
\definecolor{ansi-cyan-intense}{HTML}{258F8F}
92
\definecolor{ansi-white}{HTML}{C5C1B4}
93
\definecolor{ansi-white-intense}{HTML}{A1A6B2}
94
95
% commands and environments needed by pandoc snippets
96
% extracted from the output of `pandoc -s`
97
\providecommand{\tightlist}{%
98
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
99
\DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
100
% Add ',fontsize=\small' for more characters per line
101
\newenvironment{Shaded}{}{}
102
\newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
103
\newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}}
104
\newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
105
\newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
106
\newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}}
107
\newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
108
\newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
109
\newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}}
110
\newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}}
111
\newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
112
\newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}}
113
\newcommand{\RegionMarkerTok}[1]{{#1}}
114
\newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}}
115
\newcommand{\NormalTok}[1]{{#1}}
116
117
% Additional commands for more recent versions of Pandoc
118
\newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}}
119
\newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
120
\newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}}
121
\newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}}
122
\newcommand{\ImportTok}[1]{{#1}}
123
\newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}}
124
\newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
125
\newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
126
\newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}}
127
\newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}}
128
\newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}}
129
\newcommand{\BuiltInTok}[1]{{#1}}
130
\newcommand{\ExtensionTok}[1]{{#1}}
131
\newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}}
132
\newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}}
133
\newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
134
\newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}}
135
136
137
% Define a nice break command that doesn't care if a line doesn't already
138
% exist.
139
\def\br{\hspace*{\fill} \\* }
140
% Math Jax compatability definitions
141
\def\gt{>}
142
\def\lt{<}
143
% Document parameters
144
\title{lecture\_11}
145
146
147
148
149
% Pygments definitions
150
151
\makeatletter
152
\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax%
153
\let\PY@ul=\relax \let\PY@tc=\relax%
154
\let\PY@bc=\relax \let\PY@ff=\relax}
155
\def\PY@tok#1{\csname PY@tok@#1\endcsname}
156
\def\PY@toks#1+{\ifx\relax#1\empty\else%
157
\PY@tok{#1}\expandafter\PY@toks\fi}
158
\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{%
159
\PY@it{\PY@bf{\PY@ff{#1}}}}}}}
160
\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}}
161
162
\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}}
163
\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}}
164
\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}}
165
\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf}
166
\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}}
167
\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
168
\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
169
\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
170
\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
171
\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
172
\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit}
173
\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
174
\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
175
\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}}
176
\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}}
177
\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}}
178
\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
179
\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}}
180
\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}}
181
\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
182
\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}}
183
\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}}
184
\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
185
\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
186
\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
187
\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}}
188
\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}}
189
\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
190
\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
191
\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
192
\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
193
\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
194
\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
195
\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
196
\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}}
197
\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
198
\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}}
199
\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
200
\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
201
\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
202
\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
203
\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
204
\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
205
\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
206
\expandafter\def\csname PY@tok@err\endcsname{\def\PY@bc##1{\setlength{\fboxsep}{0pt}\fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}
207
\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
208
\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}}
209
\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}}
210
\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
211
\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
212
\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}}
213
\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
214
\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}}
215
\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
216
\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
217
\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
218
\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}}
219
\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}}
220
\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
221
\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
222
\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}}
223
\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}}
224
\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}}
225
226
\def\PYZbs{\char`\\}
227
\def\PYZus{\char`\_}
228
\def\PYZob{\char`\{}
229
\def\PYZcb{\char`\}}
230
\def\PYZca{\char`\^}
231
\def\PYZam{\char`\&}
232
\def\PYZlt{\char`\<}
233
\def\PYZgt{\char`\>}
234
\def\PYZsh{\char`\#}
235
\def\PYZpc{\char`\%}
236
\def\PYZdl{\char`\$}
237
\def\PYZhy{\char`\-}
238
\def\PYZsq{\char`\'}
239
\def\PYZdq{\char`\"}
240
\def\PYZti{\char`\~}
241
% for compatibility with earlier versions
242
\def\PYZat{@}
243
\def\PYZlb{[}
244
\def\PYZrb{]}
245
\makeatother
246
247
248
% Exact colors from NB
249
\definecolor{incolor}{rgb}{0.0, 0.0, 0.5}
250
\definecolor{outcolor}{rgb}{0.545, 0.0, 0.0}
251
252
253
254
255
% Prevent overflowing lines due to hard-to-break entities
256
\sloppy
257
% Setup hyperref package
258
\hypersetup{
259
breaklinks=true, % so long urls are correctly broken across lines
260
colorlinks=true,
261
urlcolor=urlcolor,
262
linkcolor=linkcolor,
263
citecolor=citecolor,
264
}
265
% Slightly bigger margins than the latex defaults
266
267
\geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in}
268
269
270
271
\begin{document}
272
273
274
\maketitle
275
276
277
278
279
\begin{Verbatim}[commandchars=\\\{\}]
280
{\color{incolor}In [{\color{incolor}1}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg}
Feb 23, 2017
281
\end{Verbatim}
282
283
\begin{Verbatim}[commandchars=\\\{\}]
284
{\color{incolor}In [{\color{incolor}2}]:} \PY{n}{setdefaults}
Feb 23, 2017
285
\end{Verbatim}
286
287
\subsection{My question from last
288
class}\label{my-question-from-last-class}
289
290
\(A=\left[ \begin{array}{ccc} 10 & 2 & 1 \\ 0 & 1 & 1 \\ 0 & 0 & 10\end{array} \right]\)
291
292
\begin{figure}[htbp]
293
\centering
294
\includegraphics{det_A.png}
295
\caption{responses to determinant of A}
296
\end{figure}
297
298
\subsection{Your questions from last
299
class}\label{your-questions-from-last-class}
300
301
\begin{enumerate}
302
\def\labelenumi{\arabic{enumi}.}
303
\item
304
Need more linear algebra review
305
306
-We will keep doing Linear Algebra, try the practice problems in
307
'linear\_algebra'
308
\item
309
How do I do HW3?
310
311
-demo today
312
\item
313
For hw4 is the spring constant (K) suppose to be given?
314
315
-yes, its 30 N/m
316
\item
317
Deapool or Joker?
318
\end{enumerate}
319
320
\subsection{Midterm preference}\label{midterm-preference}
321
322
\begin{figure}[htbp]
323
\centering
324
\includegraphics{midterm_date.png}
325
\caption{responses to midterm date}
326
\end{figure}
327
328
\subsubsection{Midterm Questions}\label{midterm-questions}
329
330
\begin{enumerate}
331
\def\labelenumi{\arabic{enumi}.}
332
\item
333
Notes allowed
334
335
-no
336
\item
337
Will there be a review/study sheet
338
339
-yes
340
\end{enumerate}
341
Feb 23, 2017
342
\section{LU Decomposition}\label{lu-decomposition}
343
344
\subsubsection{efficient storage of matrices for
345
solutions}\label{efficient-storage-of-matrices-for-solutions}
346
347
Considering the same solution set:
348
349
\(y=Ax\)
350
351
Assume that we can perform Gauss elimination and achieve this formula:
352
353
\(Ux=d\)
354
355
Where, \(U\) is an upper triangular matrix that we derived from Gauss
356
elimination and \(d\) is the set of dependent variables after Gauss
357
elimination.
358
359
Assume there is a lower triangular matrix, \(L\), with ones on the
360
diagonal and same dimensions of \(U\) and the following is true:
361
362
\(L(Ux-d)=Ax-y=0\)
363
364
Now, \(Ax=LUx\), so \(A=LU\), and \(y=Ld\).
365
366
\(2x_{1}+x_{2}=1\)
367
368
\(x_{1}+3x_{2}=1\)
369
370
\(\left[ \begin{array}{cc} 2 & 1 \\ 1 & 3 \end{array} \right] \left[\begin{array}{c} x_{1} \\ x_{2} \end{array}\right]= \left[\begin{array}{c} 1 \\ 1\end{array}\right]\)
371
372
f21=0.5
373
374
A(2,1)=1-1 = 0
375
376
A(2,2)=3-0.5=2.5
377
378
y(2)=1-0.5=0.5
379
380
\(L(Ux-d)= \left[ \begin{array}{cc} 1 & 0 \\ 0.5 & 1 \end{array} \right] \left(\left[ \begin{array}{cc} 2 & 1 \\ 0 & 2.5 \end{array} \right] \left[\begin{array}{c} x_{1} \\ x_{2} \end{array}\right]- \left[\begin{array}{c} 1 \\ 0.5\end{array}\right]\right)=0\)
381
382
\begin{Verbatim}[commandchars=\\\{\}]
383
{\color{incolor}In [{\color{incolor}3}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{]}
384
\PY{n}{L}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mf}{0.5}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{]}
385
\PY{n}{U}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mf}{2.5}\PY{p}{]}
386
\PY{n}{L}\PY{o}{*}\PY{n}{U}
387
388
\PY{n}{d}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mf}{0.5}\PY{p}{]}
389
\PY{n}{y}\PY{p}{=}\PY{n}{L}\PY{o}{*}\PY{n}{d}
390
\end{Verbatim}
391
392
\begin{Verbatim}[commandchars=\\\{\}]
393
A =
394
395
2 1
396
1 3
397
398
L =
399
400
1.00000 0.00000
401
0.50000 1.00000
402
403
U =
404
405
2.00000 1.00000
406
0.00000 2.50000
407
408
ans =
409
410
2 1
411
1 3
412
413
d =
414
415
1.00000
416
0.50000
417
418
y =
419
420
1
421
1
422
423
424
\end{Verbatim}
425
426
\begin{Verbatim}[commandchars=\\\{\}]
427
{\color{incolor}In [{\color{incolor}5}]:} \PY{c}{\PYZpc{} what is the determinant of L, U and A?}
428
429
\PY{n+nb}{det}\PY{p}{(}\PY{n}{A}\PY{p}{)}
430
\PY{n+nb}{det}\PY{p}{(}\PY{n}{L}\PY{p}{)}
431
\PY{n+nb}{det}\PY{p}{(}\PY{n}{U}\PY{p}{)}
432
\PY{n+nb}{det}\PY{p}{(}\PY{n}{L}\PY{p}{)}\PY{o}{*}\PY{n+nb}{det}\PY{p}{(}\PY{n}{U}\PY{p}{)}
433
\PY{n+nb}{det}\PY{p}{(}\PY{n}{L}\PY{o}{*}\PY{n}{U}\PY{p}{)}
434
\end{Verbatim}
435
436
\begin{Verbatim}[commandchars=\\\{\}]
437
ans = 5.0000
438
ans = 1
439
ans = 5
440
ans = 5
441
ans = 5.0000
442
Feb 23, 2017
443
\end{Verbatim}
444
445
\subsection{Pivoting for LU
446
factorization}\label{pivoting-for-lu-factorization}
447
448
LU factorization uses the same method as Gauss elimination so it is also
449
necessary to perform partial pivoting when creating the lower and upper
450
triangular matrices.
451
452
Matlab and Octave use pivoting in the command
453
454
\texttt{{[}L,U,P{]}=lu(A)}
455
456
\begin{Verbatim}[commandchars=\\\{\}]
457
{\color{incolor}In [{\color{incolor}4}]:} \PY{n}{help} \PY{n+nb}{lu}
458
\end{Verbatim}
459
460
\begin{Verbatim}[commandchars=\\\{\}]
461
'lu' is a built-in function from the file libinterp/corefcn/lu.cc
462
463
-- Built-in Function: [L, U] = lu (A)
464
-- Built-in Function: [L, U, P] = lu (A)
465
-- Built-in Function: [L, U, P, Q] = lu (S)
466
-- Built-in Function: [L, U, P, Q, R] = lu (S)
467
-- Built-in Function: [{\ldots}] = lu (S, THRES)
468
-- Built-in Function: Y = lu ({\ldots})
469
-- Built-in Function: [{\ldots}] = lu ({\ldots}, "vector")
470
Compute the LU decomposition of A.
471
472
If A is full subroutines from LAPACK are used and if A is sparse
473
then UMFPACK is used.
474
475
The result is returned in a permuted form, according to the
476
optional return value P. For example, given the matrix 'a = [1, 2;
477
3, 4]',
478
479
[l, u, p] = lu (A)
480
481
returns
482
483
l =
484
485
1.00000 0.00000
486
0.33333 1.00000
487
488
u =
489
490
3.00000 4.00000
491
0.00000 0.66667
492
493
p =
494
495
0 1
496
1 0
497
498
The matrix is not required to be square.
499
500
When called with two or three output arguments and a spare input
501
matrix, 'lu' does not attempt to perform sparsity preserving column
502
permutations. Called with a fourth output argument, the sparsity
503
preserving column transformation Q is returned, such that 'P * A *
504
Q = L * U'.
505
506
Called with a fifth output argument and a sparse input matrix, 'lu'
507
attempts to use a scaling factor R on the input matrix such that 'P
508
* (R \textbackslash{} A) * Q = L * U'. This typically leads to a sparser and more
509
stable factorization.
510
511
An additional input argument THRES, that defines the pivoting
512
threshold can be given. THRES can be a scalar, in which case it
513
defines the UMFPACK pivoting tolerance for both symmetric and
514
unsymmetric cases. If THRES is a 2-element vector, then the first
515
element defines the pivoting tolerance for the unsymmetric UMFPACK
516
pivoting strategy and the second for the symmetric strategy. By
517
default, the values defined by 'spparms' are used ([0.1, 0.001]).
518
519
Given the string argument "vector", 'lu' returns the values of P
520
and Q as vector values, such that for full matrix, 'A (P,:) = L *
521
U', and 'R(P,:) * A (:, Q) = L * U'.
522
523
With two output arguments, returns the permuted forms of the upper
524
and lower triangular matrices, such that 'A = L * U'. With one
525
output argument Y, then the matrix returned by the LAPACK routines
526
is returned. If the input matrix is sparse then the matrix L is
527
embedded into U to give a return value similar to the full case.
528
For both full and sparse matrices, 'lu' loses the permutation
529
information.
530
531
See also: luupdate, ilu, chol, hess, qr, qz, schur, svd.
532
533
Additional help for built-in functions and operators is
534
available in the online version of the manual. Use the command
535
'doc <topic>' to search the manual index.
536
537
Help and information about Octave is also available on the WWW
538
at http://www.octave.org and via the help@octave.org
539
mailing list.
540
541
\end{Verbatim}
542
543
\begin{Verbatim}[commandchars=\\\{\}]
544
{\color{incolor}In [{\color{incolor}9}]:} \PY{c}{\PYZpc{} time LU solution vs backslash}
545
\PY{n}{t\PYZus{}lu}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{100}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;}
546
\PY{n}{t\PYZus{}bs}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{100}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;}
547
\PY{k}{for} \PY{n}{N}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}
548
\PY{n}{A}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{n}{N}\PY{p}{)}\PY{p}{;}
549
\PY{n}{y}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;}
550
\PY{p}{[}\PY{n}{L}\PY{p}{,}\PY{n}{U}\PY{p}{,}\PY{n}{P}\PY{p}{]}\PY{p}{=}\PY{n+nb}{lu}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{;}
551
552
\PY{n+nb}{tic}\PY{p}{;} \PY{n}{d}\PY{p}{=}\PY{n+nb}{inv}\PY{p}{(}\PY{n}{L}\PY{p}{)}\PY{o}{*}\PY{n}{y}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n+nb}{inv}\PY{p}{(}\PY{n}{U}\PY{p}{)}\PY{o}{*}\PY{n}{d}\PY{p}{;} \PY{n}{t\PYZus{}lu}\PY{p}{(}\PY{n}{N}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;}
553
554
\PY{n+nb}{tic}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n+nb}{inv}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{o}{*}\PY{n}{y}\PY{p}{;} \PY{n}{t\PYZus{}bs}\PY{p}{(}\PY{n}{N}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;}
555
\PY{k}{end}
556
\PY{n+nb}{plot}\PY{p}{(}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}\PY{p}{]}\PY{p}{,}\PY{n}{t\PYZus{}lu}\PY{p}{,}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}\PY{p}{]}\PY{p}{,}\PY{n}{t\PYZus{}bs}\PY{p}{)}
557
\PY{n+nb}{legend}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{LU decomp\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{Octave \PYZbs{}\PYZbs{}\PYZsq{}}\PY{p}{)}
Feb 23, 2017
558
\end{Verbatim}
559
560
\begin{center}
561
\adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_11_files/lecture_11_8_0.pdf}
Feb 23, 2017
562
\end{center}
563
{ \hspace*{\fill} \\}
564
565
Consider the problem again from the intro to Linear Algebra, 4 masses
566
are connected in series to 4 springs with K=10 N/m. What are the final
567
positions of the masses?
568
569
\begin{figure}[htbp]
570
\centering
571
\includegraphics{../lecture_09/mass_springs.png}
Feb 23, 2017
572
\caption{Springs-masses}
573
\end{figure}
574
575
The masses haves the following amounts, 1, 2, 3, and 4 kg for masses
576
1-4. Using a FBD for each mass:
577
578
\(m_{1}g+k(x_{2}-x_{1})-kx_{1}=0\)
579
580
\(m_{2}g+k(x_{3}-x_{2})-k(x_{2}-x_{1})=0\)
581
582
\(m_{3}g+k(x_{4}-x_{3})-k(x_{3}-x_{2})=0\)
583
584
\(m_{4}g-k(x_{4}-x_{3})=0\)
585
586
in matrix form:
587
588
\(\left[ \begin{array}{cccc} 2k & -k & 0 & 0 \\ -k & 2k & -k & 0 \\ 0 & -k & 2k & -k \\ 0 & 0 & -k & k \end{array} \right] \left[ \begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array} \right]= \left[ \begin{array}{c} m_{1}g \\ m_{2}g \\ m_{3}g \\ m_{4}g \end{array} \right]\)
589
590
\begin{Verbatim}[commandchars=\\\{\}]
591
{\color{incolor}In [{\color{incolor}10}]:} \PY{n}{k}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m}
Feb 23, 2017
592
\PY{n}{m1}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} kg}
593
\PY{n}{m2}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;}
594
\PY{n}{m3}\PY{p}{=}\PY{l+m+mi}{3}\PY{p}{;}
595
\PY{n}{m4}\PY{p}{=}\PY{l+m+mi}{4}\PY{p}{;}
596
\PY{n}{g}\PY{p}{=}\PY{l+m+mf}{9.81}\PY{p}{;} \PY{c}{\PYZpc{} m/s\PYZca{}2}
597
\PY{n}{K}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{0} \PY{l+m+mi}{0}\PY{p}{;} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{0}\PY{p}{;} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k}\PY{p}{;} \PY{l+m+mi}{0} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{n}{k}\PY{p}{]}
598
\PY{n}{y}\PY{p}{=}\PY{p}{[}\PY{n}{m1}\PY{o}{*}\PY{n}{g}\PY{p}{;}\PY{n}{m2}\PY{o}{*}\PY{n}{g}\PY{p}{;}\PY{n}{m3}\PY{o}{*}\PY{n}{g}\PY{p}{;}\PY{n}{m4}\PY{o}{*}\PY{n}{g}\PY{p}{]}
599
\end{Verbatim}
600
601
\begin{Verbatim}[commandchars=\\\{\}]
602
K =
603
604
20 -10 0 0
605
-10 20 -10 0
606
0 -10 20 -10
607
0 0 -10 10
608
609
y =
610
611
9.8100
612
19.6200
613
29.4300
614
39.2400
615
616
617
\end{Verbatim}
618
619
This matrix, K, is symmetric.
620
621
\texttt{K(i,j)==K(j,i)}
622
623
Now we can use,
624
625
\subsection{Cholesky Factorization}\label{cholesky-factorization}
626
627
We can decompose the matrix, K into two matrices, \(U\) and \(U^{T}\),
628
where
629
630
\(K=U^{T}U\)
631
632
each of the components of U can be calculated with the following
633
equations:
634
635
\(u_{ii}=\sqrt{a_{ii}-\sum_{k=1}^{i-1}u_{ki}^{2}}\)
636
637
\(u_{ij}=\frac{a_{ij}-\sum_{k=1}^{i-1}u_{ki}u_{kj}}{u_{ii}}\)
638
639
so for K
640
641
\begin{Verbatim}[commandchars=\\\{\}]
642
{\color{incolor}In [{\color{incolor}11}]:} \PY{n}{K}
Feb 23, 2017
643
\end{Verbatim}
644
645
\begin{Verbatim}[commandchars=\\\{\}]
646
K =
647
648
20 -10 0 0
649
-10 20 -10 0
650
0 -10 20 -10
651
0 0 -10 10
652
653
654
\end{Verbatim}
655
656
\begin{Verbatim}[commandchars=\\\{\}]
657
{\color{incolor}In [{\color{incolor}12}]:} \PY{n}{u11}\PY{p}{=}\PY{n+nb}{sqrt}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)}
Feb 23, 2017
658
\PY{n}{u12}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11}
659
\PY{n}{u13}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11}
660
\PY{n}{u14}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11}
661
\PY{n}{u22}\PY{p}{=}\PY{n+nb}{sqrt}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u12}\PYZca{}\PY{l+m+mi}{2}\PY{p}{)}
662
\PY{n}{u23}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u12}\PY{o}{*}\PY{n}{u13}\PY{p}{)}\PY{o}{/}\PY{n}{u22}
663
\PY{n}{u24}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u12}\PY{o}{*}\PY{n}{u14}\PY{p}{)}\PY{o}{/}\PY{n}{u22}
664
\PY{n}{u33}\PY{p}{=}\PY{n+nb}{sqrt}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u13}\PYZca{}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{u23}\PYZca{}\PY{l+m+mi}{2}\PY{p}{)}
665
\PY{n}{u34}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u13}\PY{o}{*}\PY{n}{u14}\PY{o}{\PYZhy{}}\PY{n}{u23}\PY{o}{*}\PY{n}{u24}\PY{p}{)}\PY{o}{/}\PY{n}{u33}
666
\PY{n}{u44}\PY{p}{=}\PY{n+nb}{sqrt}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{u14}\PYZca{}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{u24}\PYZca{}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{u34}\PYZca{}\PY{l+m+mi}{2}\PY{p}{)}
667
\PY{n}{U}\PY{p}{=}\PY{p}{[}\PY{n}{u11}\PY{p}{,}\PY{n}{u12}\PY{p}{,}\PY{n}{u13}\PY{p}{,}\PY{n}{u14}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u22}\PY{p}{,}\PY{n}{u23}\PY{p}{,}\PY{n}{u24}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u33}\PY{p}{,}\PY{n}{u34}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u44}\PY{p}{]}
668
\end{Verbatim}
669
670
\begin{Verbatim}[commandchars=\\\{\}]
671
u11 = 4.4721
672
u12 = -2.2361
673
u13 = 0
674
u14 = 0
675
u22 = 3.8730
676
u23 = -2.5820
677
u24 = 0
678
u33 = 3.6515
679
u34 = -2.7386
680
u44 = 1.5811
681
U =
682
683
4.47214 -2.23607 0.00000 0.00000
684
0.00000 3.87298 -2.58199 0.00000
685
0.00000 0.00000 3.65148 -2.73861
686
0.00000 0.00000 0.00000 1.58114
687
688
689
\end{Verbatim}
690
691
\begin{Verbatim}[commandchars=\\\{\}]
692
{\color{incolor}In [{\color{incolor}17}]:} \PY{p}{(}\PY{n}{U}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{U}\PY{p}{)}\PY{o}{\PYZsq{}}\PY{o}{==}\PY{n}{U}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{U}
Feb 23, 2017
693
\end{Verbatim}
694
695
\begin{Verbatim}[commandchars=\\\{\}]
696
ans =
697
698
1 1 1 1
699
1 1 1 1
700
1 1 1 1
701
1 1 1 1
Feb 23, 2017
702
703
704
\end{Verbatim}
705
706
\begin{Verbatim}[commandchars=\\\{\}]
707
{\color{incolor}In [{\color{incolor}18}]:} \PY{c}{\PYZpc{} time solution for Cholesky vs backslash}
Feb 23, 2017
708
\PY{n}{t\PYZus{}chol}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1000}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;}
709
\PY{n}{t\PYZus{}bs}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1000}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;}
710
\PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{1000}
711
\PY{n+nb}{tic}\PY{p}{;} \PY{n}{d}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{y}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d}\PY{p}{;} \PY{n}{t\PYZus{}chol}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;}
712
\PY{n+nb}{tic}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{K}\PY{o}{\PYZbs{}}\PY{n}{y}\PY{p}{;} \PY{n}{t\PYZus{}bs}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;}
713
\PY{k}{end}
714
\PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{average time spent for Cholesky factored solution = \PYZpc{}e+/\PYZhy{}\PYZpc{}e\PYZsq{}}\PY{p}{,}\PY{n+nb}{mean}\PY{p}{(}\PY{n}{t\PYZus{}chol}\PY{p}{)}\PY{p}{,}\PY{n+nb}{std}\PY{p}{(}\PY{n}{t\PYZus{}chol}\PY{p}{)}\PY{p}{)}
715
716
\PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{average time spent for backslash solution = \PYZpc{}e+/\PYZhy{}\PYZpc{}e\PYZsq{}}\PY{p}{,}\PY{n+nb}{mean}\PY{p}{(}\PY{n}{t\PYZus{}bs}\PY{p}{)}\PY{p}{,}\PY{n+nb}{std}\PY{p}{(}\PY{n}{t\PYZus{}bs}\PY{p}{)}\PY{p}{)}
717
\end{Verbatim}
718
719
\begin{Verbatim}[commandchars=\\\{\}]
720
average time spent for Cholesky factored solution = 1.465964e-05+/-9.806001e-06
721
average time spent for backslash solution = 1.555967e-05+/-1.048561e-05
Feb 23, 2017
722
723
\end{Verbatim}
724
725
\begin{Verbatim}[commandchars=\\\{\}]
726
{\color{incolor}In [{\color{incolor} }]:}
727
\end{Verbatim}
728
Feb 23, 2017
729
730
% Add a bibliography block to the postdoc
731
732
733
734
\end{document}
You can’t perform that action at this time.