diff --git a/lecture_12/lecture_12.aux b/lecture_12/lecture_12.aux index c73dc14..4aa3a49 100644 --- a/lecture_12/lecture_12.aux +++ b/lecture_12/lecture_12.aux @@ -17,11 +17,22 @@ \providecommand\HyField@AuxAddToFields[1]{} \providecommand\HyField@AuxAddToCoFields[2]{} \providecommand \oddpage@label [2]{} -\@writefile{toc}{\contentsline {subsection}{\numberline {0.1}My question from last class}{1}{subsection.0.1}} -\newlabel{my-question-from-last-class}{{0.1}{1}{My question from last class}{subsection.0.1}{}} -\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces q1\relax }}{1}{figure.caption.1}} -\@writefile{toc}{\contentsline {subsection}{\numberline {0.2}Your questions from last class}{1}{subsection.0.2}} -\newlabel{your-questions-from-last-class}{{0.2}{1}{Your questions from last class}{subsection.0.2}{}} -\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces q2\relax }}{2}{figure.caption.2}} -\@writefile{toc}{\contentsline {section}{\numberline {1}Matrix Inverse and Condition}{2}{section.1}} -\newlabel{matrix-inverse-and-condition}{{1}{2}{Matrix Inverse and Condition}{section.1}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {0.1}My question from last class}{2}{subsection.0.1}} +\newlabel{my-question-from-last-class}{{0.1}{2}{My question from last class}{subsection.0.1}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces q1\relax }}{2}{figure.caption.1}} +\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces q2\relax }}{3}{figure.caption.2}} +\@writefile{toc}{\contentsline {subsection}{\numberline {0.2}Your questions from last class}{3}{subsection.0.2}} +\newlabel{your-questions-from-last-class}{{0.2}{3}{Your questions from last class}{subsection.0.2}{}} +\@writefile{toc}{\contentsline {section}{\numberline {1}Matrix Inverse and Condition}{3}{section.1}} +\newlabel{matrix-inverse-and-condition}{{1}{3}{Matrix Inverse and Condition}{section.1}{}} +\newlabel{note-on-solving-for-a-1-column-1}{{1}{5}{\texorpdfstring {Note on solving for \(A^{-1}\) column 1}{Note on solving for A\^{}\{-1\} column 1}}{section*.3}{}} +\@writefile{toc}{\contentsline {paragraph}{Note on solving for \(A^{-1}\) column 1}{5}{section*.3}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Condition of a matrix}{10}{subsection.1.1}} +\newlabel{condition-of-a-matrix}{{1.1}{10}{Condition of a matrix}{subsection.1.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}\emph {just checked in to see what condition my condition was in}}{10}{subsubsection.1.1.1}} +\newlabel{just-checked-in-to-see-what-condition-my-condition-was-in}{{1.1.1}{10}{\texorpdfstring {\emph {just checked in to see what condition my condition was in}}{just checked in to see what condition my condition was in}}{subsubsection.1.1.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Matrix norms}{10}{subsubsection.1.1.2}} +\newlabel{matrix-norms}{{1.1.2}{10}{Matrix norms}{subsubsection.1.1.2}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.3}Condition of Matrix}{11}{subsubsection.1.1.3}} +\newlabel{condition-of-matrix}{{1.1.3}{11}{Condition of Matrix}{subsubsection.1.1.3}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Springs-masses\relax }}{13}{figure.caption.4}} diff --git a/lecture_12/lecture_12.bbl b/lecture_12/lecture_12.bbl new file mode 100644 index 0000000..e69de29 diff --git a/lecture_12/lecture_12.blg b/lecture_12/lecture_12.blg new file mode 100644 index 0000000..beafcd1 --- /dev/null +++ b/lecture_12/lecture_12.blg @@ -0,0 +1,48 @@ +This is BibTeX, Version 0.99d (TeX Live 2015/Debian) +Capacity: max_strings=35307, hash_size=35307, hash_prime=30011 +The top-level auxiliary file: lecture_12.aux +I found no \citation commands---while reading file lecture_12.aux +I found no \bibdata command---while reading file lecture_12.aux +I found no \bibstyle command---while reading file lecture_12.aux +You've used 0 entries, + 0 wiz_defined-function locations, + 83 strings with 494 characters, +and the built_in function-call counts, 0 in all, are: += -- 0 +> -- 0 +< -- 0 ++ -- 0 +- -- 0 +* -- 0 +:= -- 0 +add.period$ -- 0 +call.type$ -- 0 +change.case$ -- 0 +chr.to.int$ -- 0 +cite$ -- 0 +duplicate$ -- 0 +empty$ -- 0 +format.name$ -- 0 +if$ -- 0 +int.to.chr$ -- 0 +int.to.str$ -- 0 +missing$ -- 0 +newline$ -- 0 +num.names$ -- 0 +pop$ -- 0 +preamble$ -- 0 +purify$ -- 0 +quote$ -- 0 +skip$ -- 0 +stack$ -- 0 +substring$ -- 0 +swap$ -- 0 +text.length$ -- 0 +text.prefix$ -- 0 +top$ -- 0 +type$ -- 0 +warning$ -- 0 +while$ -- 0 +width$ -- 0 +write$ -- 0 +(There were 3 error messages) diff --git a/lecture_12/lecture_12.ipynb b/lecture_12/lecture_12.ipynb index dc44a21..2937e47 100644 --- a/lecture_12/lecture_12.ipynb +++ b/lecture_12/lecture_12.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 27, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 3, "metadata": { "collapsed": true }, @@ -22,6 +22,97 @@ "setdefaults" ] }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 0.447394 0.357071 0.720915 0.499926\n", + " 0.648313 0.323276 0.521677 0.288345\n", + " 0.084982 0.581513 0.466420 0.142342\n", + " 0.576580 0.658089 0.916987 0.923165\n", + "\n", + "L =\n", + "\n", + " 1.00000 0.00000 0.00000 0.00000\n", + " 0.13108 1.00000 0.00000 0.00000\n", + " 0.69009 0.24851 1.00000 0.00000\n", + " 0.88935 0.68736 0.68488 1.00000\n", + "\n", + "U =\n", + "\n", + " 0.64831 0.32328 0.52168 0.28834\n", + " 0.00000 0.53914 0.39804 0.10455\n", + " 0.00000 0.00000 0.26199 0.27496\n", + " 0.00000 0.00000 0.00000 0.40655\n", + "\n", + "P =\n", + "\n", + "Permutation Matrix\n", + "\n", + " 0 1 0 0\n", + " 0 0 1 0\n", + " 1 0 0 0\n", + " 0 0 0 1\n", + "\n", + "ans = 1\n" + ] + } + ], + "source": [ + "A=rand(4,4)\n", + "\n", + "[L,U,P]=lu(A)\n", + "\n", + "det(L)" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans =\n", + "\n", + " 4 4\n", + "\n", + "ans = 23.586\n", + "ans = 35.826\n", + "ans = 14.869\n", + "C =\n", + "\n", + " 5.98549 4.28555 4.35707 4.31359\n", + " 0.00000 3.63950 1.35005 1.45342\n", + " 0.00000 0.00000 3.62851 1.50580\n", + " 0.00000 0.00000 0.00000 3.21911\n", + "\n" + ] + } + ], + "source": [ + "A=rand(4,100)';\n", + "A=A'*A;\n", + "size(A)\n", + "min(min(A))\n", + "max(max(A))\n", + "cond(A)\n", + "C=chol(A)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -90,7 +181,7 @@ "1\\end{array}\\right]$\n", "\n", "$A^{-1}=\\frac{1}{2*3-1*1}\\left[ \\begin{array}{cc}\n", - "3 & 1 \\\\\n", + "3 & -1 \\\\\n", "-1 & 2 \\end{array} \\right]=\n", "\\left[ \\begin{array}{cc}\n", "3/5 & -1/5 \\\\\n", @@ -99,7 +190,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 45, "metadata": { "collapsed": false }, @@ -203,7 +294,7 @@ "\n", "$A^{-1}=\\left[ \\begin{array}{cccc}\n", "| & | & & | \\\\\n", - "a_{1} & a_{2} & \\cdots & a_{3} \\\\\n", + "a_{1} & a_{2} & \\cdots & a_{n} \\\\\n", "| & | & & | \\end{array} \\right]$\n", "\n", "\n", @@ -236,9 +327,26 @@ "0 & -1 & 1 \\end{array} \\right]$\n" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "#### Note on solving for $A^{-1}$ column 1\n", + "\n", + "$Aa_1=I(:,1)$\n", + "\n", + "$LUa_1=I(:,1)$\n", + "\n", + "$(LUa_1-I(:,1))=0$\n", + "\n", + "$L(Ua_1-d_1)=0$\n", + "\n", + "$I(:,1)=Ld_1$" + ] + }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 56, "metadata": { "collapsed": false }, @@ -278,7 +386,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 57, "metadata": { "collapsed": false }, @@ -317,13 +425,23 @@ "1 \\\\ \n", "0 \\\\ \n", "\\vdots \\\\\n", - "0 \\end{array} \\right]$\n", - "$;~Ua_{1}=d_{1}$" + "0 \\end{array} \\right]=\n", + "\\left[\\begin{array}{ccc} \n", + "1 & 0 & 0 \\\\ \n", + "-1/2 & 1 & 0 \\\\\n", + "0 & -2/3 & 1 \\end{array} \\right]\\left[\\begin{array}{c} \n", + "d1(1) \\\\ \n", + "d1(2) \\\\ \n", + "d1(3)\\end{array} \\right]=\\left[\\begin{array}{c} \n", + "1 \\\\ \n", + "0 \\\\ \n", + "0 \\end{array} \\right]\n", + ";~Ua_{1}=d_{1}$" ] }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 58, "metadata": { "collapsed": false }, @@ -350,7 +468,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 59, "metadata": { "collapsed": false }, @@ -377,7 +495,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 60, "metadata": { "collapsed": false }, @@ -404,7 +522,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 61, "metadata": { "collapsed": false }, @@ -431,7 +549,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 62, "metadata": { "collapsed": false }, @@ -458,7 +576,7 @@ }, { "cell_type": "code", - "execution_count": 38, + "execution_count": 63, "metadata": { "collapsed": false }, @@ -492,7 +610,7 @@ }, { "cell_type": "code", - "execution_count": 40, + "execution_count": 69, "metadata": { "collapsed": false }, @@ -507,18 +625,25 @@ " 1.00000 2.00000 2.00000\n", " 1.00000 2.00000 3.00000\n", "\n", - "ans =\n", + "I_app =\n", "\n", " 1.00000 0.00000 0.00000\n", " 0.00000 1.00000 -0.00000\n", " -0.00000 -0.00000 1.00000\n", - "\n" + "\n", + "ans = -4.4409e-16\n", + "ans = 2.2204e-16\n", + "ans = 0.0039062\n" ] } ], "source": [ "invA=[a1,a2,a3]\n", - "A*invA" + "I_app=A*invA\n", + "I_app(2,3)\n", + "eps\n", + "\n", + "2^-8" ] }, { @@ -530,7 +655,7 @@ }, { "cell_type": "code", - "execution_count": 44, + "execution_count": 70, "metadata": { "collapsed": false }, @@ -577,7 +702,7 @@ }, { "cell_type": "code", - "execution_count": 61, + "execution_count": 4, "metadata": { "collapsed": false }, @@ -703,7 +828,7 @@ "\t\n", "\n", "\n", - "\t\n", + "\t\n", "\t\n", "\tbackslash\n", "\n", @@ -712,7 +837,7 @@ "\t\n", "\n", "\n", - "\t\n", + "\t\n", "\t\n", "\tmultiplication\n", "\n", @@ -721,7 +846,7 @@ "\t\n", "\n", "\n", - "\t\n", + "\t\n", "\t\n", "\n", "\n", @@ -813,7 +938,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": 72, "metadata": { "collapsed": false }, @@ -864,7 +989,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 75, "metadata": { "collapsed": false }, @@ -908,7 +1033,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 74, "metadata": { "collapsed": false }, diff --git a/lecture_12/lecture_12.log b/lecture_12/lecture_12.log new file mode 100644 index 0000000..c4a5ed3 --- /dev/null +++ b/lecture_12/lecture_12.log @@ -0,0 +1,841 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.1.11) 28 FEB 2017 14:24 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**lecture_12.tex +(./lecture_12.tex +LaTeX2e <2016/02/01> +Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo +File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty +Package: fontenc 2005/09/27 v1.99g Standard LaTeX package + +(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def +File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file +LaTeX Font Info: Redeclaring font encoding T1 on input line 48. +)) +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathpazo.sty +Package: mathpazo 2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) +\symupright=\mathgroup4 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/01/03 v1.0q Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg +File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live +) +Package graphics Info: Driver file: pdftex.def on input line 95. + +(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def +File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) + +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2016/02/04 v1.7-139 caption3 kernel (AR) +Package caption3 Info: TeX engine: e-TeX on input line 67. +\captionmargin=\dimen105 +\captionmargin@=\dimen106 +\captionwidth=\dimen107 +\caption@tempdima=\dimen108 +\caption@indent=\dimen109 +\caption@parindent=\dimen110 +\caption@hangindent=\dimen111 +) +\c@ContinuedFloat=\count88 +) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjustbox.sty +Package: adjustbox 2012/05/21 v1.0 Adjusting TeX boxes (trim, clip, ...) + +(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty +Package: xkeyval 2014/12/03 v2.7a package option processing (HA) + +(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex +(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex +\XKV@toks=\toks15 +\XKV@tempa@toks=\toks16 +) +\XKV@depth=\count89 +File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) +)) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjcalc.sty +Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back +-ends (calc, etex, pgfmath) +) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/trimclip.sty +Package: trimclip 2012/05/16 v1.0 Trim and clip general TeX material + +(/usr/share/texlive/texmf-dist/tex/latex/collectbox/collectbox.sty +Package: collectbox 2012/05/17 v0.4b Collect macro arguments as boxes +\collectedbox=\box26 +) +\tc@llx=\dimen112 +\tc@lly=\dimen113 +\tc@urx=\dimen114 +\tc@ury=\dimen115 +Package trimclip Info: Using driver 'tc-pdftex.def'. + +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/tc-pdftex.def +File: tc-pdftex.def 2012/05/13 v1.0 Clipping driver for pdftex +)) +\adjbox@Width=\dimen116 +\adjbox@Height=\dimen117 +\adjbox@Depth=\dimen118 +\adjbox@Totalheight=\dimen119 + +(/usr/share/texlive/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty +Package: ifoddpage 2011/09/13 v1.0 Conditionals for odd/even page detection +\c@checkoddpage=\count90 +) +(/usr/share/texlive/texmf-dist/tex/latex/varwidth/varwidth.sty +Package: varwidth 2009/03/30 ver 0.92; Variable-width minipages +\@vwid@box=\box27 +\sift@deathcycles=\count91 +\@vwid@loff=\dimen120 +\@vwid@roff=\dimen121 +)) +(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK) + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg +File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341. +Package xcolor Info: Model `RGB' extended on input line 1353. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360. +) +(/usr/share/texlive/texmf-dist/tex/latex/tools/enumerate.sty +Package: enumerate 2015/07/23 v3.00 enumerate extensions (DPC) +\@enLab=\toks17 +) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2010/09/12 v5.6 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) +Package ifpdf Info: pdfTeX in PDF mode is detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty +Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO) +Package ifvtex Info: VTeX not detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty +Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional +) +\Gm@cnth=\count92 +\Gm@cntv=\count93 +\c@Gm@tempcnt=\count94 +\Gm@bindingoffset=\dimen122 +\Gm@wd@mp=\dimen123 +\Gm@odd@mp=\dimen124 +\Gm@even@mp=\dimen125 +\Gm@layoutwidth=\dimen126 +\Gm@layoutheight=\dimen127 +\Gm@layouthoffset=\dimen128 +\Gm@layoutvoffset=\dimen129 +\Gm@dimlist=\toks18 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2016/03/03 v2.15a AMS math features +\@mathmargin=\skip43 + +For additional information on amsmath, use the `?' option. +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 AMS text + +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks19 +\ex@=\dimen130 +)) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen131 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 1999/12/14 v2.01 operator names +) +\inf@bad=\count95 +LaTeX Info: Redefining \frac on input line 199. +\uproot@=\count96 +\leftroot@=\count97 +LaTeX Info: Redefining \overline on input line 297. +\classnum@=\count98 +\DOTSCASE@=\count99 +LaTeX Info: Redefining \ldots on input line 394. +LaTeX Info: Redefining \dots on input line 397. +LaTeX Info: Redefining \cdots on input line 518. +\Mathstrutbox@=\box28 +\strutbox@=\box29 +\big@size=\dimen132 +LaTeX Font Info: Redeclaring font encoding OML on input line 630. +LaTeX Font Info: Redeclaring font encoding OMS on input line 631. +\macc@depth=\count100 +\c@MaxMatrixCols=\count101 +\dotsspace@=\muskip10 +\c@parentequation=\count102 +\dspbrk@lvl=\count103 +\tag@help=\toks20 +\row@=\count104 +\column@=\count105 +\maxfields@=\count106 +\andhelp@=\toks21 +\eqnshift@=\dimen133 +\alignsep@=\dimen134 +\tagshift@=\dimen135 +\tagwidth@=\dimen136 +\totwidth@=\dimen137 +\lineht@=\dimen138 +\@envbody=\toks22 +\multlinegap=\skip44 +\multlinetaggap=\skip45 +\mathdisplay@stack=\toks23 +LaTeX Info: Redefining \[ on input line 2735. +LaTeX Info: Redefining \] on input line 2736. +) +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2013/01/14 v3.01 AMS font symbols + +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support +\symAMSa=\mathgroup5 +\symAMSb=\mathgroup6 +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 106. +)) +(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty +Package: textcomp 2005/09/27 v1.99g Standard LaTeX package +Package textcomp Info: Sub-encoding information: +(textcomp) 5 = only ISO-Adobe without \textcurrency +(textcomp) 4 = 5 + \texteuro +(textcomp) 3 = 4 + \textohm +(textcomp) 2 = 3 + \textestimated + \textcurrency +(textcomp) 1 = TS1 - \textcircled - \t +(textcomp) 0 = TS1 (full) +(textcomp) Font families with sub-encoding setting implement +(textcomp) only a restricted character set as indicated. +(textcomp) Family '?' is the default used for unknown fonts. +(textcomp) See the documentation for details. +Package textcomp Info: Setting ? sub-encoding to TS1/1 on input line 79. + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def +File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file +) +LaTeX Info: Redefining \oldstylenums on input line 334. +Package textcomp Info: Setting cmr sub-encoding to TS1/0 on input line 349. +Package textcomp Info: Setting cmss sub-encoding to TS1/0 on input line 350. +Package textcomp Info: Setting cmtt sub-encoding to TS1/0 on input line 351. +Package textcomp Info: Setting cmvtt sub-encoding to TS1/0 on input line 352. +Package textcomp Info: Setting cmbr sub-encoding to TS1/0 on input line 353. +Package textcomp Info: Setting cmtl sub-encoding to TS1/0 on input line 354. +Package textcomp Info: Setting ccr sub-encoding to TS1/0 on input line 355. +Package textcomp Info: Setting ptm sub-encoding to TS1/4 on input line 356. +Package textcomp Info: Setting pcr sub-encoding to TS1/4 on input line 357. +Package textcomp Info: Setting phv sub-encoding to TS1/4 on input line 358. +Package textcomp Info: Setting ppl sub-encoding to TS1/3 on input line 359. +Package textcomp Info: Setting pag sub-encoding to TS1/4 on input line 360. +Package textcomp Info: Setting pbk sub-encoding to TS1/4 on input line 361. +Package textcomp Info: Setting pnc sub-encoding to TS1/4 on input line 362. +Package textcomp Info: Setting pzc sub-encoding to TS1/4 on input line 363. +Package textcomp Info: Setting bch sub-encoding to TS1/4 on input line 364. +Package textcomp Info: Setting put sub-encoding to TS1/5 on input line 365. +Package textcomp Info: Setting uag sub-encoding to TS1/5 on input line 366. +Package textcomp Info: Setting ugq sub-encoding to TS1/5 on input line 367. +Package textcomp Info: Setting ul8 sub-encoding to TS1/4 on input line 368. +Package textcomp Info: Setting ul9 sub-encoding to TS1/4 on input line 369. +Package textcomp Info: Setting augie sub-encoding to TS1/5 on input line 370. +Package textcomp Info: Setting dayrom sub-encoding to TS1/3 on input line 371. +Package textcomp Info: Setting dayroms sub-encoding to TS1/3 on input line 372. + +Package textcomp Info: Setting pxr sub-encoding to TS1/0 on input line 373. +Package textcomp Info: Setting pxss sub-encoding to TS1/0 on input line 374. +Package textcomp Info: Setting pxtt sub-encoding to TS1/0 on input line 375. +Package textcomp Info: Setting txr sub-encoding to TS1/0 on input line 376. +Package textcomp Info: Setting txss sub-encoding to TS1/0 on input line 377. +Package textcomp Info: Setting txtt sub-encoding to TS1/0 on input line 378. +Package textcomp Info: Setting lmr sub-encoding to TS1/0 on input line 379. +Package textcomp Info: Setting lmdh sub-encoding to TS1/0 on input line 380. +Package textcomp Info: Setting lmss sub-encoding to TS1/0 on input line 381. +Package textcomp Info: Setting lmssq sub-encoding to TS1/0 on input line 382. +Package textcomp Info: Setting lmvtt sub-encoding to TS1/0 on input line 383. +Package textcomp Info: Setting lmtt sub-encoding to TS1/0 on input line 384. +Package textcomp Info: Setting qhv sub-encoding to TS1/0 on input line 385. +Package textcomp Info: Setting qag sub-encoding to TS1/0 on input line 386. +Package textcomp Info: Setting qbk sub-encoding to TS1/0 on input line 387. +Package textcomp Info: Setting qcr sub-encoding to TS1/0 on input line 388. +Package textcomp Info: Setting qcs sub-encoding to TS1/0 on input line 389. +Package textcomp Info: Setting qpl sub-encoding to TS1/0 on input line 390. +Package textcomp Info: Setting qtm sub-encoding to TS1/0 on input line 391. +Package textcomp Info: Setting qzc sub-encoding to TS1/0 on input line 392. +Package textcomp Info: Setting qhvc sub-encoding to TS1/0 on input line 393. +Package textcomp Info: Setting futs sub-encoding to TS1/4 on input line 394. +Package textcomp Info: Setting futx sub-encoding to TS1/4 on input line 395. +Package textcomp Info: Setting futj sub-encoding to TS1/4 on input line 396. +Package textcomp Info: Setting hlh sub-encoding to TS1/3 on input line 397. +Package textcomp Info: Setting hls sub-encoding to TS1/3 on input line 398. +Package textcomp Info: Setting hlst sub-encoding to TS1/3 on input line 399. +Package textcomp Info: Setting hlct sub-encoding to TS1/5 on input line 400. +Package textcomp Info: Setting hlx sub-encoding to TS1/5 on input line 401. +Package textcomp Info: Setting hlce sub-encoding to TS1/5 on input line 402. +Package textcomp Info: Setting hlcn sub-encoding to TS1/5 on input line 403. +Package textcomp Info: Setting hlcw sub-encoding to TS1/5 on input line 404. +Package textcomp Info: Setting hlcf sub-encoding to TS1/5 on input line 405. +Package textcomp Info: Setting pplx sub-encoding to TS1/3 on input line 406. +Package textcomp Info: Setting pplj sub-encoding to TS1/3 on input line 407. +Package textcomp Info: Setting ptmx sub-encoding to TS1/4 on input line 408. +Package textcomp Info: Setting ptmj sub-encoding to TS1/4 on input line 409. +) +(/usr/share/texlive/texmf-dist/tex/latex/upquote/upquote.sty +Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba +tim +) +(/usr/share/texlive/texmf-dist/tex/latex/eurosym/eurosym.sty +Package: eurosym 1998/08/06 v1.1 European currency symbol ``Euro'' +\@eurobox=\box30 +) +(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty +Package: ucs 2013/05/11 v2.2 UCS: Unicode input support + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def +File: uni-global.def 2013/05/13 UCS: Unicode global data +) +\uc@secondtry=\count107 +\uc@combtoks=\toks24 +\uc@combtoksb=\toks25 +\uc@temptokena=\toks26 +) +(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty +Package: inputenc 2015/03/17 v1.2c Input encoding file +\inpenc@prehook=\toks27 +\inpenc@posthook=\toks28 + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def +File: utf8x.def 2004/10/17 UCS: Input encoding UTF-8 +)) +(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty +Package: fancyvrb 2008/02/07 + +Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix +<2008/02/07> (tvz) +\FV@CodeLineNo=\count108 +\FV@InFile=\read1 +\FV@TabBox=\box31 +\c@FancyVerbLine=\count109 +\FV@StepNumber=\count110 +\FV@OutFile=\write3 +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty +Package: grffile 2012/04/05 v1.16 Extended file name support for graphics (HO) + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +Package grffile Info: Option `multidot' is set to `true'. +Package grffile Info: Option `extendedchars' is set to `false'. +Package grffile Info: Option `space' is set to `true'. +Package grffile Info: \Gin@ii of package `graphicx' fixed on input line 486. +) +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty +Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty +Package: hobsub-hyperref 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO) + + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty +Package: hobsub-generic 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO) +Package: hobsub 2012/05/28 v1.13 Construct package bundles (HO) +Package hobsub Info: Skipping package `infwarerr' (already loaded). +Package hobsub Info: Skipping package `ltxcmds' (already loaded). +Package hobsub Info: Skipping package `ifluatex' (already loaded). +Package hobsub Info: Skipping package `ifvtex' (already loaded). +Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO) +Package hobsub Info: Skipping package `ifpdf' (already loaded). +Package hobsub Info: Skipping package `etexcmds' (already loaded). +Package hobsub Info: Skipping package `kvsetkeys' (already loaded). +Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) +Package hobsub Info: Skipping package `pdftexcmds' (already loaded). +Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO) +Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO +) +Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO) +Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO) +) +Package hobsub Info: Skipping package `hobsub' (already loaded). +Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO) +Package: hopatch 2012/05/28 v1.2 Wrapper for package hooks (HO) +Package: xcolor-patch 2011/01/30 xcolor patch +Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO) +Package atveryend Info: \enddocument detected (standard20110627). +Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO) +Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO) +Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO) +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty +Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO) +) +\@linkdim=\dimen139 +\Hy@linkcounter=\count111 +\Hy@pagecounter=\count112 + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def +File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO) +) +\Hy@SavedSpaceFactor=\count113 + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg +File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive +) +Package hyperref Info: Hyper figures OFF on input line 4443. +Package hyperref Info: Link nesting OFF on input line 4448. +Package hyperref Info: Hyper index ON on input line 4451. +Package hyperref Info: Plain pages OFF on input line 4458. +Package hyperref Info: Backreferencing OFF on input line 4463. +Package hyperref Info: Implicit mode ON; LaTeX internals redefined. +Package hyperref Info: Bookmarks ON on input line 4688. +\c@Hy@tempcnt=\count114 + +(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty +\Urlmuskip=\muskip11 +Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. +) +LaTeX Info: Redefining \url on input line 5041. +\XeTeXLinkMargin=\dimen140 +\Fld@menulength=\count115 +\Field@Width=\dimen141 +\Fld@charsize=\dimen142 +Package hyperref Info: Hyper figures OFF on input line 6295. +Package hyperref Info: Link nesting OFF on input line 6300. +Package hyperref Info: Hyper index ON on input line 6303. +Package hyperref Info: backreferencing OFF on input line 6310. +Package hyperref Info: Link coloring OFF on input line 6315. +Package hyperref Info: Link coloring with OCG OFF on input line 6320. +Package hyperref Info: PDF/A mode OFF on input line 6325. +LaTeX Info: Redefining \ref on input line 6365. +LaTeX Info: Redefining \pageref on input line 6369. +\Hy@abspage=\count116 +\c@Item=\count117 +\c@Hfootnote=\count118 +) + +Package hyperref Message: Driver (autodetected): hpdftex. + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def +File: hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX +\Fld@listcount=\count119 +\c@bookmark@seq@number=\count120 + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty +Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO) +Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2 +82. +) +\Hy@SectionHShift=\skip46 +) +(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty +Package: longtable 2014/10/28 v4.11 Multi-page Table package (DPC) +\LTleft=\skip47 +\LTright=\skip48 +\LTpre=\skip49 +\LTpost=\skip50 +\LTchunksize=\count121 +\LTcapwidth=\dimen143 +\LT@head=\box32 +\LT@firsthead=\box33 +\LT@foot=\box34 +\LT@lastfoot=\box35 +\LT@cols=\count122 +\LT@rows=\count123 +\c@LT@tables=\count124 +\c@LT@chunks=\count125 +\LT@p@ftn=\toks29 +) +(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty +Package: booktabs 2005/04/14 v1.61803 publication quality tables +\heavyrulewidth=\dimen144 +\lightrulewidth=\dimen145 +\cmidrulewidth=\dimen146 +\belowrulesep=\dimen147 +\belowbottomsep=\dimen148 +\aboverulesep=\dimen149 +\abovetopsep=\dimen150 +\cmidrulesep=\dimen151 +\cmidrulekern=\dimen152 +\defaultaddspace=\dimen153 +\@cmidla=\count126 +\@cmidlb=\count127 +\@aboverulesep=\dimen154 +\@belowrulesep=\dimen155 +\@thisruleclass=\count128 +\@lastruleclass=\count129 +\@thisrulewidth=\dimen156 +) +(/usr/share/texlive/texmf-dist/tex/latex/enumitem/enumitem.sty +Package: enumitem 2011/09/28 v3.5.2 Customized lists +\labelindent=\skip51 +\enit@outerparindent=\dimen157 +\enit@toks=\toks30 +\enit@inbox=\box36 +\enitdp@description=\count130 +) +(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty +\UL@box=\box37 +\UL@hyphenbox=\box38 +\UL@skip=\skip52 +\UL@hook=\toks31 +\UL@height=\dimen158 +\UL@pe=\count131 +\UL@pixel=\dimen159 +\ULC@box=\box39 +Package: ulem 2012/05/18 +\ULdepth=\dimen160 +) +Package hyperref Info: Option `breaklinks' set `true' on input line 264. +Package hyperref Info: Option `colorlinks' set `true' on input line 264. + (./lecture_12.aux) +\openout1 = `lecture_12.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 271. +LaTeX Font Info: Try loading font information for TS1+cmr on input line 271. + + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd +File: ts1cmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Try loading font information for T1+ppl on input line 271. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1ppl.fd +File: t1ppl.fd 2001/06/04 font definitions for T1/ppl. +) +(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count132 +\scratchdimen=\dimen161 +\scratchbox=\box40 +\nofMPsegments=\count133 +\nofMParguments=\count134 +\everyMPshowfont=\toks32 +\MPscratchCnt=\count135 +\MPscratchDim=\dimen162 +\MPnumerator=\count136 +\makeMPintoPDFobject=\count137 +\everyMPtoPDFconversion=\toks33 +) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) +) +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 452. + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: hyperref package is loaded. +Package caption Info: longtable package is loaded. + +(/usr/share/texlive/texmf-dist/tex/latex/caption/ltcaption.sty +Package: ltcaption 2013/06/09 v1.4-94 longtable captions (AR) +) +Package caption Info: End \AtBeginDocument code. + +*geometry* driver: auto-detecting +*geometry* detected driver: pdftex +*geometry* verbose mode - [ preamble ] result: +* driver: pdftex +* paper: +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt) +* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt) +* \paperwidth=614.295pt +* \paperheight=794.96999pt +* \textwidth=469.75502pt +* \textheight=650.43001pt +* \oddsidemargin=0.0pt +* \evensidemargin=0.0pt +* \topmargin=-37.0pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=11.0pt +* \footskip=30.0pt +* \marginparwidth=59.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def +File: ucsencs.def 2011/01/21 Fixes to fontencodings LGR, T3 +) +\AtBeginShipoutBox=\box41 +Package hyperref Info: Link coloring ON on input line 271. + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty +Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty +Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) +) +\c@section@level=\count138 +) +LaTeX Info: Redefining \ref on input line 271. +LaTeX Info: Redefining \pageref on input line 271. +LaTeX Info: Redefining \nameref on input line 271. + +(./lecture_12.out) (./lecture_12.out) +\@outlinefile=\write4 +\openout4 = `lecture_12.out'. + +LaTeX Font Info: Try loading font information for OT1+ppl on input line 275. + + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ppl.fd +File: ot1ppl.fd 2001/06/04 font definitions for OT1/ppl. +) +LaTeX Font Info: Try loading font information for OML+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omlzplm.fd +File: omlzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OML/zplm. +) +LaTeX Font Info: Try loading font information for OMS+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omszplm.fd +File: omszplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMS/zplm. +) +LaTeX Font Info: Try loading font information for OMX+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omxzplm.fd +File: omxzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMX/zplm. +) +LaTeX Font Info: Try loading font information for OT1+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1zplm.fd +File: ot1zplm.fd 2002/09/08 Fontinst v1.914 font definitions for OT1/zplm. +) +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 12.50409pt on input line 275. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 9.37807pt on input line 275. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 7.29405pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 12.50409pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 9.37807pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 7.29405pt on input line 275. + + +LaTeX Warning: No \author given. + +LaTeX Font Info: Try loading font information for T1+cmtt on input line 279. + +(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd +File: t1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) [1 + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] +LaTeX Font Info: Try loading font information for TS1+cmtt on input line 331 +. + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmtt.fd +File: ts1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <12> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 359. + + +File: det_L.png Graphic file (type png) + +Package pdftex.def Info: det_L.png used on input line 363. +(pdftex.def) Requested size: 375.80544pt x 183.64162pt. + + +File: chol_pre.png Graphic file (type png) + +Package pdftex.def Info: chol_pre.png used on input line 369. +(pdftex.def) Requested size: 375.80544pt x 183.9047pt. + [2 <./det_L.png>] +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <14.4> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 400. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 11.40997pt on input line 404. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 8.33606pt on input line 404. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 6.25204pt on input line 404. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 11.40997pt on input line 404. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 8.33606pt on input line 404. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 6.25204pt on input line 404. + [3 <./chol_pre.png>] [4] +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <10.95> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 503. + [5] [6] [7] [8] +LaTeX Font Info: Font shape `T1/cmtt/bx/n' in size <10.95> not available +(Font) Font shape `T1/cmtt/m/n' tried instead on input line 746. + + +File: lecture_12_files/lecture_12_24_0.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_12_files/lecture_12_24_0.pdf used on input lin +e 765. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [9] +Underfull \hbox (badness 10000) in paragraph at lines 767--768 + + [] + +LaTeX Font Info: Font shape `T1/ppl/bx/it' in size <10.95> not available +(Font) Font shape `T1/ppl/b/it' tried instead on input line 773. +[10 <./lecture_12_files/lecture_12_24_0.pdf>] [11] [12] +<../lecture_09/mass_springs.png, id=118, 112.42pt x 190.7125pt> +File: ../lecture_09/mass_springs.png Graphic file (type png) + + +Package pdftex.def Info: ../lecture_09/mass_springs.png used on input line 923. + +(pdftex.def) Requested size: 89.93611pt x 152.576pt. + [13 <../lecture_09/mass_springs.png>] +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 1015. + +[14] +Package atveryend Info: Empty hook `AfterLastShipout' on input line 1015. + (./lecture_12.aux) +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 1015. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 1015. + +Package rerunfilecheck Info: File `lecture_12.out' has not changed. +(rerunfilecheck) Checksum: 2BDB89EC075D3A42B038A5DAC39843C7;535. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 1015. + ) +Here is how much of TeX's memory you used: + 10955 strings out of 493029 + 163811 string characters out of 6136234 + 270140 words of memory out of 5000000 + 14229 multiletter control sequences out of 15000+600000 + 37652 words of font info for 95 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 36i,9n,77p,512b,465s stack positions out of 5000i,500n,10000p,200000b,80000s +{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/share/texmf/ +fonts/enc/dvips/cm-super/cm-super-ts1.enc}{/usr/share/texmf/fonts/enc/dvips/cm- +super/cm-super-t1.enc} +Output written on lecture_12.pdf (14 pages, 232410 bytes). +PDF statistics: + 177 PDF objects out of 1000 (max. 8388607) + 140 compressed objects within 2 object streams + 34 named destinations out of 1000 (max. 500000) + 77 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/lecture_12/lecture_12.md b/lecture_12/lecture_12.md index 9befcbc..82f9bea 100644 --- a/lecture_12/lecture_12.md +++ b/lecture_12/lecture_12.md @@ -9,6 +9,75 @@ setdefaults ``` + +```octave +A=rand(4,4) + +[L,U,P]=lu(A) + +det(L) +``` + + A = + + 0.447394 0.357071 0.720915 0.499926 + 0.648313 0.323276 0.521677 0.288345 + 0.084982 0.581513 0.466420 0.142342 + 0.576580 0.658089 0.916987 0.923165 + + L = + + 1.00000 0.00000 0.00000 0.00000 + 0.13108 1.00000 0.00000 0.00000 + 0.69009 0.24851 1.00000 0.00000 + 0.88935 0.68736 0.68488 1.00000 + + U = + + 0.64831 0.32328 0.52168 0.28834 + 0.00000 0.53914 0.39804 0.10455 + 0.00000 0.00000 0.26199 0.27496 + 0.00000 0.00000 0.00000 0.40655 + + P = + + Permutation Matrix + + 0 1 0 0 + 0 0 1 0 + 1 0 0 0 + 0 0 0 1 + + ans = 1 + + + +```octave +A=rand(4,100)'; +A=A'*A; +size(A) +min(min(A)) +max(max(A)) +cond(A) +C=chol(A) +``` + + ans = + + 4 4 + + ans = 23.586 + ans = 35.826 + ans = 14.869 + C = + + 5.98549 4.28555 4.35707 4.31359 + 0.00000 3.63950 1.35005 1.45342 + 0.00000 0.00000 3.62851 1.50580 + 0.00000 0.00000 0.00000 3.21911 + + + ## My question from last class ![q1](det_L.png) @@ -68,7 +137,7 @@ x_{2} \end{array}\right]= 1\end{array}\right]$ $A^{-1}=\frac{1}{2*3-1*1}\left[ \begin{array}{cc} -3 & 1 \\ +3 & -1 \\ -1 & 2 \end{array} \right]= \left[ \begin{array}{cc} 3/5 & -1/5 \\ @@ -156,7 +225,7 @@ Which we can solve for each $a_{n}$ with LU-decomposition, knowing the lower and $A^{-1}=\left[ \begin{array}{cccc} | & | & & | \\ -a_{1} & a_{2} & \cdots & a_{3} \\ +a_{1} & a_{2} & \cdots & a_{n} \\ | & | & & | \end{array} \right]$ @@ -189,6 +258,18 @@ $A=\left[ \begin{array}{ccc} 0 & -1 & 1 \end{array} \right]$ +#### Note on solving for $A^{-1}$ column 1 + +$Aa_1=I(:,1)$ + +$LUa_1=I(:,1)$ + +$(LUa_1-I(:,1))=0$ + +$L(Ua_1-d_1)=0$ + +$I(:,1)=Ld_1$ + ```octave A=[2,-1,0;-1,2,-1;0,-1,1] @@ -245,8 +326,18 @@ $Ld_{1}=\left[\begin{array}{c} 1 \\ 0 \\ \vdots \\ -0 \end{array} \right]$ -$;~Ua_{1}=d_{1}$ +0 \end{array} \right]= +\left[\begin{array}{ccc} +1 & 0 & 0 \\ +-1/2 & 1 & 0 \\ +0 & -2/3 & 1 \end{array} \right]\left[\begin{array}{c} +d1(1) \\ +d1(2) \\ +d1(3)\end{array} \right]=\left[\begin{array}{c} +1 \\ +0 \\ +0 \end{array} \right] +;~Ua_{1}=d_{1}$ ```octave @@ -349,7 +440,11 @@ Final solution for $A^{-1}$ is $[a_{1}~a_{2}~a_{3}]$ ```octave invA=[a1,a2,a3] -A*invA +I_app=A*invA +I_app(2,3) +eps + +2^-8 ``` invA = @@ -358,12 +453,15 @@ A*invA 1.00000 2.00000 2.00000 1.00000 2.00000 3.00000 - ans = + I_app = 1.00000 0.00000 0.00000 0.00000 1.00000 -0.00000 -0.00000 -0.00000 1.00000 + ans = -4.4409e-16 + ans = 2.2204e-16 + ans = 0.0039062 Now the solution of $x$ to $Ax=y$ is $x=A^{-1}y$ @@ -430,7 +528,7 @@ legend('inversion','backslash','multiplication','Location','NorthWest') ``` -![svg](lecture_12_files/lecture_12_21_0.svg) +![svg](lecture_12_files/lecture_12_24_0.svg) ## Condition of a matrix diff --git a/lecture_12/lecture_12.out b/lecture_12/lecture_12.out new file mode 100644 index 0000000..e7b5af8 --- /dev/null +++ b/lecture_12/lecture_12.out @@ -0,0 +1,7 @@ +\BOOKMARK [2][-]{subsection.0.1}{My question from last class}{}% 1 +\BOOKMARK [2][-]{subsection.0.2}{Your questions from last class}{}% 2 +\BOOKMARK [1][-]{section.1}{Matrix Inverse and Condition}{}% 3 +\BOOKMARK [2][-]{subsection.1.1}{Condition of a matrix}{section.1}% 4 +\BOOKMARK [3][-]{subsubsection.1.1.1}{just checked in to see what condition my condition was in}{subsection.1.1}% 5 +\BOOKMARK [3][-]{subsubsection.1.1.2}{Matrix norms}{subsection.1.1}% 6 +\BOOKMARK [3][-]{subsubsection.1.1.3}{Condition of Matrix}{subsection.1.1}% 7 diff --git a/lecture_12/lecture_12.pdf b/lecture_12/lecture_12.pdf index ed0f569..e0b4e6c 100644 Binary files a/lecture_12/lecture_12.pdf and b/lecture_12/lecture_12.pdf differ diff --git a/lecture_12/lecture_12.tex b/lecture_12/lecture_12.tex new file mode 100644 index 0000000..1265a06 --- /dev/null +++ b/lecture_12/lecture_12.tex @@ -0,0 +1,1015 @@ + +% Default to the notebook output style + + + + +% Inherit from the specified cell style. + + + + + +\documentclass[11pt]{article} + + + + \usepackage[T1]{fontenc} + % Nicer default font (+ math font) than Computer Modern for most use cases + \usepackage{mathpazo} + + % Basic figure setup, for now with no caption control since it's done + % automatically by Pandoc (which extracts ![](path) syntax from Markdown). + \usepackage{graphicx} + % We will generate all images so they have a width \maxwidth. This means + % that they will get their normal width if they fit onto the page, but + % are scaled down if they would overflow the margins. + \makeatletter + \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth + \else\Gin@nat@width\fi} + \makeatother + \let\Oldincludegraphics\includegraphics + % Set max figure width to be 80% of text width, for now hardcoded. + \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} + % Ensure that by default, figures have no caption (until we provide a + % proper Figure object with a Caption API and a way to capture that + % in the conversion process - todo). + \usepackage{caption} + \DeclareCaptionLabelFormat{nolabel}{} + \captionsetup{labelformat=nolabel} + + \usepackage{adjustbox} % Used to constrain images to a maximum size + \usepackage{xcolor} % Allow colors to be defined + \usepackage{enumerate} % Needed for markdown enumerations to work + \usepackage{geometry} % Used to adjust the document margins + \usepackage{amsmath} % Equations + \usepackage{amssymb} % Equations + \usepackage{textcomp} % defines textquotesingle + % Hack from http://tex.stackexchange.com/a/47451/13684: + \AtBeginDocument{% + \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code + } + \usepackage{upquote} % Upright quotes for verbatim code + \usepackage{eurosym} % defines \euro + \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support + \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document + \usepackage{fancyvrb} % verbatim replacement that allows latex + \usepackage{grffile} % extends the file name processing of package graphics + % to support a larger range + % The hyperref package gives us a pdf with properly built + % internal navigation ('pdf bookmarks' for the table of contents, + % internal cross-reference links, web links for URLs, etc.) + \usepackage{hyperref} + \usepackage{longtable} % longtable support required by pandoc >1.10 + \usepackage{booktabs} % table support for pandoc > 1.12.2 + \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) + \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) + % normalem makes italics be italics, not underlines + + + + + % Colors for the hyperref package + \definecolor{urlcolor}{rgb}{0,.145,.698} + \definecolor{linkcolor}{rgb}{.71,0.21,0.01} + \definecolor{citecolor}{rgb}{.12,.54,.11} + + % ANSI colors + \definecolor{ansi-black}{HTML}{3E424D} + \definecolor{ansi-black-intense}{HTML}{282C36} + \definecolor{ansi-red}{HTML}{E75C58} + \definecolor{ansi-red-intense}{HTML}{B22B31} + \definecolor{ansi-green}{HTML}{00A250} + \definecolor{ansi-green-intense}{HTML}{007427} + \definecolor{ansi-yellow}{HTML}{DDB62B} + \definecolor{ansi-yellow-intense}{HTML}{B27D12} + \definecolor{ansi-blue}{HTML}{208FFB} + \definecolor{ansi-blue-intense}{HTML}{0065CA} + \definecolor{ansi-magenta}{HTML}{D160C4} + \definecolor{ansi-magenta-intense}{HTML}{A03196} + \definecolor{ansi-cyan}{HTML}{60C6C8} + \definecolor{ansi-cyan-intense}{HTML}{258F8F} + \definecolor{ansi-white}{HTML}{C5C1B4} + \definecolor{ansi-white-intense}{HTML}{A1A6B2} + + % commands and environments needed by pandoc snippets + % extracted from the output of `pandoc -s` + \providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} + % Add ',fontsize=\small' for more characters per line + \newenvironment{Shaded}{}{} + \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} + \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} + \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} + \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} + \newcommand{\RegionMarkerTok}[1]{{#1}} + \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\NormalTok}[1]{{#1}} + + % Additional commands for more recent versions of Pandoc + \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} + \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} + \newcommand{\ImportTok}[1]{{#1}} + \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} + \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} + \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} + \newcommand{\BuiltInTok}[1]{{#1}} + \newcommand{\ExtensionTok}[1]{{#1}} + \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} + \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} + \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + + + % Define a nice break command that doesn't care if a line doesn't already + % exist. + \def\br{\hspace*{\fill} \\* } + % Math Jax compatability definitions + \def\gt{>} + \def\lt{<} + % Document parameters + \title{lecture\_12} + + + + + % Pygments definitions + +\makeatletter +\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% + \let\PY@ul=\relax \let\PY@tc=\relax% + \let\PY@bc=\relax \let\PY@ff=\relax} +\def\PY@tok#1{\csname PY@tok@#1\endcsname} +\def\PY@toks#1+{\ifx\relax#1\empty\else% + \PY@tok{#1}\expandafter\PY@toks\fi} +\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% + \PY@it{\PY@bf{\PY@ff{#1}}}}}}} +\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} + +\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} +\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} +\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} +\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} +\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} +\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} +\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} +\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} +\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\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}}} +\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} +\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} +\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} +\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} + +\def\PYZbs{\char`\\} +\def\PYZus{\char`\_} +\def\PYZob{\char`\{} +\def\PYZcb{\char`\}} +\def\PYZca{\char`\^} +\def\PYZam{\char`\&} +\def\PYZlt{\char`\<} +\def\PYZgt{\char`\>} +\def\PYZsh{\char`\#} +\def\PYZpc{\char`\%} +\def\PYZdl{\char`\$} +\def\PYZhy{\char`\-} +\def\PYZsq{\char`\'} +\def\PYZdq{\char`\"} +\def\PYZti{\char`\~} +% for compatibility with earlier versions +\def\PYZat{@} +\def\PYZlb{[} +\def\PYZrb{]} +\makeatother + + + % Exact colors from NB + \definecolor{incolor}{rgb}{0.0, 0.0, 0.5} + \definecolor{outcolor}{rgb}{0.545, 0.0, 0.0} + + + + + % Prevent overflowing lines due to hard-to-break entities + \sloppy + % Setup hyperref package + \hypersetup{ + breaklinks=true, % so long urls are correctly broken across lines + colorlinks=true, + urlcolor=urlcolor, + linkcolor=linkcolor, + citecolor=citecolor, + } + % Slightly bigger margins than the latex defaults + + \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} + + + + \begin{document} + + + \maketitle + + + + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}27}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}28}]:} \PY{n}{setdefaults} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}29}]:} \PY{n}{A}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)} + + \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{n+nb}{det}\PY{p}{(}\PY{n}{L}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 0.447394 0.357071 0.720915 0.499926 + 0.648313 0.323276 0.521677 0.288345 + 0.084982 0.581513 0.466420 0.142342 + 0.576580 0.658089 0.916987 0.923165 + +L = + + 1.00000 0.00000 0.00000 0.00000 + 0.13108 1.00000 0.00000 0.00000 + 0.69009 0.24851 1.00000 0.00000 + 0.88935 0.68736 0.68488 1.00000 + +U = + + 0.64831 0.32328 0.52168 0.28834 + 0.00000 0.53914 0.39804 0.10455 + 0.00000 0.00000 0.26199 0.27496 + 0.00000 0.00000 0.00000 0.40655 + +P = + +Permutation Matrix + + 0 1 0 0 + 0 0 1 0 + 1 0 0 0 + 0 0 0 1 + +ans = 1 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}44}]:} \PY{n}{A}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{100}\PY{p}{)}\PY{o}{\PYZsq{}}\PY{p}{;} + \PY{n}{A}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{A}\PY{p}{;} + \PY{n+nb}{size}\PY{p}{(}\PY{n}{A}\PY{p}{)} + \PY{n+nb}{min}\PY{p}{(}\PY{n+nb}{min}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{max}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{A}\PY{p}{)} + \PY{n}{C}\PY{p}{=}\PY{n+nb}{chol}\PY{p}{(}\PY{n}{A}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = + + 4 4 + +ans = 23.586 +ans = 35.826 +ans = 14.869 +C = + + 5.98549 4.28555 4.35707 4.31359 + 0.00000 3.63950 1.35005 1.45342 + 0.00000 0.00000 3.62851 1.50580 + 0.00000 0.00000 0.00000 3.21911 + + + \end{Verbatim} + + \subsection{My question from last +class}\label{my-question-from-last-class} + +\begin{figure}[htbp] +\centering +\includegraphics{det_L.png} +\caption{q1} +\end{figure} + +\begin{figure}[htbp] +\centering +\includegraphics{chol_pre.png} +\caption{q2} +\end{figure} + +\subsection{Your questions from last +class}\label{your-questions-from-last-class} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + Will the exam be more theoretical or problem based? +\item + Writing code is difficult +\item + What format can we expect for the midterm? +\item + Could we go over some example questions for the exam? +\item + Will the use of GitHub be tested on the Midterm exam? Or is it more + focused on linear algebra techniques/what was covered in the lectures? +\item + This is not my strong suit, getting a bit overwhelmed with matrix + multiplication. +\item + I forgot how much I learned in linear algebra. +\item + What's the most exciting project you've ever worked on with + Matlab/Octave? +\end{enumerate} + + \section{Matrix Inverse and +Condition}\label{matrix-inverse-and-condition} + +Considering the same solution set: + +\(y=Ax\) + +If we know that \(A^{-1}A=I\), then + +\(A^{-1}y=A^{-1}Ax=x\) + +so + +\(x=A^{-1}y\) + +Where, \(A^{-1}\) is the inverse of matrix \(A\). + +\(2x_{1}+x_{2}=1\) + +\(x_{1}+3x_{2}=1\) + +\(Ax=y\) + +\(\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]\) + +\(A^{-1}=\frac{1}{2*3-1*1}\left[ \begin{array}{cc} 3 & -1 \\ -1 & 2 \end{array} \right]= \left[ \begin{array}{cc} 3/5 & -1/5 \\ -1/5 & 2/5 \end{array} \right]\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}45}]:} \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}{]} + \PY{n}{invA}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{5}\PY{o}{*}\PY{p}{[}\PY{l+m+mi}{3}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{]} + + \PY{n}{A}\PY{o}{*}\PY{n}{invA} + \PY{n}{invA}\PY{o}{*}\PY{n}{A} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 2 1 + 1 3 + +invA = + + 0.60000 -0.20000 + -0.20000 0.40000 + +ans = + + 1.00000 0.00000 + 0.00000 1.00000 + +ans = + + 1.00000 0.00000 + 0.00000 1.00000 + + + \end{Verbatim} + + How did we know the inverse of A? + +for 2$\times$2 matrices, it is always: + +$A=\left[ \begin{array}{cc} A_{11} & A_{12} \\ A_{21} & A_{22} \end{array} \right]$ + +$A^{-1}=\frac{1}{det(A)}\left[ \begin{array}{cc} A_{22} & -A_{12} \\ -A_{21} & A_{11} \end{array} \right]$ + + $AA^{-1}=\frac{1}{A_{11}A_{22}-A_{21}A_{12}}\left[ \begin{array}{cc} A_{11}A_{22}-A_{21}A_{12} & -A_{11}A_{12}+A_{12}A_{11} \\ A_{21}A_{22}-A_{22}A_{21} & -A_{21}A_{12}+A_{22}A_{11} \end{array} \right] =\left[ \begin{array}{cc} 1 & 0 \\ 0 & 1 \end{array} \right]$ + + What about bigger matrices? + +We can use the LU-decomposition + +\(A=LU\) + +\(A^{-1}=(LU)^{-1}=U^{-1}L^{-1}\) + +if we divide \(A^{-1}\) into n-column vectors, \(a_{n}\), then + +\(Aa_{1}=\left[\begin{array}{c} 1 \\ 0 \\ \vdots \\ 0 \end{array} \right]\) +\(Aa_{2}=\left[\begin{array}{c} 0 \\ 1 \\ \vdots \\ 0 \end{array} \right]\) +\(Aa_{n}=\left[\begin{array}{c} 0 \\ 0 \\ \vdots \\ 1 \end{array} \right]\) + +Which we can solve for each \(a_{n}\) with LU-decomposition, knowing the +lower and upper triangular decompositions, then + +\(A^{-1}=\left[ \begin{array}{cccc} | & | & & | \\ a_{1} & a_{2} & \cdots & a_{n} \\ | & | & & | \end{array} \right]\) + +\(Ld_{1}=\left[\begin{array}{c} 1 \\ 0 \\ \vdots \\ 0 \end{array} \right]\) +\(;~Ua_{1}=d_{1}\) + +\(Ld_{2}=\left[\begin{array}{c} 0 \\ 1 \\ \vdots \\ 0 \end{array} \right]\) +\(;~Ua_{2}=d_{2}\) + +\(Ld_{n}=\left[\begin{array}{c} 0 \\ 1 \\ \vdots \\ n \end{array} \right]\) +\(;~Ua_{n}=d_{n}\) + +Consider the following matrix: + +\(A=\left[ \begin{array}{ccc} 2 & -1 & 0\\ -1 & 2 & -1\\ 0 & -1 & 1 \end{array} \right]\) + + \paragraph{\texorpdfstring{Note on solving for \(A^{-1}\) column +1}{Note on solving for A\^{}\{-1\} column 1}}\label{note-on-solving-for-a-1-column-1} + +\(Aa_1=I(:,1)\) + +\(LUa_1=I(:,1)\) + +\((LUa_1-I(:,1))=0\) + +\(L(Ua_1-d_1)=0\) + +\(I(:,1)=Ld_1\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}56}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{]} + \PY{n}{U}\PY{p}{=}\PY{n}{A}\PY{p}{;} + \PY{n}{L}\PY{p}{=}\PY{n+nb}{eye}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)} + \PY{n}{L}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 2 -1 0 + -1 2 -1 + 0 -1 1 + +U = + + 2.00000 -1.00000 0.00000 + 0.00000 1.50000 -1.00000 + 0.00000 -1.00000 1.00000 + +L = + + 1.00000 0.00000 0.00000 + -0.50000 1.00000 0.00000 + 0.00000 0.00000 1.00000 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}57}]:} \PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)} + \PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +L = + + 1.00000 0.00000 0.00000 + -0.50000 1.00000 0.00000 + 0.00000 -0.66667 1.00000 + +U = + + 2.00000 -1.00000 0.00000 + 0.00000 1.50000 -1.00000 + 0.00000 0.00000 0.33333 + + + \end{Verbatim} + + Now solve for \(d_1\) then \(a_1\), \(d_2\) then \(a_2\), and \(d_3\) +then \(a_{3}\) + +\(Ld_{1}=\left[\begin{array}{c} 1 \\ 0 \\ \vdots \\ 0 \end{array} \right]= \left[\begin{array}{ccc} 1 & 0 & 0 \\ -1/2 & 1 & 0 \\ 0 & -2/3 & 1 \end{array} \right]\left[\begin{array}{c} d1(1) \\ d1(2) \\ d1(3)\end{array} \right]=\left[\begin{array}{c} 1 \\ 0 \\ 0 \end{array} \right] ;~Ua_{1}=d_{1}\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}58}]:} \PY{n}{d1}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} + \PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +d1 = + + 1.00000 + 0.50000 + 0.33333 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}59}]:} \PY{n}{a1}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)}\PY{p}{;} + \PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a1}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +a1 = + + 1.00000 + 1.00000 + 1.00000 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}60}]:} \PY{n}{d2}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{p}{;} + \PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +d2 = + + 0.00000 + 1.00000 + 0.66667 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}61}]:} \PY{n}{a2}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)}\PY{p}{;} + \PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d2}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +a2 = + + 1.0000 + 2.0000 + 2.0000 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}62}]:} \PY{n}{d3}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{p}{;} + \PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{0}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{L}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +d3 = + + 0 + 0 + 1 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}63}]:} \PY{n}{a3}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)}\PY{p}{;} + \PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{/}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{p}{(}\PY{n}{d3}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{U}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{a3}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +a3 = + + 1.00000 + 2.00000 + 3.00000 + + + \end{Verbatim} + + Final solution for \(A^{-1}\) is \([a_{1}~a_{2}~a_{3}]\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}69}]:} \PY{n}{invA}\PY{p}{=}\PY{p}{[}\PY{n}{a1}\PY{p}{,}\PY{n}{a2}\PY{p}{,}\PY{n}{a3}\PY{p}{]} + \PY{n}{I\PYZus{}app}\PY{p}{=}\PY{n}{A}\PY{o}{*}\PY{n}{invA} + \PY{n}{I\PYZus{}app}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)} + \PY{n+nb}{eps} + + \PY{l+m+mi}{2}\PYZca{}\PY{o}{\PYZhy{}}\PY{l+m+mi}{8} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +invA = + + 1.00000 1.00000 1.00000 + 1.00000 2.00000 2.00000 + 1.00000 2.00000 3.00000 + +I\_app = + + 1.00000 0.00000 0.00000 + 0.00000 1.00000 -0.00000 + -0.00000 -0.00000 1.00000 + +ans = -4.4409e-16 +ans = 2.2204e-16 +ans = 0.0039062 + + \end{Verbatim} + + Now the solution of \(x\) to \(Ax=y\) is \(x=A^{-1}y\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}70}]:} \PY{n}{y}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{2}\PY{p}{;}\PY{l+m+mi}{3}\PY{p}{]} + \PY{n}{x}\PY{p}{=}\PY{n}{invA}\PY{o}{*}\PY{n}{y} + \PY{n}{xbs}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{y} + \PY{n}{x}\PY{o}{\PYZhy{}}\PY{n}{xbs} + \PY{n+nb}{eps} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +y = + + 1 + 2 + 3 + +x = + + 6.0000 + 11.0000 + 14.0000 + +xbs = + + 6.0000 + 11.0000 + 14.0000 + +ans = + + -3.5527e-15 + -8.8818e-15 + -1.0658e-14 + +ans = 2.2204e-16 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}71}]:} \PY{n}{N}\PY{p}{=}\PY{l+m+mi}{100}\PY{p}{;} + \PY{n}{n}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{:}\PY{n}{N}\PY{p}{]}\PY{p}{;} + \PY{n}{t\PYZus{}inv}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{t\PYZus{}bs}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{t\PYZus{}mult}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{n}{N} + \PY{n}{A}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{i}\PY{p}{,}\PY{n}{i}\PY{p}{)}\PY{p}{;} + \PY{n+nb}{tic} + \PY{n}{invA}\PY{p}{=}\PY{n+nb}{inv}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{;} + \PY{n}{t\PYZus{}inv}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \PY{n}{b}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{i}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n+nb}{tic}\PY{p}{;} + \PY{n}{x}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{b}\PY{p}{;} + \PY{n}{t\PYZus{}bs}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \PY{n+nb}{tic}\PY{p}{;} + \PY{n}{x}\PY{p}{=}\PY{n}{invA}\PY{o}{*}\PY{n}{b}\PY{p}{;} + \PY{n}{t\PYZus{}mult}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \PY{k}{end} + \PY{n+nb}{plot}\PY{p}{(}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}inv}\PY{p}{,}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}bs}\PY{p}{,}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}mult}\PY{p}{)} + \PY{n+nb}{axis}\PY{p}{(}\PY{p}{[}\PY{l+m+mi}{0} \PY{l+m+mi}{100} \PY{l+m+mi}{0} \PY{l+m+mf}{0.002}\PY{p}{]}\PY{p}{)} + \PY{n+nb}{legend}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{inversion\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{backslash\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{multiplication\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{Location\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{NorthWest\PYZsq{}}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_12_files/lecture_12_24_0.pdf} + \end{center} + { \hspace*{\fill} \\} + + \subsection{Condition of a matrix}\label{condition-of-a-matrix} + +\subsubsection{\texorpdfstring{\emph{just checked in to see what +condition my condition was +in}}{just checked in to see what condition my condition was in}}\label{just-checked-in-to-see-what-condition-my-condition-was-in} + +\subsubsection{Matrix norms}\label{matrix-norms} + +The Euclidean norm of a vector is measure of the magnitude (in 3D this +would be: \(|x|=\sqrt{x_{1}^{2}+x_{2}^{2}+x_{3}^{2}}\)) in general the +equation is: + +\(||x||_{e}=\sqrt{\sum_{i=1}^{n}x_{i}^{2}}\) + +For a matrix, A, the same norm is called the Frobenius norm: + +\(||A||_{f}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{2}}\) + +In general we can calculate any \(p\)-norm where + +\(||A||_{p}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{p}}\) + +so the p=1, 1-norm is + +\(||A||_{1}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{1}}=\sum_{i=1}^{n}\sum_{i=1}^{m}|A_{i,j}|\) + +\(||A||_{\infty}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{\infty}}=\max_{1\le i \le n}\sum_{j=1}^{m}|A_{i,j}|\) + +\subsubsection{Condition of Matrix}\label{condition-of-matrix} + +The matrix condition is the product of + +\(Cond(A) = ||A||\cdot||A^{-1}||\) + +So each norm will have a different condition number, but the limit is +\(Cond(A)\ge 1\) + +An estimate of the rounding error is based on the condition of A: + +\(\frac{||\Delta x||}{x} \le Cond(A) \frac{||\Delta A||}{||A||}\) + +So if the coefficients of A have accuracy to \$10\^{}\{-t\} + +and the condition of A, \(Cond(A)=10^{c}\) + +then the solution for x can have rounding errors up to \(10^{c-t}\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{4}\PY{p}{;}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{5}\PY{p}{]} + \PY{p}{[}\PY{n}{L}\PY{p}{,}\PY{n}{U}\PY{p}{]}\PY{p}{=}\PY{n}{LU\PYZus{}naive}\PY{p}{(}\PY{n}{A}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 1.00000 0.50000 0.33333 + 0.50000 0.33333 0.25000 + 0.33333 0.25000 0.20000 + +L = + + 1.00000 0.00000 0.00000 + 0.50000 1.00000 0.00000 + 0.33333 1.00000 1.00000 + +U = + + 1.00000 0.50000 0.33333 + 0.00000 0.08333 0.08333 + 0.00000 -0.00000 0.00556 + + + \end{Verbatim} + + Then, \(A^{-1}=(LU)^{-1}=U^{-1}L^{-1}\) + +\(Ld_{1}=\left[\begin{array}{c} 1 \\ 0 \\ 0 \end{array}\right]\), +\(Ux_{1}=d_{1}\) ... + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}75}]:} \PY{n}{invA}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{d1}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{d2}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{d3}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d1}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d2}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d3} + \PY{n}{invA}\PY{o}{*}\PY{n}{A} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +invA = + + 9.0000 -36.0000 30.0000 + -36.0000 192.0000 -180.0000 + 30.0000 -180.0000 180.0000 + +ans = + + 1.0000e+00 3.5527e-15 2.9976e-15 + -1.3249e-14 1.0000e+00 -9.1038e-15 + 8.5117e-15 7.1054e-15 1.0000e+00 + + + \end{Verbatim} + + Find the condition of A, \(cond(A)\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}74}]:} \PY{c}{\PYZpc{} Frobenius norm} + \PY{n}{normf\PYZus{}A} \PY{p}{=} \PY{n+nb}{sqrt}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{p}{)} + \PY{n}{normf\PYZus{}invA} \PY{p}{=} \PY{n+nb}{sqrt}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{p}{)} + + \PY{n}{cond\PYZus{}f\PYZus{}A} \PY{p}{=} \PY{n}{normf\PYZus{}A}\PY{o}{*}\PY{n}{normf\PYZus{}invA} + + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{fro\PYZsq{}}\PY{p}{)} + + \PY{c}{\PYZpc{} p=1, column sum norm} + \PY{n}{norm1\PYZus{}A} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{norm1\PYZus{}invA} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)} + + \PY{n}{cond\PYZus{}1\PYZus{}A}\PY{p}{=}\PY{n}{norm1\PYZus{}A}\PY{o}{*}\PY{n}{norm1\PYZus{}invA} + + \PY{c}{\PYZpc{} p=inf, row sum norm} + \PY{n}{norminf\PYZus{}A} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)} + \PY{n}{norminf\PYZus{}invA} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n+nb}{inf}\PY{p}{)} + + \PY{n}{cond\PYZus{}inf\PYZus{}A}\PY{p}{=}\PY{n}{norminf\PYZus{}A}\PY{o}{*}\PY{n}{norminf\PYZus{}invA} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +normf\_A = 1.4136 +normf\_invA = 372.21 +cond\_f\_A = 526.16 +ans = 1.4136 +norm1\_A = 1.8333 +norm1\_invA = 30.000 +ans = 1.8333 +cond\_1\_A = 55.000 +norminf\_A = 1.8333 +norminf\_invA = 30.000 +ans = 1.8333 +cond\_inf\_A = 55.000 + + \end{Verbatim} + + Consider the problem again from the intro to Linear Algebra, 4 masses +are connected in series to 4 springs with spring constants \(K_{i}\). +What does a high condition number mean for this problem? + +\begin{figure}[htbp] +\centering +\includegraphics{../lecture_09/mass_springs.png} +\caption{Springs-masses} +\end{figure} + +The masses haves the following amounts, 1, 2, 3, and 4 kg for masses +1-4. Using a FBD for each mass: + +\(m_{1}g+k_{2}(x_{2}-x_{1})-k_{1}x_{1}=0\) + +\(m_{2}g+k_{3}(x_{3}-x_{2})-k_{2}(x_{2}-x_{1})=0\) + +\(m_{3}g+k_{4}(x_{4}-x_{3})-k_{3}(x_{3}-x_{2})=0\) + +\(m_{4}g-k_{4}(x_{4}-x_{3})=0\) + +in matrix form: + +\(\left[ \begin{array}{cccc} k_{1}+k_{2} & -k_{2} & 0 & 0 \\ -k_{2} & k_{2}+k_{3} & -k_{3} & 0 \\ 0 & -k_{3} & k_{3}+k_{4} & -k_{4} \\ 0 & 0 & -k_{4} & k_{4} \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]\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}21}]:} \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} + \PY{n}{k2}\PY{p}{=}\PY{l+m+mi}{100000}\PY{p}{;} + \PY{n}{k3}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} + \PY{n}{k4}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} + \PY{n}{m1}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} kg} + \PY{n}{m2}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;} + \PY{n}{m3}\PY{p}{=}\PY{l+m+mi}{3}\PY{p}{;} + \PY{n}{m4}\PY{p}{=}\PY{l+m+mi}{4}\PY{p}{;} + \PY{n}{g}\PY{p}{=}\PY{l+m+mf}{9.81}\PY{p}{;} \PY{c}{\PYZpc{} m/s\PYZca{}2} + \PY{n}{K}\PY{p}{=}\PY{p}{[}\PY{n}{k1}\PY{o}{+}\PY{n}{k2} \PY{o}{\PYZhy{}}\PY{n}{k2} \PY{l+m+mi}{0} \PY{l+m+mi}{0}\PY{p}{;} \PY{o}{\PYZhy{}}\PY{n}{k2} \PY{n}{k2}\PY{o}{+}\PY{n}{k3} \PY{o}{\PYZhy{}}\PY{n}{k3} \PY{l+m+mi}{0}\PY{p}{;} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k3} \PY{n}{k3}\PY{o}{+}\PY{n}{k4} \PY{o}{\PYZhy{}}\PY{n}{k4}\PY{p}{;} \PY{l+m+mi}{0} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k4} \PY{n}{k4}\PY{p}{]} + \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}{]} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +K = + + 100010 -100000 0 0 + -100000 100010 -10 0 + 0 -10 11 -1 + 0 0 -1 1 + +y = + + 9.8100 + 19.6200 + 29.4300 + 39.2400 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}25}]:} \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{n+nb}{inf}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{fro\PYZsq{}}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = 3.2004e+05 +ans = 3.2004e+05 +ans = 2.5925e+05 +ans = 2.5293e+05 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}26}]:} \PY{n+nb}{e}\PY{p}{=}\PY{n+nb}{eig}\PY{p}{(}\PY{n}{K}\PY{p}{)} + \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{e}\PY{p}{)}\PY{o}{/}\PY{n+nb}{min}\PY{p}{(}\PY{n+nb}{e}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +e = + + 7.9078e-01 + 3.5881e+00 + 1.7621e+01 + 2.0001e+05 + +ans = 2.5293e+05 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor} }]:} +\end{Verbatim} + + + % Add a bibliography block to the postdoc + + + + \end{document} diff --git a/lecture_12/lecture_12_files/lecture_12_21_0.png b/lecture_12/lecture_12_files/lecture_12_21_0.png new file mode 100644 index 0000000..2633731 Binary files /dev/null and b/lecture_12/lecture_12_files/lecture_12_21_0.png differ diff --git a/lecture_12/lecture_12_files/lecture_12_24_0.pdf b/lecture_12/lecture_12_files/lecture_12_24_0.pdf new file mode 100644 index 0000000..e2d1d9b Binary files /dev/null and b/lecture_12/lecture_12_files/lecture_12_24_0.pdf differ diff --git a/lecture_12/lecture_12_files/lecture_12_24_0.png b/lecture_12/lecture_12_files/lecture_12_24_0.png new file mode 100644 index 0000000..c8959a7 Binary files /dev/null and b/lecture_12/lecture_12_files/lecture_12_24_0.png differ diff --git a/lecture_12/lecture_12_files/lecture_12_24_0.svg b/lecture_12/lecture_12_files/lecture_12_24_0.svg new file mode 100644 index 0000000..4705883 --- /dev/null +++ b/lecture_12/lecture_12_files/lecture_12_24_0.svg @@ -0,0 +1,148 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 0.0005 + + + + + 0.001 + + + + + 0.0015 + + + + + 0.002 + + + + + 0 + + + + + 20 + + + + + 40 + + + + + 60 + + + + + 80 + + + + + 100 + + + + + + + + + + + + + inversion + + + + + inversion + + + + + + backslash + + + backslash + + + + + + multiplication + + + multiplication + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_13/.GS_rel.m.swp b/lecture_13/.GS_rel.m.swp new file mode 100644 index 0000000..58db6b3 Binary files /dev/null and b/lecture_13/.GS_rel.m.swp differ diff --git a/lecture_13/.GaussSeidel.m.swp b/lecture_13/.GaussSeidel.m.swp new file mode 100644 index 0000000..43abe04 Binary files /dev/null and b/lecture_13/.GaussSeidel.m.swp differ diff --git a/lecture_13/.Jacobi_rel.m.swp b/lecture_13/.Jacobi_rel.m.swp new file mode 100644 index 0000000..8f17e8f Binary files /dev/null and b/lecture_13/.Jacobi_rel.m.swp differ diff --git a/lecture_13/.ipynb_checkpoints/lecture_12-checkpoint.ipynb b/lecture_13/.ipynb_checkpoints/lecture_13-checkpoint.ipynb similarity index 100% rename from lecture_13/.ipynb_checkpoints/lecture_12-checkpoint.ipynb rename to lecture_13/.ipynb_checkpoints/lecture_13-checkpoint.ipynb diff --git a/lecture_13/.lambda_fcn.m.swp b/lecture_13/.lambda_fcn.m.swp new file mode 100644 index 0000000..5031365 Binary files /dev/null and b/lecture_13/.lambda_fcn.m.swp differ diff --git a/lecture_13/GS_rel.m b/lecture_13/GS_rel.m new file mode 100644 index 0000000..4a6daf4 --- /dev/null +++ b/lecture_13/GS_rel.m @@ -0,0 +1,36 @@ +function [x,ea,iter] = GS_rel(A,b,lambda,es,maxit) +% GaussSeidel: Gauss Seidel method +% x = GaussSeidel(A,b): Gauss Seidel without relaxation +% input: +% A = coefficient matrix +% b = right hand side vector +% es = stop criterion (default = 0.00001%) +% maxit = max iterations (default = 50) +% output: +% x = solution vector +if nargin<3,error('at least 2 input arguments required'),end +if nargin<5|isempty(maxit),maxit=50;end +if nargin<4|isempty(es),es=0.00001;end +[m,n] = size(A); +if m~=n, error('Matrix A must be square'); end +C = A-diag(diag(A)); +x=zeros(n,1); +for i = 1:n + C(i,1:n) = C(i,1:n)/A(i,i); +end + +d = b./diag(A); + +iter = 0; +while (1) + xold = x; + for i = 1:n + x(i) = d(i)-C(i,:)*x; + x(i) = lambda*x(i)+(1-lambda)*xold(i); + if x(i) ~= 0 + ea(i) = abs((x(i) - xold(i))/x(i)) * 100; + end + end + iter = iter+1; + if max(ea)<=es | iter >= maxit, break, end +end diff --git a/lecture_13/GaussSeidel.m b/lecture_13/GaussSeidel.m new file mode 100644 index 0000000..2be52e1 --- /dev/null +++ b/lecture_13/GaussSeidel.m @@ -0,0 +1,35 @@ +function x = GaussSeidel(A,b,es,maxit) +% GaussSeidel: Gauss Seidel method +% x = GaussSeidel(A,b): Gauss Seidel without relaxation +% input: +% A = coefficient matrix +% b = right hand side vector +% es = stop criterion (default = 0.00001%) +% maxit = max iterations (default = 50) +% output: +% x = solution vector +if nargin<2,error('at least 2 input arguments required'),end +if nargin<4|isempty(maxit),maxit=50;end +if nargin<3|isempty(es),es=0.00001;end +[m,n] = size(A); +if m~=n, error('Matrix A must be square'); end +C = A-diag(diag(A)); +x=zeros(n,1); +for i = 1:n + C(i,1:n) = C(i,1:n)/A(i,i); +end + +d = b./diag(A); + +iter = 0; +while (1) + xold = x; + for i = 1:n + x(i) = d(i)-C(i,:)*x; + if x(i) ~= 0 + ea(i) = abs((x(i) - xold(i))/x(i)) * 100; + end + end + iter = iter+1; + if max(ea)<=es | iter >= maxit, break, end +end diff --git a/lecture_13/Jacobi.m b/lecture_13/Jacobi.m new file mode 100644 index 0000000..8a7b4ae --- /dev/null +++ b/lecture_13/Jacobi.m @@ -0,0 +1,39 @@ +function x = Jacobi(A,b,es,maxit) +% GaussSeidel: Gauss Seidel method +% x = GaussSeidel(A,b): Gauss Seidel without relaxation +% input: +% A = coefficient matrix +% b = right hand side vector +% es = stop criterion (default = 0.00001%) +% maxit = max iterations (default = 50) +% output: +% x = solution vector +if nargin<2,error('at least 2 input arguments required'),end +if nargin<4|isempty(maxit),maxit=50;end +if nargin<3|isempty(es),es=0.00001;end +[m,n] = size(A); +if m~=n, error('Matrix A must be square'); end +C = A-diag(diag(A)); +x=zeros(n,1); +for i = 1:n + C(i,1:n) = C(i,1:n)/A(i,i); +end + +d = b./diag(A); + +iter = 0; +while (1) + xold = x; + x = d-C*x; + % if any values of x are zero, we add 1 to denominator so error is well-behaved + i_zero=find(x==0); + i=find(x~=0); + if length(i_zero)>0 + ea(i_zero)=abs((x-xold)./(1+x)*100); + ea(i) = abs((x(i) - xold(i))./x(i)) * 100; + else + ea = abs((x - xold)./x) * 100; + end + iter = iter+1; + if max(ea)<=es | iter >= maxit, break, end +end diff --git a/lecture_13/Jacobi_rel.m b/lecture_13/Jacobi_rel.m new file mode 100644 index 0000000..5cdec33 --- /dev/null +++ b/lecture_13/Jacobi_rel.m @@ -0,0 +1,41 @@ +function [x,ea,iter]= Jacobi_rel(A,b,lambda,es,maxit) +% GaussSeidel: Gauss Seidel method +% x = GaussSeidel(A,b): Gauss Seidel without relaxation +% input: +% A = coefficient matrix +% b = right hand side vector +% es = stop criterion (default = 0.00001%) +% maxit = max iterations (default = 50) +% output: +% x = solution vector +if nargin<3,error('at least 2 input arguments required'),end +if nargin<5|isempty(maxit),maxit=50;end +if nargin<4|isempty(es),es=0.00001;end +[m,n] = size(A); +if m~=n, error('Matrix A must be square'); end +C = A-diag(diag(A)); +x=zeros(n,1); +for i = 1:n + C(i,1:n) = C(i,1:n)/A(i,i); +end + +d = b./diag(A); + +iter = 0; +while (1) + xold = x; + x = d-C*x; + % Add relaxation parameter lambda to current iteration + x = lambda*x+(1-lambda)*xold; + % if any values of x are zero, we add 1 to denominator so error is well-behaved + i_zero=find(x==0); + i=find(x~=0); + if length(i_zero)>0 + ea(i_zero)=abs((x-xold)./(1+x)*100); + ea(i) = abs((x(i) - xold(i))./x(i)) * 100; + else + ea = abs((x - xold)./x) * 100; + end + iter = iter+1; + if max(ea)<=es | iter >= maxit, break, end +end diff --git a/lecture_13/efficient_soln.png b/lecture_13/efficient_soln.png new file mode 100644 index 0000000..ef24ece Binary files /dev/null and b/lecture_13/efficient_soln.png differ diff --git a/lecture_13/gp_image_01.png b/lecture_13/gp_image_01.png new file mode 100644 index 0000000..ef291b5 Binary files /dev/null and b/lecture_13/gp_image_01.png differ diff --git a/lecture_13/lambda_fcn.m b/lecture_13/lambda_fcn.m new file mode 100644 index 0000000..435f9e9 --- /dev/null +++ b/lecture_13/lambda_fcn.m @@ -0,0 +1,8 @@ +function iters = lambda_fcn(A,b,lambda) + % function to minimize the number of iterations for a given Ax=b solution + % using default Jacobi_rel parameters of es=0.00001 and maxit=50 + + [x,ea,iters]= Jacobi_rel(A,b,lambda,1e-8); +end + + diff --git a/lecture_13/lecture_13.aux b/lecture_13/lecture_13.aux new file mode 100644 index 0000000..513ef62 --- /dev/null +++ b/lecture_13/lecture_13.aux @@ -0,0 +1,59 @@ +\relax +\providecommand\hyper@newdestlabel[2]{} +\providecommand\HyperFirstAtBeginDocument{\AtBeginDocument} +\HyperFirstAtBeginDocument{\ifx\hyper@anchor\@undefined +\global\let\oldcontentsline\contentsline +\gdef\contentsline#1#2#3#4{\oldcontentsline{#1}{#2}{#3}} +\global\let\oldnewlabel\newlabel +\gdef\newlabel#1#2{\newlabelxx{#1}#2} +\gdef\newlabelxx#1#2#3#4#5#6{\oldnewlabel{#1}{{#2}{#3}}} +\AtEndDocument{\ifx\hyper@anchor\@undefined +\let\contentsline\oldcontentsline +\let\newlabel\oldnewlabel +\fi} +\fi} +\global\let\hyper@last\relax +\gdef\HyperFirstAtBeginDocument#1{#1} +\providecommand\HyField@AuxAddToFields[1]{} +\providecommand\HyField@AuxAddToCoFields[2]{} +\providecommand \oddpage@label [2]{} +\@writefile{toc}{\contentsline {subsection}{\numberline {0.1}My question from last class}{1}{subsection.0.1}} +\newlabel{my-question-from-last-class}{{0.1}{1}{My question from last class}{subsection.0.1}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces q1\relax }}{1}{figure.caption.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {0.2}Your questions from last class}{1}{subsection.0.2}} +\newlabel{your-questions-from-last-class}{{0.2}{1}{Your questions from last class}{subsection.0.2}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces q2\relax }}{2}{figure.caption.2}} +\@writefile{toc}{\contentsline {subsection}{\numberline {0.3}Condition of a matrix}{2}{subsection.0.3}} +\newlabel{condition-of-a-matrix}{{0.3}{2}{Condition of a matrix}{subsection.0.3}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.1}\emph {just checked in to see what condition my condition was in}}{2}{subsubsection.0.3.1}} +\newlabel{just-checked-in-to-see-what-condition-my-condition-was-in}{{0.3.1}{2}{\texorpdfstring {\emph {just checked in to see what condition my condition was in}}{just checked in to see what condition my condition was in}}{subsubsection.0.3.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.2}Matrix norms}{2}{subsubsection.0.3.2}} +\newlabel{matrix-norms}{{0.3.2}{2}{Matrix norms}{subsubsection.0.3.2}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.3}Condition of Matrix}{3}{subsubsection.0.3.3}} +\newlabel{condition-of-matrix}{{0.3.3}{3}{Condition of Matrix}{subsubsection.0.3.3}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Springs-masses\relax }}{5}{figure.caption.3}} +\@writefile{toc}{\contentsline {section}{\numberline {1}Iterative Methods}{6}{section.1}} +\newlabel{iterative-methods}{{1}{6}{Iterative Methods}{section.1}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Gauss-Seidel method}{6}{subsection.1.1}} +\newlabel{gauss-seidel-method}{{1.1}{6}{Gauss-Seidel method}{subsection.1.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Gauss-Seidel Iterative approach}{7}{subsubsection.1.1.1}} +\newlabel{gauss-seidel-iterative-approach}{{1.1.1}{7}{Gauss-Seidel Iterative approach}{subsubsection.1.1.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Jacobi method}{7}{subsubsection.1.1.2}} +\newlabel{jacobi-method}{{1.1.2}{7}{Jacobi method}{subsubsection.1.1.2}{}} +\gdef \LT@i {\LT@entry + {1}{52.97838pt}\LT@entry + {1}{181.1121pt}\LT@entry + {1}{35.4892pt}\LT@entry + {1}{179.80707pt}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Gauss-Seidel with Relaxation}{11}{subsection.1.2}} +\newlabel{gauss-seidel-with-relaxation}{{1.2}{11}{Gauss-Seidel with Relaxation}{subsection.1.2}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Nonlinear Systems}{13}{subsection.1.3}} +\newlabel{nonlinear-systems}{{1.3}{13}{Nonlinear Systems}{subsection.1.3}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}Newton-Raphson part II}{14}{subsection.1.4}} +\newlabel{newton-raphson-part-ii}{{1.4}{14}{Newton-Raphson part II}{subsection.1.4}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.1}Solution is again in the form Ax=b}{15}{subsubsection.1.4.1}} +\newlabel{solution-is-again-in-the-form-axb}{{1.4.1}{15}{Solution is again in the form Ax=b}{subsubsection.1.4.1}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.5}Example of Jacobian calculation}{15}{subsection.1.5}} +\newlabel{example-of-jacobian-calculation}{{1.5}{15}{Example of Jacobian calculation}{subsection.1.5}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.5.1}Nonlinear springs supporting two masses in series}{15}{subsubsection.1.5.1}} +\newlabel{nonlinear-springs-supporting-two-masses-in-series}{{1.5.1}{15}{Nonlinear springs supporting two masses in series}{subsubsection.1.5.1}{}} diff --git a/lecture_13/lecture_13.bbl b/lecture_13/lecture_13.bbl new file mode 100644 index 0000000..e69de29 diff --git a/lecture_13/lecture_13.blg b/lecture_13/lecture_13.blg new file mode 100644 index 0000000..fb66ca0 --- /dev/null +++ b/lecture_13/lecture_13.blg @@ -0,0 +1,48 @@ +This is BibTeX, Version 0.99d (TeX Live 2015/Debian) +Capacity: max_strings=35307, hash_size=35307, hash_prime=30011 +The top-level auxiliary file: lecture_13.aux +I found no \citation commands---while reading file lecture_13.aux +I found no \bibdata command---while reading file lecture_13.aux +I found no \bibstyle command---while reading file lecture_13.aux +You've used 0 entries, + 0 wiz_defined-function locations, + 83 strings with 494 characters, +and the built_in function-call counts, 0 in all, are: += -- 0 +> -- 0 +< -- 0 ++ -- 0 +- -- 0 +* -- 0 +:= -- 0 +add.period$ -- 0 +call.type$ -- 0 +change.case$ -- 0 +chr.to.int$ -- 0 +cite$ -- 0 +duplicate$ -- 0 +empty$ -- 0 +format.name$ -- 0 +if$ -- 0 +int.to.chr$ -- 0 +int.to.str$ -- 0 +missing$ -- 0 +newline$ -- 0 +num.names$ -- 0 +pop$ -- 0 +preamble$ -- 0 +purify$ -- 0 +quote$ -- 0 +skip$ -- 0 +stack$ -- 0 +substring$ -- 0 +swap$ -- 0 +text.length$ -- 0 +text.prefix$ -- 0 +top$ -- 0 +type$ -- 0 +warning$ -- 0 +while$ -- 0 +width$ -- 0 +write$ -- 0 +(There were 3 error messages) diff --git a/lecture_13/lecture_13.ipynb b/lecture_13/lecture_13.ipynb new file mode 100644 index 0000000..34a39e5 --- /dev/null +++ b/lecture_13/lecture_13.ipynb @@ -0,0 +1,5622 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "%plot --format svg" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "setdefaults" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## My question from last class \n", + "\n", + "![q1](efficient_soln.png)\n", + "\n", + "![A](https://lh4.googleusercontent.com/fmG7EnFxpvvjSgijOuwz8osuiH3cBDgOzTE64KnfQeeDDSG2oE86-BzcpYIQMVkkAgRRGEDEGi6-Nkr8qmEMeaAk-gcjEmXe42WFYUdOa5XoUaBkXRakkA77_XrkRjArCGZIFhjjDRoO7x0)\n", + "\n", + "![q2](norm_A.png)\n", + "\n", + "\n", + "## Your questions from last class\n", + "\n", + "1. Do we have to submit a link for HW #4 somewhere or is uploading to Github sufficient?\n", + " \n", + " -no, your submission from HW 3 is sufficient\n", + "\n", + "2. How do I get the formulas/formatting in markdown files to show up on github?\n", + " \n", + " -no luck for markdown equations in github, this is an ongoing request\n", + " \n", + "3. Confused about the p=1 norm part and ||A||_1\n", + "\n", + "4. When's the exam?\n", + " \n", + " -next week (3/9)\n", + "\n", + "5. What do you recommend doing to get better at figuring out the homeworks?\n", + "\n", + " -time and experimenting (try going through the lecture examples, verify my work)\n", + " \n", + "6. Could we have an hw or extra credit with a video lecture to learn some simple python?\n", + " \n", + " -Sounds great! how simple? \n", + " \n", + " -[Installing Python and Jupyter Notebook (via Anaconda) - https://www.continuum.io/downloads](https://www.continuum.io/downloads)\n", + " \n", + " -[Running Matlab kernel in Jupyter - https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/](https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/)\n", + " \n", + " -[Running Octave kernel in Jupyter - https://anaconda.org/pypi/octave_kernel](https://anaconda.org/pypi/octave_kernel)\n", + " \n", + " " + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Condition of a matrix \n", + "### *just checked in to see what condition my condition was in*\n", + "### Matrix norms\n", + "\n", + "The Euclidean norm of a vector is measure of the magnitude (in 3D this would be: $|x|=\\sqrt{x_{1}^{2}+x_{2}^{2}+x_{3}^{2}}$) in general the equation is:\n", + "\n", + "$||x||_{e}=\\sqrt{\\sum_{i=1}^{n}x_{i}^{2}}$\n", + "\n", + "For a matrix, A, the same norm is called the Frobenius norm:\n", + "\n", + "$||A||_{f}=\\sqrt{\\sum_{i=1}^{n}\\sum_{i=1}^{m}A_{i,j}^{2}}$\n", + "\n", + "In general we can calculate any $p$-norm where\n", + "\n", + "$||A||_{p}=\\sqrt{\\sum_{i=1}^{n}\\sum_{i=1}^{m}A_{i,j}^{p}}$\n", + "\n", + "so the p=1, 1-norm is \n", + "\n", + "$||A||_{1}=\\sqrt{\\sum_{i=1}^{n}\\sum_{i=1}^{m}A_{i,j}^{1}}=\\sum_{i=1}^{n}\\sum_{i=1}^{m}|A_{i,j}|$\n", + "\n", + "$||A||_{\\infty}=\\sqrt{\\sum_{i=1}^{n}\\sum_{i=1}^{m}A_{i,j}^{\\infty}}=\\max_{1\\le i \\le n}\\sum_{j=1}^{m}|A_{i,j}|$\n", + "\n", + "### Condition of Matrix\n", + "\n", + "The matrix condition is the product of \n", + "\n", + "$Cond(A) = ||A||\\cdot||A^{-1}||$ \n", + "\n", + "So each norm will have a different condition number, but the limit is $Cond(A)\\ge 1$\n", + "\n", + "An estimate of the rounding error is based on the condition of A:\n", + "\n", + "$\\frac{||\\Delta x||}{x} \\le Cond(A) \\frac{||\\Delta A||}{||A||}$\n", + "\n", + "So if the coefficients of A have accuracy to $10^{-t}\n", + "\n", + "and the condition of A, $Cond(A)=10^{c}$\n", + "\n", + "then the solution for x can have rounding errors up to $10^{c-t}$\n" + ] + }, + { + "cell_type": "code", + "execution_count": 72, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 1.00000 0.50000 0.33333\n", + " 0.50000 0.33333 0.25000\n", + " 0.33333 0.25000 0.20000\n", + "\n", + "L =\n", + "\n", + " 1.00000 0.00000 0.00000\n", + " 0.50000 1.00000 0.00000\n", + " 0.33333 1.00000 1.00000\n", + "\n", + "U =\n", + "\n", + " 1.00000 0.50000 0.33333\n", + " 0.00000 0.08333 0.08333\n", + " 0.00000 -0.00000 0.00556\n", + "\n" + ] + } + ], + "source": [ + "A=[1,1/2,1/3;1/2,1/3,1/4;1/3,1/4,1/5]\n", + "[L,U]=LU_naive(A)" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "Then, $A^{-1}=(LU)^{-1}=U^{-1}L^{-1}$\n", + "\n", + "$Ld_{1}=\\left[\\begin{array}{c}\n", + "1 \\\\\n", + "0 \\\\\n", + "0 \\end{array}\\right]$, $Ux_{1}=d_{1}$ ..." + ] + }, + { + "cell_type": "code", + "execution_count": 75, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "invA =\n", + "\n", + " 9.0000 -36.0000 30.0000\n", + " -36.0000 192.0000 -180.0000\n", + " 30.0000 -180.0000 180.0000\n", + "\n", + "ans =\n", + "\n", + " 1.0000e+00 3.5527e-15 2.9976e-15\n", + " -1.3249e-14 1.0000e+00 -9.1038e-15\n", + " 8.5117e-15 7.1054e-15 1.0000e+00\n", + "\n" + ] + } + ], + "source": [ + "invA=zeros(3,3);\n", + "d1=L\\[1;0;0];\n", + "d2=L\\[0;1;0];\n", + "d3=L\\[0;0;1];\n", + "invA(:,1)=U\\d1;\n", + "invA(:,2)=U\\d2;\n", + "invA(:,3)=U\\d3\n", + "invA*A" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Find the condition of A, $cond(A)$" + ] + }, + { + "cell_type": "code", + "execution_count": 74, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "normf_A = 1.4136\n", + "normf_invA = 372.21\n", + "cond_f_A = 526.16\n", + "ans = 1.4136\n", + "norm1_A = 1.8333\n", + "norm1_invA = 30.000\n", + "ans = 1.8333\n", + "cond_1_A = 55.000\n", + "norminf_A = 1.8333\n", + "norminf_invA = 30.000\n", + "ans = 1.8333\n", + "cond_inf_A = 55.000\n" + ] + } + ], + "source": [ + "% Frobenius norm\n", + "normf_A = sqrt(sum(sum(A.^2)))\n", + "normf_invA = sqrt(sum(sum(invA.^2)))\n", + "\n", + "cond_f_A = normf_A*normf_invA\n", + "\n", + "norm(A,'fro')\n", + "\n", + "% p=1, column sum norm\n", + "norm1_A = max(sum(A,2))\n", + "norm1_invA = max(sum(invA,2))\n", + "norm(A,1)\n", + "\n", + "cond_1_A=norm1_A*norm1_invA\n", + "\n", + "% p=inf, row sum norm\n", + "norminf_A = max(sum(A,1))\n", + "norminf_invA = max(sum(invA,1))\n", + "norm(A,inf)\n", + "\n", + "cond_inf_A=norminf_A*norminf_invA\n" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "Consider the problem again from the intro to Linear Algebra, 4 masses are connected in series to 4 springs with spring constants $K_{i}$. What does a high condition number mean for this problem? \n", + "\n", + "![Springs-masses](../lecture_09/mass_springs.png)\n", + "\n", + "The masses haves the following amounts, 1, 2, 3, and 4 kg for masses 1-4. Using a FBD for each mass:\n", + "\n", + "$m_{1}g+k_{2}(x_{2}-x_{1})-k_{1}x_{1}=0$\n", + "\n", + "$m_{2}g+k_{3}(x_{3}-x_{2})-k_{2}(x_{2}-x_{1})=0$\n", + "\n", + "$m_{3}g+k_{4}(x_{4}-x_{3})-k_{3}(x_{3}-x_{2})=0$\n", + "\n", + "$m_{4}g-k_{4}(x_{4}-x_{3})=0$\n", + "\n", + "in matrix form:\n", + "\n", + "$\\left[ \\begin{array}{cccc}\n", + "k_{1}+k_{2} & -k_{2} & 0 & 0 \\\\\n", + "-k_{2} & k_{2}+k_{3} & -k_{3} & 0 \\\\\n", + "0 & -k_{3} & k_{3}+k_{4} & -k_{4} \\\\\n", + "0 & 0 & -k_{4} & k_{4} \\end{array} \\right]\n", + "\\left[ \\begin{array}{c}\n", + "x_{1} \\\\\n", + "x_{2} \\\\\n", + "x_{3} \\\\\n", + "x_{4} \\end{array} \\right]=\n", + "\\left[ \\begin{array}{c}\n", + "m_{1}g \\\\\n", + "m_{2}g \\\\\n", + "m_{3}g \\\\\n", + "m_{4}g \\end{array} \\right]$" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "K =\n", + "\n", + " 100010 -100000 0 0\n", + " -100000 100010 -10 0\n", + " 0 -10 11 -1\n", + " 0 0 -1 1\n", + "\n", + "y =\n", + "\n", + " 9.8100\n", + " 19.6200\n", + " 29.4300\n", + " 39.2400\n", + "\n" + ] + } + ], + "source": [ + "k1=10; % N/m\n", + "k2=100000;\n", + "k3=10;\n", + "k4=1;\n", + "m1=1; % kg\n", + "m2=2;\n", + "m3=3;\n", + "m4=4;\n", + "g=9.81; % m/s^2\n", + "K=[k1+k2 -k2 0 0; -k2 k2+k3 -k3 0; 0 -k3 k3+k4 -k4; 0 0 -k4 k4]\n", + "y=[m1*g;m2*g;m3*g;m4*g]" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans = 3.2004e+05\n", + "ans = 3.2004e+05\n", + "ans = 2.5925e+05\n", + "ans = 2.5293e+05\n" + ] + } + ], + "source": [ + "cond(K,inf)\n", + "cond(K,1)\n", + "cond(K,'fro')\n", + "cond(K,2)" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "e =\n", + "\n", + " 7.9078e-01\n", + " 3.5881e+00\n", + " 1.7621e+01\n", + " 2.0001e+05\n", + "\n", + "ans = 2.5293e+05\n" + ] + } + ], + "source": [ + "e=eig(K)\n", + "max(e)/min(e)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Iterative Methods\n", + "\n", + "## Gauss-Seidel method\n", + "\n", + "If we have an intial guess for each value of a vector $x$ that we are trying to solve, then it is easy enough to solve for one component given the others. \n", + "\n", + "Take a 3$\\times$3 matrix \n", + "\n", + "$Ax=b$\n", + "\n", + "$\\left[ \\begin{array}{ccc}\n", + "3 & -0.1 & -0.2 \\\\\n", + "0.1 & 7 & -0.3 \\\\\n", + "0.3 & -0.2 & 10 \\end{array} \\right]\n", + "\\left[ \\begin{array}{c}\n", + "x_{1} \\\\\n", + "x_{2} \\\\\n", + "x_{3} \\end{array} \\right]=\n", + "\\left[ \\begin{array}{c}\n", + "7.85 \\\\\n", + "-19.3 \\\\\n", + "71.4\\end{array} \\right]$\n", + "\n", + "$x_{1}=\\frac{7.85+0.1x_{2}+0.3x_{3}}{3}$\n", + "\n", + "$x_{2}=\\frac{-19.3-0.1x_{1}+0.3x_{3}}{7}$\n", + "\n", + "$x_{3}=\\frac{71.4+0.1x_{1}+0.2x_{2}}{10}$" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 3.00000 -0.10000 -0.20000\n", + " 0.10000 7.00000 -0.30000\n", + " 0.30000 -0.20000 10.00000\n", + "\n", + "b =\n", + "\n", + " 7.8500\n", + " -19.3000\n", + " 71.4000\n", + "\n", + "x =\n", + "\n", + " 3.0000\n", + " -2.5000\n", + " 7.0000\n", + "\n" + ] + } + ], + "source": [ + "A=[3 -0.1 -0.2;0.1 7 -0.3;0.3 -0.2 10]\n", + "b=[7.85;-19.3;71.4]\n", + "\n", + "x=A\\b" + ] + }, + { + "cell_type": "markdown", + "metadata": { + "collapsed": true + }, + "source": [ + "### Gauss-Seidel Iterative approach\n", + "\n", + "As a first guess, we can use $x_{1}=x_{2}=x_{3}=0$\n", + "\n", + "$x_{1}=\\frac{7.85+0.1(0)+0.3(0)}{3}=2.6167$\n", + "\n", + "$x_{2}=\\frac{-19.3-0.1(2.6167)+0.3(0)}{7}=-2.7945$\n", + "\n", + "$x_{3}=\\frac{71.4+0.1(2.6167)+0.2(-2.7945)}{10}=7.0056$\n", + "\n", + "Then, we update the guess:\n", + "\n", + "$x_{1}=\\frac{7.85+0.1(-2.7945)+0.3(7.0056)}{3}=2.9906$\n", + "\n", + "$x_{2}=\\frac{-19.3-0.1(2.9906)+0.3(7.0056)}{7}=-2.4996$\n", + "\n", + "$x_{3}=\\frac{71.4+0.1(2.9906)+0.2(-2.4966)}{10}=7.00029$\n", + "\n", + "The results are conveerging to the solution we found with `\\` of $x_{1}=3,~x_{2}=-2.5,~x_{3}=7$\n", + "\n", + "We could also use an iterative method that solves for all of the x-components in one step:\n", + "\n", + "### Jacobi method\n", + "\n", + "$x_{1}^{i}=\\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$\n", + "\n", + "$x_{2}^{i}=\\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$\n", + "\n", + "$x_{3}^{i}=\\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$\n", + "\n", + "Here the solution is a matrix multiplication and vector addition\n", + "\n", + "$\\left[ \\begin{array}{c}\n", + "x_{1}^{i} \\\\\n", + "x_{2}^{i} \\\\\n", + "x_{3}^{i} \\end{array} \\right]=\n", + "\\left[ \\begin{array}{c}\n", + "7.85/3 \\\\\n", + "-19.3/7 \\\\\n", + "71.4/10\\end{array} \\right]-\n", + "\\left[ \\begin{array}{ccc}\n", + "0 & -0.1 & -0.2 \\\\\n", + "0.1 & 0 & -0.3 \\\\\n", + "0.3 & -0.2 & 0 \\end{array} \\right]\n", + "\\left[ \\begin{array}{c}\n", + "x_{1}^{i-1} \\\\\n", + "x_{2}^{i-1} \\\\\n", + "x_{3}^{i-1} \\end{array} \\right]$\n", + "\n", + "|x_{j}|Jacobi method |vs| Gauss-Seidel |\n", + "|--------|------------------------------|---|-------------------------------|\n", + "|$x_{1}^{i}=$ | $\\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ | | $\\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$|\n", + "|$x_{2}^{i}=$ | $\\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$ | | $\\frac{-19.3-0.1x_{1}^{i}+0.3x_{3}^{i-1}}{7}$ |\n", + "|$x_{3}^{i}=$ | $\\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$ | | $\\frac{71.4+0.1x_{1}^{i}+0.2x_{2}^{i}}{10}$|" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ba =\n", + "\n", + " 2.6167\n", + " -2.7571\n", + " 7.1400\n", + "\n", + "sA =\n", + "\n", + " 0.00000 -0.10000 -0.20000\n", + " 0.10000 0.00000 -0.30000\n", + " 0.30000 -0.20000 0.00000\n", + "\n", + "sA =\n", + "\n", + " 0.000000 -0.033333 -0.066667\n", + " 0.014286 0.000000 -0.042857\n", + " 0.030000 -0.020000 0.000000\n", + "\n", + "x1 =\n", + "\n", + " 2.6167\n", + " -2.7571\n", + " 7.1400\n", + "\n", + "x2 =\n", + "\n", + " 3.0008\n", + " -2.4885\n", + " 7.0064\n", + "\n", + "x3 =\n", + "\n", + " 3.0008\n", + " -2.4997\n", + " 7.0002\n", + "\n", + "solution is converging to [3,-2.5,7]]\n" + ] + } + ], + "source": [ + "ba=b./diag(A) % or ba=b./[A(1,1);A(2,2);A(3,3)]\n", + "sA=A-diag(diag(A)) % A with zeros on diagonal\n", + "sA(1,:)=sA(1,:)/A(1,1);\n", + "sA(2,:)=sA(2,:)/A(2,2);\n", + "sA(3,:)=sA(3,:)/A(3,3)\n", + "x0=[0;0;0];\n", + "x1=ba-sA*x0\n", + "x2=ba-sA*x1\n", + "x3=ba-sA*x2\n", + "fprintf('solution is converging to [3,-2.5,7]]\\n')" + ] + }, + { + "cell_type": "code", + "execution_count": 16, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans =\n", + "\n", + " 3\n", + " 7\n", + " 10\n", + "\n", + "ans =\n", + "\n", + "Diagonal Matrix\n", + "\n", + " 3 0 0\n", + " 0 7 0\n", + " 0 0 10\n", + "\n" + ] + } + ], + "source": [ + "diag(A)\n", + "diag(diag(A))" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This method works if problem is diagonally dominant, \n", + "\n", + "$|a_{ii}|>\\sum_{j=1,j\\ne i}^{n}|a_{ij}|$\n", + "\n", + "If this condition is true, then Jacobi or Gauss-Seidel should converge\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 0.10000 1.00000 3.00000\n", + " 1.00000 0.20000 3.00000\n", + " 5.00000 2.00000 0.30000\n", + "\n", + "b =\n", + "\n", + " 12\n", + " 2\n", + " 4\n", + "\n", + "ans =\n", + "\n", + " -2.9393\n", + " 9.1933\n", + " 1.0336\n", + "\n" + ] + } + ], + "source": [ + "A=[0.1,1,3;1,0.2,3;5,2,0.3]\n", + "b=[12;2;4]\n", + "A\\b" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ba =\n", + "\n", + " 120.000\n", + " 10.000\n", + " 13.333\n", + "\n", + "sA =\n", + "\n", + " 0 1 3\n", + " 1 0 3\n", + " 5 2 0\n", + "\n", + "sA =\n", + "\n", + " 0.00000 10.00000 30.00000\n", + " 5.00000 0.00000 15.00000\n", + " 16.66667 6.66667 0.00000\n", + "\n", + "x1 =\n", + "\n", + " 120.000\n", + " 10.000\n", + " 13.333\n", + "\n", + "x2 =\n", + "\n", + " -380.00\n", + " -790.00\n", + " -2053.33\n", + "\n", + "x3 =\n", + "\n", + " 6.9620e+04\n", + " 3.2710e+04\n", + " 1.1613e+04\n", + "\n", + "solution is not converging to [-2.93,9.19,1.03]\n" + ] + } + ], + "source": [ + "ba=b./diag(A) % or ba=b./[A(1,1);A(2,2);A(3,3)]\n", + "sA=A-diag(diag(A)) % A with zeros on diagonal\n", + "sA(1,:)=sA(1,:)/A(1,1);\n", + "sA(2,:)=sA(2,:)/A(2,2);\n", + "sA(3,:)=sA(3,:)/A(3,3)\n", + "x0=[0;0;0];\n", + "x1=ba-sA*x0\n", + "x2=ba-sA*x1\n", + "x3=ba-sA*x2\n", + "fprintf('solution is not converging to [-2.93,9.19,1.03]\\n')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Gauss-Seidel with Relaxation\n", + "\n", + "In order to force the solution to converge faster, we can introduce a relaxation term $\\lambda$. \n", + "\n", + "where the new x values are weighted between the old and new:\n", + "\n", + "$x^{i}=\\lambda x^{i}+(1-\\lambda)x^{i-1}$\n", + "\n", + "after solving for x, lambda weights the current approximation with the previous approximation for the updated x\n" + ] + }, + { + "cell_type": "code", + "execution_count": 105, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 3.00000 -0.10000 -0.20000\n", + " 0.10000 7.00000 -0.30000\n", + " 0.30000 -0.20000 10.00000\n", + "\n", + "b =\n", + "\n", + " 7.8500\n", + " -19.3000\n", + " 71.4000\n", + "\n" + ] + }, + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "Gnuplot\n", + "Produced by GNUPLOT 5.0 patchlevel 3 \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t10\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t20\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t30\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t40\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t50\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.5\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t1.5\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\tgnuplot_plot_1a\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "% rearrange A and b\n", + "A=[3 -0.1 -0.2;0.1 7 -0.3;0.3 -0.2 10]\n", + "b=[7.85;-19.3;71.4]\n", + "\n", + "iters=zeros(100,1);\n", + "for i=1:100\n", + " lambda=2/100*i;\n", + " [x,ea,iters(i)]=Jacobi_rel(A,b,lambda);\n", + "end\n", + "plot([1:100]*2/100,iters) " + ] + }, + { + "cell_type": "code", + "execution_count": 107, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "l = 0.99158\r\n" + ] + } + ], + "source": [ + "l=fminbnd(@(l) lambda_fcn(A,b,l),0.5,1.5)" + ] + }, + { + "cell_type": "code", + "execution_count": 108, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans =\n", + "\n", + " 3.0000\n", + " -2.5000\n", + " 7.0000\n", + "\n" + ] + } + ], + "source": [ + "A\\b" + ] + }, + { + "cell_type": "code", + "execution_count": 109, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x =\n", + "\n", + " 3.0000\n", + " -2.5000\n", + " 7.0000\n", + "\n", + "ea =\n", + "\n", + " 1.8289e-07\n", + " 2.1984e-08\n", + " 2.3864e-08\n", + "\n", + "iter = 8\n", + "x =\n", + "\n", + " 3.0000\n", + " -2.5000\n", + " 7.0000\n", + "\n", + "ea =\n", + "\n", + " 1.9130e-08\n", + " 7.6449e-08\n", + " 3.3378e-08\n", + "\n", + "iter = 8\n" + ] + } + ], + "source": [ + "[x,ea,iter]=Jacobi_rel(A,b,l,0.000001)\n", + "[x,ea,iter]=Jacobi_rel(A,b,1,0.000001)\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Nonlinear Systems\n", + "\n", + "Consider two simultaneous nonlinear equations with two unknowns:\n", + "\n", + "$x_{1}^{2}+x_{1}x_{2}=10$\n", + "\n", + "$x_{2}+3x_{1}x_{2}^{2}=57$\n", + "\n", + "Graphically, we are looking for the solution:\n" + ] + }, + { + "cell_type": "code", + "execution_count": 121, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "Gnuplot\n", + "Produced by GNUPLOT 5.0 patchlevel 3 \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t5\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t10\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t15\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t20\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t2\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t3\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t4\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t5\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\tgnuplot_plot_1a\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\tgnuplot_plot_2a\n", + "\n", + "\t\n", + "\t\n", + "\tgnuplot_plot_3a\n", + "\n", + "\t \n", + "\t\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "x11=linspace(0.5,3);\n", + "x12=(10-x11.^2)./x11;\n", + "\n", + "x22=linspace(2,8);\n", + "x21=(57-x22).*x22.^-2/3;\n", + "\n", + "plot(x11,x12,x21,x22)\n", + "% Solution at x_1=2, x_2=3\n", + "hold on;\n", + "plot(2,3,'o')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Newton-Raphson part II\n", + "\n", + "Remember the first order approximation for the next point in a function is:\n", + "\n", + "$f(x_{i+1})=f(x_{i})+(x_{i+1}-x_{i})f'(x_{i})$\n", + "\n", + "then, $f(x_{i+1})=0$ so we are left with:\n", + "\n", + "$x_{i+1}=x_{i}-\\frac{f(x_{i})}{f'(x_{i})}$\n", + "\n", + "We can use the same formula, but now we have multiple dimensions so we need to determine the Jacobian\n", + "\n", + "$[J]=\\left[ \\begin{array}{cccc}\n", + "\\frac{\\partial f_{1,i}}{\\partial x_{1}} & \\frac{\\partial f_{1,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{1,i}}{\\partial x_{n}} \\\\\n", + "\\frac{\\partial f_{2,i}}{\\partial x_{1}} & \\frac{\\partial f_{2,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{2,i}}{\\partial x_{n}} \\\\\n", + "\\vdots & \\vdots & & \\vdots \\\\\n", + "\\frac{\\partial f_{n,i}}{\\partial x_{1}} & \\frac{\\partial f_{n,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{n,i}}{\\partial x_{n}} \\\\\n", + "\\end{array} \\right]$\n", + "\n", + "$\\left[ \\begin{array}{c}\n", + "f_{1,i+1} \\\\\n", + "f_{2,i+1} \\\\\n", + "\\vdots \\\\\n", + "f_{n,i+1}\\end{array} \\right]=\n", + "\\left[ \\begin{array}{c}\n", + "f_{1,i} \\\\\n", + "f_{2,i} \\\\\n", + "\\vdots \\\\\n", + "f_{n,i}\\end{array} \\right]+\n", + "\\left[ \\begin{array}{cccc}\n", + "\\frac{\\partial f_{1,i}}{\\partial x_{1}} & \\frac{\\partial f_{1,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{1,i}}{\\partial x_{n}} \\\\\n", + "\\frac{\\partial f_{2,i}}{\\partial x_{1}} & \\frac{\\partial f_{2,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{2,i}}{\\partial x_{n}} \\\\\n", + "\\vdots & \\vdots & & \\vdots \\\\\n", + "\\frac{\\partial f_{n,i}}{\\partial x_{1}} & \\frac{\\partial f_{n,i}}{\\partial x_{2}} & \n", + "\\cdots & \\frac{\\partial f_{n,i}}{\\partial x_{n}} \\\\\n", + "\\end{array} \\right]\n", + "\\left( \\left[ \\begin{array}{c}\n", + "x_{i+1} \\\\\n", + "x_{i+1} \\\\\n", + "\\vdots \\\\\n", + "x_{i+1}\\end{array} \\right]-\n", + "\\left[ \\begin{array}{c}\n", + "f_{1,i} \\\\\n", + "f_{2,i} \\\\\n", + "\\vdots \\\\\n", + "f_{n,i}\\end{array} \\right]\\right)$\n", + "\n", + "### Solution is again in the form Ax=b\n", + "\n", + "$[J]([x_{i+1}]-[x_{i}])=-[f]$\n", + "\n", + "so\n", + "\n", + "$[x_{i+1}]= [x_{i}]-[J]^{-1}[f]$\n", + "\n", + "## Example of Jacobian calculation\n", + "\n", + "### Nonlinear springs supporting two masses in series\n", + "\n", + "Two springs are connected to two masses, with $m_1$=1 kg and $m_{2}$=2 kg. The springs are identical, but they have nonlinear spring constants, of $k_1$=10 N/m and $k_2$=-4 N/m\n", + "\n", + "We want to solve for the final position of the masses ($x_1$ and $x_2$)\n", + "\n", + "$m_{1}g+k_{1}(x_{2}-x_{1})+k_{2}(x_{2}-x_{1})^{2}+k_{1}x_{1}+k_{2}x_{1}^{2}=0$\n", + "\n", + "$m_{2}g-k_{1}(x_{2}-x_{1})-k_{2}(x_2-x_1)^{2}=0$\n", + "\n", + "$J(1,1)=\\frac{\\partial f_{1}}{\\partial x_{1}}=-k_{1}-2k_{2}(x_{2}-x_{1})+k_{1}+2k_{2}x_{1}$\n", + "\n", + "$J(1,2)=\\frac{\\partial f_1}{\\partial x_{2}}=k_{1}+2k_{2}(x_{2}-x_{1})$\n", + "\n", + "$J(2,1)=\\frac{\\partial f_2}{\\partial x_{1}}=k_{1}+2k_{2}(x_{2}-x_{1})$\n", + "\n", + "$J(2,2)=\\frac{\\partial f_2}{\\partial x_{2}}=-k_{1}-2k_{2}(x_{2}-x_{1})$\n", + "\n", + "Use an initial guess of $x_1=x_2=0$\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "m1=1; % kg \n", + "m2=2; % kg\n", + "k1=10; % N/m\n", + "k2=-4; % N/m^2" + ] + }, + { + "cell_type": "code", + "execution_count": 214, + "metadata": { + "collapsed": false + }, + "outputs": [], + "source": [ + "function [f,J]=mass_spring(x)\n", + " % Function to calculate function values f1 and f2 as well as Jacobian \n", + " % for 2 masses and 2 identical nonlinear springs\n", + " m1=1; % kg \n", + " m2=2; % kg\n", + " k1=100; % N/m\n", + " k2=-10; % N/m^2\n", + " g=9.81; % m/s^2\n", + " x1=x(1);\n", + " x2=x(2);\n", + " J=[-k1-2*k2*(x2-x1)-k1-2*k2*x1,k1+2*k2*(x2-x1);\n", + " k1+2*k2*(x2-x1),-k1-2*k2*(x2-x1)];\n", + " f=[m1*g+k1*(x2-x1)+k2*(x2-x1).^2-k1*x1-k2*x1^2;\n", + " m2*g-k1*(x2-x1)-k2*(x2-x1).^2];\n", + "end\n", + " " + ] + }, + { + "cell_type": "code", + "execution_count": 217, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "f =\n", + "\n", + " -190.19\n", + " 129.62\n", + "\n", + "J =\n", + "\n", + " -200 120\n", + " 120 -120\n", + "\n" + ] + } + ], + "source": [ + "[f,J]=mass_spring([1,0])" + ] + }, + { + "cell_type": "code", + "execution_count": 227, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x1 =\n", + "\n", + " -1.5142\n", + " -1.4341\n", + "\n", + "ea =\n", + "\n", + " 2.9812\n", + " 2.3946\n", + "\n", + "x2 =\n", + "\n", + " 0.049894\n", + " 0.248638\n", + "\n", + "ea =\n", + "\n", + " 31.3492\n", + " 6.7678\n", + "\n", + "x3 =\n", + "\n", + " 0.29701\n", + " 0.49722\n", + "\n", + "ea =\n", + "\n", + " 0.83201\n", + " 0.49995\n", + "\n", + "x =\n", + "\n", + " 0.29701\n", + " 0.49722\n", + "\n", + "ea =\n", + "\n", + " 0.021392\n", + " 0.012890\n", + "\n", + "ea =\n", + "\n", + " 1.4786e-05\n", + " 8.9091e-06\n", + "\n", + "ea =\n", + "\n", + " 7.0642e-12\n", + " 4.2565e-12\n", + "\n" + ] + } + ], + "source": [ + "x0=[3;2];\n", + "[f0,J0]=mass_spring(x0);\n", + "x1=x0-J0\\f0\n", + "ea=(x1-x0)./x1\n", + "[f1,J1]=mass_spring(x1);\n", + "x2=x1-J1\\f1\n", + "ea=(x2-x1)./x2\n", + "[f2,J2]=mass_spring(x2);\n", + "x3=x2-J2\\f2\n", + "ea=(x3-x2)./x3\n", + "x=x3\n", + "for i=1:3\n", + " xold=x;\n", + " [f,J]=mass_spring(x);\n", + " x=x-J\\f;\n", + " ea=(x-xold)./x\n", + "end" + ] + }, + { + "cell_type": "code", + "execution_count": 228, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x =\n", + "\n", + " 0.30351\n", + " 0.50372\n", + "\n", + "X0 =\n", + "\n", + " 0.30351\n", + " 0.50372\n", + "\n" + ] + } + ], + "source": [ + "x\n", + "X0=fsolve(@(x) mass_spring(x),[3;5])" + ] + }, + { + "cell_type": "code", + "execution_count": 236, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "Gnuplot\n", + "Produced by GNUPLOT 5.0 patchlevel 3 \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\tgnuplot_plot_1a\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.4\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.6\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.8\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.4\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.6\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.8\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\tx2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\tgnuplot_plot_1b\n", + "\n", + "\n", + "\n", + ";\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "\t\t\n", + "\t\t-150\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t-100\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t-50\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t50\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t100\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + }, + { + "data": { + "image/svg+xml": [ + "\n", + "\n", + "Gnuplot\n", + "Produced by GNUPLOT 5.0 patchlevel 3 \n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\t\n", + "\t \n", + "\t \n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\tgnuplot_plot_1a\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.4\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.6\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.8\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.4\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.6\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t0.8\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\t\t\n", + "\t\t1\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\tx2\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\tgnuplot_plot_1b\n", + "\n", + "\n", + "\n", + ";\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "\t\t\n", + "\t\t-150\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t-100\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t-50\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t50\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t100\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "[X,Y]=meshgrid(linspace(0,1,20),linspace(0,1,20));\n", + "[N,M]=size(X);\n", + "F=zeros(size(X));\n", + "for i=1:N\n", + " for j=1:M\n", + " [f,~]=mass_spring([X(i,j),Y(i,j)]);\n", + " F(i,j)=f(1);\n", + " end\n", + "end\n", + "pcolor(X,Y,F)\n", + "xlabel('x_1')\n", + "ylabel('x_2')\n", + "colorbar()\n", + "figure()\n", + "pcolor(X,Y,F)\n", + "xlabel('x_1')\n", + "ylabel('x_2')\n", + "colorbar()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Octave", + "language": "octave", + "name": "octave" + }, + "language_info": { + "file_extension": ".m", + "help_links": [ + { + "text": "MetaKernel Magics", + "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md" + } + ], + "mimetype": "text/x-octave", + "name": "octave", + "version": "0.19.14" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/lecture_13/lecture_13.log b/lecture_13/lecture_13.log new file mode 100644 index 0000000..bb369ae --- /dev/null +++ b/lecture_13/lecture_13.log @@ -0,0 +1,889 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.1.11) 2 MAR 2017 09:22 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**lecture_13.tex +(./lecture_13.tex +LaTeX2e <2016/02/01> +Babel <3.9q> and hyphenation patterns for 81 language(s) loaded. +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2014/09/29 v1.4h Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo +File: size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option) +) +\c@part=\count79 +\c@section=\count80 +\c@subsection=\count81 +\c@subsubsection=\count82 +\c@paragraph=\count83 +\c@subparagraph=\count84 +\c@figure=\count85 +\c@table=\count86 +\abovecaptionskip=\skip41 +\belowcaptionskip=\skip42 +\bibindent=\dimen102 +) +(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty +Package: fontenc 2005/09/27 v1.99g Standard LaTeX package + +(/usr/share/texlive/texmf-dist/tex/latex/base/t1enc.def +File: t1enc.def 2005/09/27 v1.99g Standard LaTeX file +LaTeX Font Info: Redeclaring font encoding T1 on input line 48. +)) +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/mathpazo.sty +Package: mathpazo 2005/04/12 PSNFSS-v9.2a Palatino w/ Pazo Math (D.Puga, WaS) +\symupright=\mathgroup4 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty +Package: graphicx 2014/10/28 v1.0g Enhanced LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2014/10/28 v1.15 key=value parser (DPC) +\KV@toks@=\toks14 +) +(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty +Package: graphics 2016/01/03 v1.0q Standard LaTeX Graphics (DPC,SPQR) + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty +Package: trig 2016/01/03 v1.10 sin cos tan (DPC) +) +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/graphics.cfg +File: graphics.cfg 2010/04/23 v1.9 graphics configuration of TeX Live +) +Package graphics Info: Driver file: pdftex.def on input line 95. + +(/usr/share/texlive/texmf-dist/tex/latex/pdftex-def/pdftex.def +File: pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/infwarerr.sty +Package: infwarerr 2010/04/08 v1.3 Providing info/warning/error messages (HO) +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ltxcmds.sty +Package: ltxcmds 2011/11/09 v1.22 LaTeX kernel commands for general use (HO) +) +\Gread@gobject=\count87 +)) +\Gin@req@height=\dimen103 +\Gin@req@width=\dimen104 +) +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption.sty +Package: caption 2016/02/21 v3.3-144 Customizing captions (AR) + +(/usr/share/texlive/texmf-dist/tex/latex/caption/caption3.sty +Package: caption3 2016/02/04 v1.7-139 caption3 kernel (AR) +Package caption3 Info: TeX engine: e-TeX on input line 67. +\captionmargin=\dimen105 +\captionmargin@=\dimen106 +\captionwidth=\dimen107 +\caption@tempdima=\dimen108 +\caption@indent=\dimen109 +\caption@parindent=\dimen110 +\caption@hangindent=\dimen111 +) +\c@ContinuedFloat=\count88 +) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjustbox.sty +Package: adjustbox 2012/05/21 v1.0 Adjusting TeX boxes (trim, clip, ...) + +(/usr/share/texlive/texmf-dist/tex/latex/xkeyval/xkeyval.sty +Package: xkeyval 2014/12/03 v2.7a package option processing (HA) + +(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkeyval.tex +(/usr/share/texlive/texmf-dist/tex/generic/xkeyval/xkvutils.tex +\XKV@toks=\toks15 +\XKV@tempa@toks=\toks16 +) +\XKV@depth=\count89 +File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA) +)) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/adjcalc.sty +Package: adjcalc 2012/05/16 v1.1 Provides advanced setlength with multiple back +-ends (calc, etex, pgfmath) +) +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/trimclip.sty +Package: trimclip 2012/05/16 v1.0 Trim and clip general TeX material + +(/usr/share/texlive/texmf-dist/tex/latex/collectbox/collectbox.sty +Package: collectbox 2012/05/17 v0.4b Collect macro arguments as boxes +\collectedbox=\box26 +) +\tc@llx=\dimen112 +\tc@lly=\dimen113 +\tc@urx=\dimen114 +\tc@ury=\dimen115 +Package trimclip Info: Using driver 'tc-pdftex.def'. + +(/usr/share/texlive/texmf-dist/tex/latex/adjustbox/tc-pdftex.def +File: tc-pdftex.def 2012/05/13 v1.0 Clipping driver for pdftex +)) +\adjbox@Width=\dimen116 +\adjbox@Height=\dimen117 +\adjbox@Depth=\dimen118 +\adjbox@Totalheight=\dimen119 + +(/usr/share/texlive/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty +Package: ifoddpage 2011/09/13 v1.0 Conditionals for odd/even page detection +\c@checkoddpage=\count90 +) +(/usr/share/texlive/texmf-dist/tex/latex/varwidth/varwidth.sty +Package: varwidth 2009/03/30 ver 0.92; Variable-width minipages +\@vwid@box=\box27 +\sift@deathcycles=\count91 +\@vwid@loff=\dimen120 +\@vwid@roff=\dimen121 +)) +(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty +Package: xcolor 2007/01/21 v2.11 LaTeX color extensions (UK) + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/color.cfg +File: color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive +) +Package xcolor Info: Driver file: pdftex.def on input line 225. +Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1337. +Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1341. +Package xcolor Info: Model `RGB' extended on input line 1353. +Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1355. +Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1356. +Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1357. +Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1358. +Package xcolor Info: Model `Gray' substituted by `gray' on input line 1359. +Package xcolor Info: Model `wave' substituted by `hsb' on input line 1360. +) +(/usr/share/texlive/texmf-dist/tex/latex/tools/enumerate.sty +Package: enumerate 2015/07/23 v3.00 enumerate extensions (DPC) +\@enLab=\toks17 +) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2010/09/12 v5.6 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifpdf.sty +Package: ifpdf 2011/01/30 v2.3 Provides the ifpdf switch (HO) +Package ifpdf Info: pdfTeX in PDF mode is detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifvtex.sty +Package: ifvtex 2010/03/01 v1.5 Detect VTeX and its facilities (HO) +Package ifvtex Info: VTeX not detected. +) +(/usr/share/texlive/texmf-dist/tex/generic/ifxetex/ifxetex.sty +Package: ifxetex 2010/09/12 v0.6 Provides ifxetex conditional +) +\Gm@cnth=\count92 +\Gm@cntv=\count93 +\c@Gm@tempcnt=\count94 +\Gm@bindingoffset=\dimen122 +\Gm@wd@mp=\dimen123 +\Gm@odd@mp=\dimen124 +\Gm@even@mp=\dimen125 +\Gm@layoutwidth=\dimen126 +\Gm@layoutheight=\dimen127 +\Gm@layouthoffset=\dimen128 +\Gm@layoutvoffset=\dimen129 +\Gm@dimlist=\toks18 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2016/03/03 v2.15a AMS math features +\@mathmargin=\skip43 + +For additional information on amsmath, use the `?' option. +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2000/06/29 v2.01 AMS text + +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks19 +\ex@=\dimen130 +)) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen131 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 1999/12/14 v2.01 operator names +) +\inf@bad=\count95 +LaTeX Info: Redefining \frac on input line 199. +\uproot@=\count96 +\leftroot@=\count97 +LaTeX Info: Redefining \overline on input line 297. +\classnum@=\count98 +\DOTSCASE@=\count99 +LaTeX Info: Redefining \ldots on input line 394. +LaTeX Info: Redefining \dots on input line 397. +LaTeX Info: Redefining \cdots on input line 518. +\Mathstrutbox@=\box28 +\strutbox@=\box29 +\big@size=\dimen132 +LaTeX Font Info: Redeclaring font encoding OML on input line 630. +LaTeX Font Info: Redeclaring font encoding OMS on input line 631. +\macc@depth=\count100 +\c@MaxMatrixCols=\count101 +\dotsspace@=\muskip10 +\c@parentequation=\count102 +\dspbrk@lvl=\count103 +\tag@help=\toks20 +\row@=\count104 +\column@=\count105 +\maxfields@=\count106 +\andhelp@=\toks21 +\eqnshift@=\dimen133 +\alignsep@=\dimen134 +\tagshift@=\dimen135 +\tagwidth@=\dimen136 +\totwidth@=\dimen137 +\lineht@=\dimen138 +\@envbody=\toks22 +\multlinegap=\skip44 +\multlinetaggap=\skip45 +\mathdisplay@stack=\toks23 +LaTeX Info: Redefining \[ on input line 2735. +LaTeX Info: Redefining \] on input line 2736. +) +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2013/01/14 v3.01 AMS font symbols + +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support +\symAMSa=\mathgroup5 +\symAMSb=\mathgroup6 +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 106. +)) +(/usr/share/texlive/texmf-dist/tex/latex/base/textcomp.sty +Package: textcomp 2005/09/27 v1.99g Standard LaTeX package +Package textcomp Info: Sub-encoding information: +(textcomp) 5 = only ISO-Adobe without \textcurrency +(textcomp) 4 = 5 + \texteuro +(textcomp) 3 = 4 + \textohm +(textcomp) 2 = 3 + \textestimated + \textcurrency +(textcomp) 1 = TS1 - \textcircled - \t +(textcomp) 0 = TS1 (full) +(textcomp) Font families with sub-encoding setting implement +(textcomp) only a restricted character set as indicated. +(textcomp) Family '?' is the default used for unknown fonts. +(textcomp) See the documentation for details. +Package textcomp Info: Setting ? sub-encoding to TS1/1 on input line 79. + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1enc.def +File: ts1enc.def 2001/06/05 v3.0e (jk/car/fm) Standard LaTeX file +) +LaTeX Info: Redefining \oldstylenums on input line 334. +Package textcomp Info: Setting cmr sub-encoding to TS1/0 on input line 349. +Package textcomp Info: Setting cmss sub-encoding to TS1/0 on input line 350. +Package textcomp Info: Setting cmtt sub-encoding to TS1/0 on input line 351. +Package textcomp Info: Setting cmvtt sub-encoding to TS1/0 on input line 352. +Package textcomp Info: Setting cmbr sub-encoding to TS1/0 on input line 353. +Package textcomp Info: Setting cmtl sub-encoding to TS1/0 on input line 354. +Package textcomp Info: Setting ccr sub-encoding to TS1/0 on input line 355. +Package textcomp Info: Setting ptm sub-encoding to TS1/4 on input line 356. +Package textcomp Info: Setting pcr sub-encoding to TS1/4 on input line 357. +Package textcomp Info: Setting phv sub-encoding to TS1/4 on input line 358. +Package textcomp Info: Setting ppl sub-encoding to TS1/3 on input line 359. +Package textcomp Info: Setting pag sub-encoding to TS1/4 on input line 360. +Package textcomp Info: Setting pbk sub-encoding to TS1/4 on input line 361. +Package textcomp Info: Setting pnc sub-encoding to TS1/4 on input line 362. +Package textcomp Info: Setting pzc sub-encoding to TS1/4 on input line 363. +Package textcomp Info: Setting bch sub-encoding to TS1/4 on input line 364. +Package textcomp Info: Setting put sub-encoding to TS1/5 on input line 365. +Package textcomp Info: Setting uag sub-encoding to TS1/5 on input line 366. +Package textcomp Info: Setting ugq sub-encoding to TS1/5 on input line 367. +Package textcomp Info: Setting ul8 sub-encoding to TS1/4 on input line 368. +Package textcomp Info: Setting ul9 sub-encoding to TS1/4 on input line 369. +Package textcomp Info: Setting augie sub-encoding to TS1/5 on input line 370. +Package textcomp Info: Setting dayrom sub-encoding to TS1/3 on input line 371. +Package textcomp Info: Setting dayroms sub-encoding to TS1/3 on input line 372. + +Package textcomp Info: Setting pxr sub-encoding to TS1/0 on input line 373. +Package textcomp Info: Setting pxss sub-encoding to TS1/0 on input line 374. +Package textcomp Info: Setting pxtt sub-encoding to TS1/0 on input line 375. +Package textcomp Info: Setting txr sub-encoding to TS1/0 on input line 376. +Package textcomp Info: Setting txss sub-encoding to TS1/0 on input line 377. +Package textcomp Info: Setting txtt sub-encoding to TS1/0 on input line 378. +Package textcomp Info: Setting lmr sub-encoding to TS1/0 on input line 379. +Package textcomp Info: Setting lmdh sub-encoding to TS1/0 on input line 380. +Package textcomp Info: Setting lmss sub-encoding to TS1/0 on input line 381. +Package textcomp Info: Setting lmssq sub-encoding to TS1/0 on input line 382. +Package textcomp Info: Setting lmvtt sub-encoding to TS1/0 on input line 383. +Package textcomp Info: Setting lmtt sub-encoding to TS1/0 on input line 384. +Package textcomp Info: Setting qhv sub-encoding to TS1/0 on input line 385. +Package textcomp Info: Setting qag sub-encoding to TS1/0 on input line 386. +Package textcomp Info: Setting qbk sub-encoding to TS1/0 on input line 387. +Package textcomp Info: Setting qcr sub-encoding to TS1/0 on input line 388. +Package textcomp Info: Setting qcs sub-encoding to TS1/0 on input line 389. +Package textcomp Info: Setting qpl sub-encoding to TS1/0 on input line 390. +Package textcomp Info: Setting qtm sub-encoding to TS1/0 on input line 391. +Package textcomp Info: Setting qzc sub-encoding to TS1/0 on input line 392. +Package textcomp Info: Setting qhvc sub-encoding to TS1/0 on input line 393. +Package textcomp Info: Setting futs sub-encoding to TS1/4 on input line 394. +Package textcomp Info: Setting futx sub-encoding to TS1/4 on input line 395. +Package textcomp Info: Setting futj sub-encoding to TS1/4 on input line 396. +Package textcomp Info: Setting hlh sub-encoding to TS1/3 on input line 397. +Package textcomp Info: Setting hls sub-encoding to TS1/3 on input line 398. +Package textcomp Info: Setting hlst sub-encoding to TS1/3 on input line 399. +Package textcomp Info: Setting hlct sub-encoding to TS1/5 on input line 400. +Package textcomp Info: Setting hlx sub-encoding to TS1/5 on input line 401. +Package textcomp Info: Setting hlce sub-encoding to TS1/5 on input line 402. +Package textcomp Info: Setting hlcn sub-encoding to TS1/5 on input line 403. +Package textcomp Info: Setting hlcw sub-encoding to TS1/5 on input line 404. +Package textcomp Info: Setting hlcf sub-encoding to TS1/5 on input line 405. +Package textcomp Info: Setting pplx sub-encoding to TS1/3 on input line 406. +Package textcomp Info: Setting pplj sub-encoding to TS1/3 on input line 407. +Package textcomp Info: Setting ptmx sub-encoding to TS1/4 on input line 408. +Package textcomp Info: Setting ptmj sub-encoding to TS1/4 on input line 409. +) +(/usr/share/texlive/texmf-dist/tex/latex/upquote/upquote.sty +Package: upquote 2012/04/19 v1.3 upright-quote and grave-accent glyphs in verba +tim +) +(/usr/share/texlive/texmf-dist/tex/latex/eurosym/eurosym.sty +Package: eurosym 1998/08/06 v1.1 European currency symbol ``Euro'' +\@eurobox=\box30 +) +(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucs.sty +Package: ucs 2013/05/11 v2.2 UCS: Unicode input support + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/data/uni-global.def +File: uni-global.def 2013/05/13 UCS: Unicode global data +) +\uc@secondtry=\count107 +\uc@combtoks=\toks24 +\uc@combtoksb=\toks25 +\uc@temptokena=\toks26 +) +(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty +Package: inputenc 2015/03/17 v1.2c Input encoding file +\inpenc@prehook=\toks27 +\inpenc@posthook=\toks28 + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/utf8x.def +File: utf8x.def 2004/10/17 UCS: Input encoding UTF-8 +)) +(/usr/share/texlive/texmf-dist/tex/latex/fancyvrb/fancyvrb.sty +Package: fancyvrb 2008/02/07 + +Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix +<2008/02/07> (tvz) +\FV@CodeLineNo=\count108 +\FV@InFile=\read1 +\FV@TabBox=\box31 +\c@FancyVerbLine=\count109 +\FV@StepNumber=\count110 +\FV@OutFile=\write3 +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grffile.sty +Package: grffile 2012/04/05 v1.16 Extended file name support for graphics (HO) + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/kvoptions.sty +Package: kvoptions 2011/06/30 v3.11 Key value format for package options (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/kvsetkeys.sty +Package: kvsetkeys 2012/04/25 v1.16 Key value parser (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/etexcmds.sty +Package: etexcmds 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO) + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/ifluatex.sty +Package: ifluatex 2010/03/01 v1.3 Provides the ifluatex switch (HO) +Package ifluatex Info: LuaTeX not detected. +) +Package etexcmds Info: Could not find \expanded. +(etexcmds) That can mean that you are not using pdfTeX 1.50 or +(etexcmds) that some package has redefined \expanded. +(etexcmds) In the latter case, load this package earlier. +))) +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/pdftexcmds.sty +Package: pdftexcmds 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO +) +Package pdftexcmds Info: LuaTeX not detected. +Package pdftexcmds Info: \pdf@primitive is available. +Package pdftexcmds Info: \pdf@ifprimitive is available. +Package pdftexcmds Info: \pdfdraftmode found. +) +Package grffile Info: Option `multidot' is set to `true'. +Package grffile Info: Option `extendedchars' is set to `false'. +Package grffile Info: Option `space' is set to `true'. +Package grffile Info: \Gin@ii of package `graphicx' fixed on input line 486. +) +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hyperref.sty +Package: hyperref 2012/11/06 v6.83m Hypertext links for LaTeX + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-hyperref.sty +Package: hobsub-hyperref 2012/05/28 v1.13 Bundle oberdiek, subset hyperref (HO) + + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/hobsub-generic.sty +Package: hobsub-generic 2012/05/28 v1.13 Bundle oberdiek, subset generic (HO) +Package: hobsub 2012/05/28 v1.13 Construct package bundles (HO) +Package hobsub Info: Skipping package `infwarerr' (already loaded). +Package hobsub Info: Skipping package `ltxcmds' (already loaded). +Package hobsub Info: Skipping package `ifluatex' (already loaded). +Package hobsub Info: Skipping package `ifvtex' (already loaded). +Package: intcalc 2007/09/27 v1.1 Expandable calculations with integers (HO) +Package hobsub Info: Skipping package `ifpdf' (already loaded). +Package hobsub Info: Skipping package `etexcmds' (already loaded). +Package hobsub Info: Skipping package `kvsetkeys' (already loaded). +Package: kvdefinekeys 2011/04/07 v1.3 Define keys (HO) +Package hobsub Info: Skipping package `pdftexcmds' (already loaded). +Package: pdfescape 2011/11/25 v1.13 Implements pdfTeX's escape features (HO) +Package: bigintcalc 2012/04/08 v1.3 Expandable calculations on big integers (HO +) +Package: bitset 2011/01/30 v1.1 Handle bit-vector datatype (HO) +Package: uniquecounter 2011/01/30 v1.2 Provide unlimited unique counter (HO) +) +Package hobsub Info: Skipping package `hobsub' (already loaded). +Package: letltxmacro 2010/09/02 v1.4 Let assignment for LaTeX macros (HO) +Package: hopatch 2012/05/28 v1.2 Wrapper for package hooks (HO) +Package: xcolor-patch 2011/01/30 xcolor patch +Package: atveryend 2011/06/30 v1.8 Hooks at the very end of document (HO) +Package atveryend Info: \enddocument detected (standard20110627). +Package: atbegshi 2011/10/05 v1.16 At begin shipout hook (HO) +Package: refcount 2011/10/16 v3.4 Data extraction from label references (HO) +Package: hycolor 2011/01/30 v1.7 Color options for hyperref/bookmark (HO) +) +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/auxhook.sty +Package: auxhook 2011/03/04 v1.3 Hooks for auxiliary files (HO) +) +\@linkdim=\dimen139 +\Hy@linkcounter=\count111 +\Hy@pagecounter=\count112 + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/pd1enc.def +File: pd1enc.def 2012/11/06 v6.83m Hyperref: PDFDocEncoding definition (HO) +) +\Hy@SavedSpaceFactor=\count113 + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/hyperref.cfg +File: hyperref.cfg 2002/06/06 v1.2 hyperref configuration of TeXLive +) +Package hyperref Info: Hyper figures OFF on input line 4443. +Package hyperref Info: Link nesting OFF on input line 4448. +Package hyperref Info: Hyper index ON on input line 4451. +Package hyperref Info: Plain pages OFF on input line 4458. +Package hyperref Info: Backreferencing OFF on input line 4463. +Package hyperref Info: Implicit mode ON; LaTeX internals redefined. +Package hyperref Info: Bookmarks ON on input line 4688. +\c@Hy@tempcnt=\count114 + +(/usr/share/texlive/texmf-dist/tex/latex/url/url.sty +\Urlmuskip=\muskip11 +Package: url 2013/09/16 ver 3.4 Verb mode for urls, etc. +) +LaTeX Info: Redefining \url on input line 5041. +\XeTeXLinkMargin=\dimen140 +\Fld@menulength=\count115 +\Field@Width=\dimen141 +\Fld@charsize=\dimen142 +Package hyperref Info: Hyper figures OFF on input line 6295. +Package hyperref Info: Link nesting OFF on input line 6300. +Package hyperref Info: Hyper index ON on input line 6303. +Package hyperref Info: backreferencing OFF on input line 6310. +Package hyperref Info: Link coloring OFF on input line 6315. +Package hyperref Info: Link coloring with OCG OFF on input line 6320. +Package hyperref Info: PDF/A mode OFF on input line 6325. +LaTeX Info: Redefining \ref on input line 6365. +LaTeX Info: Redefining \pageref on input line 6369. +\Hy@abspage=\count116 +\c@Item=\count117 +\c@Hfootnote=\count118 +) + +Package hyperref Message: Driver (autodetected): hpdftex. + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/hpdftex.def +File: hpdftex.def 2012/11/06 v6.83m Hyperref driver for pdfTeX +\Fld@listcount=\count119 +\c@bookmark@seq@number=\count120 + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/rerunfilecheck.sty +Package: rerunfilecheck 2011/04/15 v1.7 Rerun checks for auxiliary files (HO) +Package uniquecounter Info: New unique counter `rerunfilecheck' on input line 2 +82. +) +\Hy@SectionHShift=\skip46 +) +(/usr/share/texlive/texmf-dist/tex/latex/tools/longtable.sty +Package: longtable 2014/10/28 v4.11 Multi-page Table package (DPC) +\LTleft=\skip47 +\LTright=\skip48 +\LTpre=\skip49 +\LTpost=\skip50 +\LTchunksize=\count121 +\LTcapwidth=\dimen143 +\LT@head=\box32 +\LT@firsthead=\box33 +\LT@foot=\box34 +\LT@lastfoot=\box35 +\LT@cols=\count122 +\LT@rows=\count123 +\c@LT@tables=\count124 +\c@LT@chunks=\count125 +\LT@p@ftn=\toks29 +) +(/usr/share/texlive/texmf-dist/tex/latex/booktabs/booktabs.sty +Package: booktabs 2005/04/14 v1.61803 publication quality tables +\heavyrulewidth=\dimen144 +\lightrulewidth=\dimen145 +\cmidrulewidth=\dimen146 +\belowrulesep=\dimen147 +\belowbottomsep=\dimen148 +\aboverulesep=\dimen149 +\abovetopsep=\dimen150 +\cmidrulesep=\dimen151 +\cmidrulekern=\dimen152 +\defaultaddspace=\dimen153 +\@cmidla=\count126 +\@cmidlb=\count127 +\@aboverulesep=\dimen154 +\@belowrulesep=\dimen155 +\@thisruleclass=\count128 +\@lastruleclass=\count129 +\@thisrulewidth=\dimen156 +) +(/usr/share/texlive/texmf-dist/tex/latex/enumitem/enumitem.sty +Package: enumitem 2011/09/28 v3.5.2 Customized lists +\labelindent=\skip51 +\enit@outerparindent=\dimen157 +\enit@toks=\toks30 +\enit@inbox=\box36 +\enitdp@description=\count130 +) +(/usr/share/texlive/texmf-dist/tex/generic/ulem/ulem.sty +\UL@box=\box37 +\UL@hyphenbox=\box38 +\UL@skip=\skip52 +\UL@hook=\toks31 +\UL@height=\dimen158 +\UL@pe=\count131 +\UL@pixel=\dimen159 +\ULC@box=\box39 +Package: ulem 2012/05/18 +\ULdepth=\dimen160 +) +Package hyperref Info: Option `breaklinks' set `true' on input line 264. +Package hyperref Info: Option `colorlinks' set `true' on input line 264. + (./lecture_13.aux) +\openout1 = `lecture_13.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 271. +LaTeX Font Info: Try loading font information for TS1+cmr on input line 271. + + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmr.fd +File: ts1cmr.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Checking defaults for PD1/pdf/m/n on input line 271. +LaTeX Font Info: ... okay on input line 271. +LaTeX Font Info: Try loading font information for T1+ppl on input line 271. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/t1ppl.fd +File: t1ppl.fd 2001/06/04 font definitions for T1/ppl. +) +(/usr/share/texlive/texmf-dist/tex/context/base/supp-pdf.mkii +[Loading MPS to PDF converter (version 2006.09.02).] +\scratchcounter=\count132 +\scratchdimen=\dimen161 +\scratchbox=\box40 +\nofMPsegments=\count133 +\nofMParguments=\count134 +\everyMPshowfont=\toks32 +\MPscratchCnt=\count135 +\MPscratchDim=\dimen162 +\MPnumerator=\count136 +\makeMPintoPDFobject=\count137 +\everyMPtoPDFconversion=\toks33 +) (/usr/share/texlive/texmf-dist/tex/latex/oberdiek/epstopdf-base.sty +Package: epstopdf-base 2010/02/09 v2.5 Base part for package epstopdf + +(/usr/share/texlive/texmf-dist/tex/latex/oberdiek/grfext.sty +Package: grfext 2010/08/19 v1.1 Manage graphics extensions (HO) +) +Package grfext Info: Graphics extension search list: +(grfext) [.png,.pdf,.jpg,.mps,.jpeg,.jbig2,.jb2,.PNG,.PDF,.JPG,.JPE +G,.JBIG2,.JB2,.eps] +(grfext) \AppendGraphicsExtensions on input line 452. + +(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg +File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv +e +)) +Package caption Info: Begin \AtBeginDocument code. +Package caption Info: hyperref package is loaded. +Package caption Info: longtable package is loaded. + +(/usr/share/texlive/texmf-dist/tex/latex/caption/ltcaption.sty +Package: ltcaption 2013/06/09 v1.4-94 longtable captions (AR) +) +Package caption Info: End \AtBeginDocument code. + +*geometry* driver: auto-detecting +*geometry* detected driver: pdftex +*geometry* verbose mode - [ preamble ] result: +* driver: pdftex +* paper: +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(72.26999pt, 469.75502pt, 72.26999pt) +* v-part:(T,H,B)=(72.26999pt, 650.43001pt, 72.26999pt) +* \paperwidth=614.295pt +* \paperheight=794.96999pt +* \textwidth=469.75502pt +* \textheight=650.43001pt +* \oddsidemargin=0.0pt +* \evensidemargin=0.0pt +* \topmargin=-37.0pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=11.0pt +* \footskip=30.0pt +* \marginparwidth=59.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.0pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +(/usr/share/texlive/texmf-dist/tex/latex/ucs/ucsencs.def +File: ucsencs.def 2011/01/21 Fixes to fontencodings LGR, T3 +) +\AtBeginShipoutBox=\box41 +Package hyperref Info: Link coloring ON on input line 271. + +(/usr/share/texlive/texmf-dist/tex/latex/hyperref/nameref.sty +Package: nameref 2012/10/27 v2.43 Cross-referencing by name of section + +(/usr/share/texlive/texmf-dist/tex/generic/oberdiek/gettitlestring.sty +Package: gettitlestring 2010/12/03 v1.4 Cleanup title references (HO) +) +\c@section@level=\count138 +) +LaTeX Info: Redefining \ref on input line 271. +LaTeX Info: Redefining \pageref on input line 271. +LaTeX Info: Redefining \nameref on input line 271. + +(./lecture_13.out) (./lecture_13.out) +\@outlinefile=\write4 +\openout4 = `lecture_13.out'. + +LaTeX Font Info: Try loading font information for OT1+ppl on input line 275. + + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1ppl.fd +File: ot1ppl.fd 2001/06/04 font definitions for OT1/ppl. +) +LaTeX Font Info: Try loading font information for OML+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omlzplm.fd +File: omlzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OML/zplm. +) +LaTeX Font Info: Try loading font information for OMS+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omszplm.fd +File: omszplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMS/zplm. +) +LaTeX Font Info: Try loading font information for OMX+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/omxzplm.fd +File: omxzplm.fd 2002/09/08 Fontinst v1.914 font definitions for OMX/zplm. +) +LaTeX Font Info: Try loading font information for OT1+zplm on input line 275 +. + +(/usr/share/texlive/texmf-dist/tex/latex/psnfss/ot1zplm.fd +File: ot1zplm.fd 2002/09/08 Fontinst v1.914 font definitions for OT1/zplm. +) +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 12.50409pt on input line 275. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 9.37807pt on input line 275. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 7.29405pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 12.50409pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 9.37807pt on input line 275. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 7.29405pt on input line 275. + + +LaTeX Warning: No \author given. + +LaTeX Font Info: Try loading font information for T1+cmtt on input line 279. + +(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd +File: t1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <12> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 288. + + +File: efficient_soln.png Graphic file (type png) + +Package pdftex.def Info: efficient_soln.png used on input line 292. +(pdftex.def) Requested size: 375.80544pt x 201.02519pt. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 11.40997pt on input line 296. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 8.33606pt on input line 296. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 6.25204pt on input line 296. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 11.40997pt on input line 296. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 8.33606pt on input line 296. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 6.25204pt on input line 296. + + +File: norm_A.png Graphic file (type png) + +Package pdftex.def Info: norm_A.png used on input line 303. +(pdftex.def) Requested size: 375.80544pt x 177.55602pt. + [1 + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map} <./efficient_soln.png>] +Underfull \hbox (badness 10000) in paragraph at lines 341--343 +[]\T1/ppl/m/n/10.95 -[][]Installing Python and Jupyter Note-book (via Ana-conda +) - + [] + + +Underfull \hbox (badness 1681) in paragraph at lines 344--347 +[]\T1/ppl/m/n/10.95 -[][]Running Mat-lab ker-nel in Jupyter - https://anneurai. +net/2015/11/12/matlab-based- + [] + +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <10.95> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 356. +LaTeX Font Info: Font shape `T1/ppl/bx/it' in size <10.95> not available +(Font) Font shape `T1/ppl/b/it' tried instead on input line 356. +[2 <./norm_A.png>] [3] +LaTeX Font Info: Try loading font information for TS1+cmtt on input line 467 +. + (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmtt.fd +File: ts1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) [4] <../lecture_09/mass_springs.png, id=114, 112.42pt x 190.7125pt> +File: ../lecture_09/mass_springs.png Graphic file (type png) + + +Package pdftex.def Info: ../lecture_09/mass_springs.png used on input line 506. + +(pdftex.def) Requested size: 89.93611pt x 152.576pt. + [5 <../lecture_09/mass_springs.png>] +LaTeX Font Info: Font shape `T1/ppl/bx/n' in size <14.4> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 589. + +[6] [7] [8] [9] [10] +LaTeX Font Info: Font shape `T1/cmtt/bx/n' in size <10.95> not available +(Font) Font shape `T1/cmtt/m/n' tried instead on input line 911. + + +File: lecture_13_files/lecture_13_22_1.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_13_files/lecture_13_22_1.pdf used on input lin +e 935. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [11] +Underfull \hbox (badness 10000) in paragraph at lines 937--938 + + [] + +[12 <./lecture_13_files/lecture_13_22_1.pdf>] + +File: lecture_13_files/lecture_13_27_0.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_13_files/lecture_13_27_0.pdf used on input lin +e 1021. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [13] +Underfull \hbox (badness 10000) in paragraph at lines 1023--1024 + + [] + +[14 <./lecture_13_files/lecture_13_27_0.pdf>] [15] [16] [17] + +File: lecture_13_files/lecture_13_34_0.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_13_files/lecture_13_34_0.pdf used on input lin +e 1237. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + +Underfull \hbox (badness 10000) in paragraph at lines 1239--1240 + + [] + + +File: lecture_13_files/lecture_13_34_1.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_13_files/lecture_13_34_1.pdf used on input lin +e 1242. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [18 <./lecture_13_files/lecture_13_34_0.pdf>] +Underfull \hbox (badness 10000) in paragraph at lines 1244--1245 + + [] + +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 1255. +[19 <./lecture_13_files/lecture_13_34_1.pdf>] +Package atveryend Info: Empty hook `AfterLastShipout' on input line 1255. + (./lecture_13.aux) +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 1255. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 1255. + +Package rerunfilecheck Info: File `lecture_13.out' has not changed. +(rerunfilecheck) Checksum: 3327085CC63CD3D2D32FC014A9388EB9;1247. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 1255. + ) +Here is how much of TeX's memory you used: + 11003 strings out of 493029 + 164927 string characters out of 6136234 + 273636 words of memory out of 5000000 + 14260 multiletter control sequences out of 15000+600000 + 39435 words of font info for 100 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 36i,10n,77p,867b,465s stack positions out of 5000i,500n,10000p,200000b,80000s +{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}{/usr/share/texli +ve/texmf-dist/fonts/enc/dvips/base/8r.enc}{/usr/share/texmf/fonts/enc/dvips/cm- +super/cm-super-t1.enc} +Output written on lecture_13.pdf (19 pages, 265779 bytes). +PDF statistics: + 281 PDF objects out of 1000 (max. 8388607) + 225 compressed objects within 3 object streams + 46 named destinations out of 1000 (max. 500000) + 164 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/lecture_13/lecture_13.md b/lecture_13/lecture_13.md new file mode 100644 index 0000000..914980b --- /dev/null +++ b/lecture_13/lecture_13.md @@ -0,0 +1,943 @@ + + +```octave +%plot --format svg +``` + + +```octave +setdefaults +``` + +## My question from last class + +![q1](efficient_soln.png) + +![A](https://lh4.googleusercontent.com/fmG7EnFxpvvjSgijOuwz8osuiH3cBDgOzTE64KnfQeeDDSG2oE86-BzcpYIQMVkkAgRRGEDEGi6-Nkr8qmEMeaAk-gcjEmXe42WFYUdOa5XoUaBkXRakkA77_XrkRjArCGZIFhjjDRoO7x0) + +![q2](norm_A.png) + + +## Your questions from last class + +1. Do we have to submit a link for HW #4 somewhere or is uploading to Github sufficient? + + -no, your submission from HW 3 is sufficient + +2. How do I get the formulas/formatting in markdown files to show up on github? + + -no luck for markdown equations in github, this is an ongoing request + +3. Confused about the p=1 norm part and ||A||_1 + +4. When's the exam? + + -next week (3/9) + +5. What do you recommend doing to get better at figuring out the homeworks? + + -time and experimenting (try going through the lecture examples, verify my work) + +6. Could we have an hw or extra credit with a video lecture to learn some simple python? + + -Sounds great! how simple? + + -[Installing Python and Jupyter Notebook (via Anaconda) - https://www.continuum.io/downloads](https://www.continuum.io/downloads) + + -[Running Matlab kernel in Jupyter - https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/](https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/) + + -[Running Octave kernel in Jupyter - https://anaconda.org/pypi/octave_kernel](https://anaconda.org/pypi/octave_kernel) + + + +## Condition of a matrix +### *just checked in to see what condition my condition was in* +### Matrix norms + +The Euclidean norm of a vector is measure of the magnitude (in 3D this would be: $|x|=\sqrt{x_{1}^{2}+x_{2}^{2}+x_{3}^{2}}$) in general the equation is: + +$||x||_{e}=\sqrt{\sum_{i=1}^{n}x_{i}^{2}}$ + +For a matrix, A, the same norm is called the Frobenius norm: + +$||A||_{f}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{2}}$ + +In general we can calculate any $p$-norm where + +$||A||_{p}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{p}}$ + +so the p=1, 1-norm is + +$||A||_{1}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{1}}=\sum_{i=1}^{n}\sum_{i=1}^{m}|A_{i,j}|$ + +$||A||_{\infty}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{\infty}}=\max_{1\le i \le n}\sum_{j=1}^{m}|A_{i,j}|$ + +### Condition of Matrix + +The matrix condition is the product of + +$Cond(A) = ||A||\cdot||A^{-1}||$ + +So each norm will have a different condition number, but the limit is $Cond(A)\ge 1$ + +An estimate of the rounding error is based on the condition of A: + +$\frac{||\Delta x||}{x} \le Cond(A) \frac{||\Delta A||}{||A||}$ + +So if the coefficients of A have accuracy to $10^{-t} + +and the condition of A, $Cond(A)=10^{c}$ + +then the solution for x can have rounding errors up to $10^{c-t}$ + + + +```octave +A=[1,1/2,1/3;1/2,1/3,1/4;1/3,1/4,1/5] +[L,U]=LU_naive(A) +``` + + A = + + 1.00000 0.50000 0.33333 + 0.50000 0.33333 0.25000 + 0.33333 0.25000 0.20000 + + L = + + 1.00000 0.00000 0.00000 + 0.50000 1.00000 0.00000 + 0.33333 1.00000 1.00000 + + U = + + 1.00000 0.50000 0.33333 + 0.00000 0.08333 0.08333 + 0.00000 -0.00000 0.00556 + + + +Then, $A^{-1}=(LU)^{-1}=U^{-1}L^{-1}$ + +$Ld_{1}=\left[\begin{array}{c} +1 \\ +0 \\ +0 \end{array}\right]$, $Ux_{1}=d_{1}$ ... + + +```octave +invA=zeros(3,3); +d1=L\[1;0;0]; +d2=L\[0;1;0]; +d3=L\[0;0;1]; +invA(:,1)=U\d1; +invA(:,2)=U\d2; +invA(:,3)=U\d3 +invA*A +``` + + invA = + + 9.0000 -36.0000 30.0000 + -36.0000 192.0000 -180.0000 + 30.0000 -180.0000 180.0000 + + ans = + + 1.0000e+00 3.5527e-15 2.9976e-15 + -1.3249e-14 1.0000e+00 -9.1038e-15 + 8.5117e-15 7.1054e-15 1.0000e+00 + + + +Find the condition of A, $cond(A)$ + + +```octave +% Frobenius norm +normf_A = sqrt(sum(sum(A.^2))) +normf_invA = sqrt(sum(sum(invA.^2))) + +cond_f_A = normf_A*normf_invA + +norm(A,'fro') + +% p=1, column sum norm +norm1_A = max(sum(A,2)) +norm1_invA = max(sum(invA,2)) +norm(A,1) + +cond_1_A=norm1_A*norm1_invA + +% p=inf, row sum norm +norminf_A = max(sum(A,1)) +norminf_invA = max(sum(invA,1)) +norm(A,inf) + +cond_inf_A=norminf_A*norminf_invA + +``` + + normf_A = 1.4136 + normf_invA = 372.21 + cond_f_A = 526.16 + ans = 1.4136 + norm1_A = 1.8333 + norm1_invA = 30.000 + ans = 1.8333 + cond_1_A = 55.000 + norminf_A = 1.8333 + norminf_invA = 30.000 + ans = 1.8333 + cond_inf_A = 55.000 + + +Consider the problem again from the intro to Linear Algebra, 4 masses are connected in series to 4 springs with spring constants $K_{i}$. What does a high condition number mean for this problem? + +![Springs-masses](../lecture_09/mass_springs.png) + +The masses haves the following amounts, 1, 2, 3, and 4 kg for masses 1-4. Using a FBD for each mass: + +$m_{1}g+k_{2}(x_{2}-x_{1})-k_{1}x_{1}=0$ + +$m_{2}g+k_{3}(x_{3}-x_{2})-k_{2}(x_{2}-x_{1})=0$ + +$m_{3}g+k_{4}(x_{4}-x_{3})-k_{3}(x_{3}-x_{2})=0$ + +$m_{4}g-k_{4}(x_{4}-x_{3})=0$ + +in matrix form: + +$\left[ \begin{array}{cccc} +k_{1}+k_{2} & -k_{2} & 0 & 0 \\ +-k_{2} & k_{2}+k_{3} & -k_{3} & 0 \\ +0 & -k_{3} & k_{3}+k_{4} & -k_{4} \\ +0 & 0 & -k_{4} & k_{4} \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]$ + + +```octave +k1=10; % N/m +k2=100000; +k3=10; +k4=1; +m1=1; % kg +m2=2; +m3=3; +m4=4; +g=9.81; % m/s^2 +K=[k1+k2 -k2 0 0; -k2 k2+k3 -k3 0; 0 -k3 k3+k4 -k4; 0 0 -k4 k4] +y=[m1*g;m2*g;m3*g;m4*g] +``` + + K = + + 100010 -100000 0 0 + -100000 100010 -10 0 + 0 -10 11 -1 + 0 0 -1 1 + + y = + + 9.8100 + 19.6200 + 29.4300 + 39.2400 + + + + +```octave +cond(K,inf) +cond(K,1) +cond(K,'fro') +cond(K,2) +``` + + ans = 3.2004e+05 + ans = 3.2004e+05 + ans = 2.5925e+05 + ans = 2.5293e+05 + + + +```octave +e=eig(K) +max(e)/min(e) +``` + + e = + + 7.9078e-01 + 3.5881e+00 + 1.7621e+01 + 2.0001e+05 + + ans = 2.5293e+05 + + +# Iterative Methods + +## Gauss-Seidel method + +If we have an intial guess for each value of a vector $x$ that we are trying to solve, then it is easy enough to solve for one component given the others. + +Take a 3$\times$3 matrix + +$Ax=b$ + +$\left[ \begin{array}{ccc} +3 & -0.1 & -0.2 \\ +0.1 & 7 & -0.3 \\ +0.3 & -0.2 & 10 \end{array} \right] +\left[ \begin{array}{c} +x_{1} \\ +x_{2} \\ +x_{3} \end{array} \right]= +\left[ \begin{array}{c} +7.85 \\ +-19.3 \\ +71.4\end{array} \right]$ + +$x_{1}=\frac{7.85+0.1x_{2}+0.3x_{3}}{3}$ + +$x_{2}=\frac{-19.3-0.1x_{1}+0.3x_{3}}{7}$ + +$x_{3}=\frac{71.4+0.1x_{1}+0.2x_{2}}{10}$ + + +```octave +A=[3 -0.1 -0.2;0.1 7 -0.3;0.3 -0.2 10] +b=[7.85;-19.3;71.4] + +x=A\b +``` + + A = + + 3.00000 -0.10000 -0.20000 + 0.10000 7.00000 -0.30000 + 0.30000 -0.20000 10.00000 + + b = + + 7.8500 + -19.3000 + 71.4000 + + x = + + 3.0000 + -2.5000 + 7.0000 + + + +### Gauss-Seidel Iterative approach + +As a first guess, we can use $x_{1}=x_{2}=x_{3}=0$ + +$x_{1}=\frac{7.85+0.1(0)+0.3(0)}{3}=2.6167$ + +$x_{2}=\frac{-19.3-0.1(2.6167)+0.3(0)}{7}=-2.7945$ + +$x_{3}=\frac{71.4+0.1(2.6167)+0.2(-2.7945)}{10}=7.0056$ + +Then, we update the guess: + +$x_{1}=\frac{7.85+0.1(-2.7945)+0.3(7.0056)}{3}=2.9906$ + +$x_{2}=\frac{-19.3-0.1(2.9906)+0.3(7.0056)}{7}=-2.4996$ + +$x_{3}=\frac{71.4+0.1(2.9906)+0.2(-2.4966)}{10}=7.00029$ + +The results are conveerging to the solution we found with `\` of $x_{1}=3,~x_{2}=-2.5,~x_{3}=7$ + +We could also use an iterative method that solves for all of the x-components in one step: + +### Jacobi method + +$x_{1}^{i}=\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ + +$x_{2}^{i}=\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$ + +$x_{3}^{i}=\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$ + +Here the solution is a matrix multiplication and vector addition + +$\left[ \begin{array}{c} +x_{1}^{i} \\ +x_{2}^{i} \\ +x_{3}^{i} \end{array} \right]= +\left[ \begin{array}{c} +7.85/3 \\ +-19.3/7 \\ +71.4/10\end{array} \right]- +\left[ \begin{array}{ccc} +0 & -0.1 & -0.2 \\ +0.1 & 0 & -0.3 \\ +0.3 & -0.2 & 0 \end{array} \right] +\left[ \begin{array}{c} +x_{1}^{i-1} \\ +x_{2}^{i-1} \\ +x_{3}^{i-1} \end{array} \right]$ + +|x_{j}|Jacobi method |vs| Gauss-Seidel | +|--------|------------------------------|---|-------------------------------| +|$x_{1}^{i}=$ | $\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ | | $\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$| +|$x_{2}^{i}=$ | $\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$ | | $\frac{-19.3-0.1x_{1}^{i}+0.3x_{3}^{i-1}}{7}$ | +|$x_{3}^{i}=$ | $\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$ | | $\frac{71.4+0.1x_{1}^{i}+0.2x_{2}^{i}}{10}$| + + +```octave +ba=b./diag(A) % or ba=b./[A(1,1);A(2,2);A(3,3)] +sA=A-diag(diag(A)) % A with zeros on diagonal +sA(1,:)=sA(1,:)/A(1,1); +sA(2,:)=sA(2,:)/A(2,2); +sA(3,:)=sA(3,:)/A(3,3) +x0=[0;0;0]; +x1=ba-sA*x0 +x2=ba-sA*x1 +x3=ba-sA*x2 +fprintf('solution is converging to [3,-2.5,7]]\n') +``` + + ba = + + 2.6167 + -2.7571 + 7.1400 + + sA = + + 0.00000 -0.10000 -0.20000 + 0.10000 0.00000 -0.30000 + 0.30000 -0.20000 0.00000 + + sA = + + 0.000000 -0.033333 -0.066667 + 0.014286 0.000000 -0.042857 + 0.030000 -0.020000 0.000000 + + x1 = + + 2.6167 + -2.7571 + 7.1400 + + x2 = + + 3.0008 + -2.4885 + 7.0064 + + x3 = + + 3.0008 + -2.4997 + 7.0002 + + solution is converging to [3,-2.5,7]] + + + +```octave +diag(A) +diag(diag(A)) +``` + + ans = + + 3 + 7 + 10 + + ans = + + Diagonal Matrix + + 3 0 0 + 0 7 0 + 0 0 10 + + + +This method works if problem is diagonally dominant, + +$|a_{ii}|>\sum_{j=1,j\ne i}^{n}|a_{ij}|$ + +If this condition is true, then Jacobi or Gauss-Seidel should converge + + + + +```octave +A=[0.1,1,3;1,0.2,3;5,2,0.3] +b=[12;2;4] +A\b +``` + + A = + + 0.10000 1.00000 3.00000 + 1.00000 0.20000 3.00000 + 5.00000 2.00000 0.30000 + + b = + + 12 + 2 + 4 + + ans = + + -2.9393 + 9.1933 + 1.0336 + + + + +```octave +ba=b./diag(A) % or ba=b./[A(1,1);A(2,2);A(3,3)] +sA=A-diag(diag(A)) % A with zeros on diagonal +sA(1,:)=sA(1,:)/A(1,1); +sA(2,:)=sA(2,:)/A(2,2); +sA(3,:)=sA(3,:)/A(3,3) +x0=[0;0;0]; +x1=ba-sA*x0 +x2=ba-sA*x1 +x3=ba-sA*x2 +fprintf('solution is not converging to [-2.93,9.19,1.03]\n') +``` + + ba = + + 120.000 + 10.000 + 13.333 + + sA = + + 0 1 3 + 1 0 3 + 5 2 0 + + sA = + + 0.00000 10.00000 30.00000 + 5.00000 0.00000 15.00000 + 16.66667 6.66667 0.00000 + + x1 = + + 120.000 + 10.000 + 13.333 + + x2 = + + -380.00 + -790.00 + -2053.33 + + x3 = + + 6.9620e+04 + 3.2710e+04 + 1.1613e+04 + + solution is not converging to [-2.93,9.19,1.03] + + +## Gauss-Seidel with Relaxation + +In order to force the solution to converge faster, we can introduce a relaxation term $\lambda$. + +where the new x values are weighted between the old and new: + +$x^{i}=\lambda x^{i}+(1-\lambda)x^{i-1}$ + +after solving for x, lambda weights the current approximation with the previous approximation for the updated x + + + +```octave +% rearrange A and b +A=[3 -0.1 -0.2;0.1 7 -0.3;0.3 -0.2 10] +b=[7.85;-19.3;71.4] + +iters=zeros(100,1); +for i=1:100 + lambda=2/100*i; + [x,ea,iters(i)]=Jacobi_rel(A,b,lambda); +end +plot([1:100]*2/100,iters) +``` + + A = + + 3.00000 -0.10000 -0.20000 + 0.10000 7.00000 -0.30000 + 0.30000 -0.20000 10.00000 + + b = + + 7.8500 + -19.3000 + 71.4000 + + + + +![svg](lecture_13_files/lecture_13_22_1.svg) + + + +```octave +l=fminbnd(@(l) lambda_fcn(A,b,l),0.5,1.5) +``` + + l = 0.99158 + + + +```octave +A\b +``` + + ans = + + 3.0000 + -2.5000 + 7.0000 + + + + +```octave +[x,ea,iter]=Jacobi_rel(A,b,l,0.000001) +[x,ea,iter]=Jacobi_rel(A,b,1,0.000001) + +``` + + x = + + 3.0000 + -2.5000 + 7.0000 + + ea = + + 1.8289e-07 + 2.1984e-08 + 2.3864e-08 + + iter = 8 + x = + + 3.0000 + -2.5000 + 7.0000 + + ea = + + 1.9130e-08 + 7.6449e-08 + 3.3378e-08 + + iter = 8 + + +## Nonlinear Systems + +Consider two simultaneous nonlinear equations with two unknowns: + +$x_{1}^{2}+x_{1}x_{2}=10$ + +$x_{2}+3x_{1}x_{2}^{2}=57$ + +Graphically, we are looking for the solution: + + + +```octave +x11=linspace(0.5,3); +x12=(10-x11.^2)./x11; + +x22=linspace(2,8); +x21=(57-x22).*x22.^-2/3; + +plot(x11,x12,x21,x22) +% Solution at x_1=2, x_2=3 +hold on; +plot(2,3,'o') +``` + + +![svg](lecture_13_files/lecture_13_27_0.svg) + + +## Newton-Raphson part II + +Remember the first order approximation for the next point in a function is: + +$f(x_{i+1})=f(x_{i})+(x_{i+1}-x_{i})f'(x_{i})$ + +then, $f(x_{i+1})=0$ so we are left with: + +$x_{i+1}=x_{i}-\frac{f(x_{i})}{f'(x_{i})}$ + +We can use the same formula, but now we have multiple dimensions so we need to determine the Jacobian + +$[J]=\left[ \begin{array}{cccc} +\frac{\partial f_{1,i}}{\partial x_{1}} & \frac{\partial f_{1,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{1,i}}{\partial x_{n}} \\ +\frac{\partial f_{2,i}}{\partial x_{1}} & \frac{\partial f_{2,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{2,i}}{\partial x_{n}} \\ +\vdots & \vdots & & \vdots \\ +\frac{\partial f_{n,i}}{\partial x_{1}} & \frac{\partial f_{n,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{n,i}}{\partial x_{n}} \\ +\end{array} \right]$ + +$\left[ \begin{array}{c} +f_{1,i+1} \\ +f_{2,i+1} \\ +\vdots \\ +f_{n,i+1}\end{array} \right]= +\left[ \begin{array}{c} +f_{1,i} \\ +f_{2,i} \\ +\vdots \\ +f_{n,i}\end{array} \right]+ +\left[ \begin{array}{cccc} +\frac{\partial f_{1,i}}{\partial x_{1}} & \frac{\partial f_{1,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{1,i}}{\partial x_{n}} \\ +\frac{\partial f_{2,i}}{\partial x_{1}} & \frac{\partial f_{2,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{2,i}}{\partial x_{n}} \\ +\vdots & \vdots & & \vdots \\ +\frac{\partial f_{n,i}}{\partial x_{1}} & \frac{\partial f_{n,i}}{\partial x_{2}} & +\cdots & \frac{\partial f_{n,i}}{\partial x_{n}} \\ +\end{array} \right] +\left( \left[ \begin{array}{c} +x_{i+1} \\ +x_{i+1} \\ +\vdots \\ +x_{i+1}\end{array} \right]- +\left[ \begin{array}{c} +f_{1,i} \\ +f_{2,i} \\ +\vdots \\ +f_{n,i}\end{array} \right]\right)$ + +### Solution is again in the form Ax=b + +$[J]([x_{i+1}]-[x_{i}])=-[f]$ + +so + +$[x_{i+1}]= [x_{i}]-[J]^{-1}[f]$ + +## Example of Jacobian calculation + +### Nonlinear springs supporting two masses in series + +Two springs are connected to two masses, with $m_1$=1 kg and $m_{2}$=2 kg. The springs are identical, but they have nonlinear spring constants, of $k_1$=10 N/m and $k_2$=-4 N/m + +We want to solve for the final position of the masses ($x_1$ and $x_2$) + +$m_{1}g+k_{1}(x_{2}-x_{1})+k_{2}(x_{2}-x_{1})^{2}+k_{1}x_{1}+k_{2}x_{1}^{2}=0$ + +$m_{2}g-k_{1}(x_{2}-x_{1})-k_{2}(x_2-x_1)^{2}=0$ + +$J(1,1)=\frac{\partial f_{1}}{\partial x_{1}}=-k_{1}-2k_{2}(x_{2}-x_{1})+k_{1}+2k_{2}x_{1}$ + +$J(1,2)=\frac{\partial f_1}{\partial x_{2}}=k_{1}+2k_{2}(x_{2}-x_{1})$ + +$J(2,1)=\frac{\partial f_2}{\partial x_{1}}=k_{1}+2k_{2}(x_{2}-x_{1})$ + +$J(2,2)=\frac{\partial f_2}{\partial x_{2}}=-k_{1}-2k_{2}(x_{2}-x_{1})$ + +Use an initial guess of $x_1=x_2=0$ + + + +```octave +m1=1; % kg +m2=2; % kg +k1=10; % N/m +k2=-4; % N/m^2 +``` + + +```octave +function [f,J]=mass_spring(x) + % Function to calculate function values f1 and f2 as well as Jacobian + % for 2 masses and 2 identical nonlinear springs + m1=1; % kg + m2=2; % kg + k1=100; % N/m + k2=-10; % N/m^2 + g=9.81; % m/s^2 + x1=x(1); + x2=x(2); + J=[-k1-2*k2*(x2-x1)-k1-2*k2*x1,k1+2*k2*(x2-x1); + k1+2*k2*(x2-x1),-k1-2*k2*(x2-x1)]; + f=[m1*g+k1*(x2-x1)+k2*(x2-x1).^2-k1*x1-k2*x1^2; + m2*g-k1*(x2-x1)-k2*(x2-x1).^2]; +end + +``` + + +```octave +[f,J]=mass_spring([1,0]) +``` + + f = + + -190.19 + 129.62 + + J = + + -200 120 + 120 -120 + + + + +```octave +x0=[3;2]; +[f0,J0]=mass_spring(x0); +x1=x0-J0\f0 +ea=(x1-x0)./x1 +[f1,J1]=mass_spring(x1); +x2=x1-J1\f1 +ea=(x2-x1)./x2 +[f2,J2]=mass_spring(x2); +x3=x2-J2\f2 +ea=(x3-x2)./x3 +x=x3 +for i=1:3 + xold=x; + [f,J]=mass_spring(x); + x=x-J\f; + ea=(x-xold)./x +end +``` + + x1 = + + -1.5142 + -1.4341 + + ea = + + 2.9812 + 2.3946 + + x2 = + + 0.049894 + 0.248638 + + ea = + + 31.3492 + 6.7678 + + x3 = + + 0.29701 + 0.49722 + + ea = + + 0.83201 + 0.49995 + + x = + + 0.29701 + 0.49722 + + ea = + + 0.021392 + 0.012890 + + ea = + + 1.4786e-05 + 8.9091e-06 + + ea = + + 7.0642e-12 + 4.2565e-12 + + + + +```octave +x +X0=fsolve(@(x) mass_spring(x),[3;5]) +``` + + x = + + 0.30351 + 0.50372 + + X0 = + + 0.30351 + 0.50372 + + + + +```octave +[X,Y]=meshgrid(linspace(0,1,20),linspace(0,1,20)); +[N,M]=size(X); +F=zeros(size(X)); +for i=1:N + for j=1:M + [f,~]=mass_spring([X(i,j),Y(i,j)]); + F(i,j)=f(1); + end +end +pcolor(X,Y,F) +xlabel('x_1') +ylabel('x_2') +colorbar() +figure() +pcolor(X,Y,F) +xlabel('x_1') +ylabel('x_2') +colorbar() +``` + + +![svg](lecture_13_files/lecture_13_34_0.svg) + + + +![svg](lecture_13_files/lecture_13_34_1.svg) + + + +```octave + +``` diff --git a/lecture_13/lecture_13.out b/lecture_13/lecture_13.out new file mode 100644 index 0000000..edec246 --- /dev/null +++ b/lecture_13/lecture_13.out @@ -0,0 +1,16 @@ +\BOOKMARK [2][-]{subsection.0.1}{My question from last class}{}% 1 +\BOOKMARK [2][-]{subsection.0.2}{Your questions from last class}{}% 2 +\BOOKMARK [2][-]{subsection.0.3}{Condition of a matrix}{}% 3 +\BOOKMARK [3][-]{subsubsection.0.3.1}{just checked in to see what condition my condition was in}{subsection.0.3}% 4 +\BOOKMARK [3][-]{subsubsection.0.3.2}{Matrix norms}{subsection.0.3}% 5 +\BOOKMARK [3][-]{subsubsection.0.3.3}{Condition of Matrix}{subsection.0.3}% 6 +\BOOKMARK [1][-]{section.1}{Iterative Methods}{}% 7 +\BOOKMARK [2][-]{subsection.1.1}{Gauss-Seidel method}{section.1}% 8 +\BOOKMARK [3][-]{subsubsection.1.1.1}{Gauss-Seidel Iterative approach}{subsection.1.1}% 9 +\BOOKMARK [3][-]{subsubsection.1.1.2}{Jacobi method}{subsection.1.1}% 10 +\BOOKMARK [2][-]{subsection.1.2}{Gauss-Seidel with Relaxation}{section.1}% 11 +\BOOKMARK [2][-]{subsection.1.3}{Nonlinear Systems}{section.1}% 12 +\BOOKMARK [2][-]{subsection.1.4}{Newton-Raphson part II}{section.1}% 13 +\BOOKMARK [3][-]{subsubsection.1.4.1}{Solution is again in the form Ax=b}{subsection.1.4}% 14 +\BOOKMARK [2][-]{subsection.1.5}{Example of Jacobian calculation}{section.1}% 15 +\BOOKMARK [3][-]{subsubsection.1.5.1}{Nonlinear springs supporting two masses in series}{subsection.1.5}% 16 diff --git a/lecture_13/lecture_13.pdf b/lecture_13/lecture_13.pdf new file mode 100644 index 0000000..fad59c8 Binary files /dev/null and b/lecture_13/lecture_13.pdf differ diff --git a/lecture_13/lecture_13.tex b/lecture_13/lecture_13.tex new file mode 100644 index 0000000..87d8d25 --- /dev/null +++ b/lecture_13/lecture_13.tex @@ -0,0 +1,1255 @@ + +% Default to the notebook output style + + + + +% Inherit from the specified cell style. + + + + + +\documentclass[11pt]{article} + + + + \usepackage[T1]{fontenc} + % Nicer default font (+ math font) than Computer Modern for most use cases + \usepackage{mathpazo} + + % Basic figure setup, for now with no caption control since it's done + % automatically by Pandoc (which extracts ![](path) syntax from Markdown). + \usepackage{graphicx} + % We will generate all images so they have a width \maxwidth. This means + % that they will get their normal width if they fit onto the page, but + % are scaled down if they would overflow the margins. + \makeatletter + \def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth + \else\Gin@nat@width\fi} + \makeatother + \let\Oldincludegraphics\includegraphics + % Set max figure width to be 80% of text width, for now hardcoded. + \renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=.8\maxwidth]{#1}} + % Ensure that by default, figures have no caption (until we provide a + % proper Figure object with a Caption API and a way to capture that + % in the conversion process - todo). + \usepackage{caption} + \DeclareCaptionLabelFormat{nolabel}{} + \captionsetup{labelformat=nolabel} + + \usepackage{adjustbox} % Used to constrain images to a maximum size + \usepackage{xcolor} % Allow colors to be defined + \usepackage{enumerate} % Needed for markdown enumerations to work + \usepackage{geometry} % Used to adjust the document margins + \usepackage{amsmath} % Equations + \usepackage{amssymb} % Equations + \usepackage{textcomp} % defines textquotesingle + % Hack from http://tex.stackexchange.com/a/47451/13684: + \AtBeginDocument{% + \def\PYZsq{\textquotesingle}% Upright quotes in Pygmentized code + } + \usepackage{upquote} % Upright quotes for verbatim code + \usepackage{eurosym} % defines \euro + \usepackage[mathletters]{ucs} % Extended unicode (utf-8) support + \usepackage[utf8x]{inputenc} % Allow utf-8 characters in the tex document + \usepackage{fancyvrb} % verbatim replacement that allows latex + \usepackage{grffile} % extends the file name processing of package graphics + % to support a larger range + % The hyperref package gives us a pdf with properly built + % internal navigation ('pdf bookmarks' for the table of contents, + % internal cross-reference links, web links for URLs, etc.) + \usepackage{hyperref} + \usepackage{longtable} % longtable support required by pandoc >1.10 + \usepackage{booktabs} % table support for pandoc > 1.12.2 + \usepackage[inline]{enumitem} % IRkernel/repr support (it uses the enumerate* environment) + \usepackage[normalem]{ulem} % ulem is needed to support strikethroughs (\sout) + % normalem makes italics be italics, not underlines + + + + + % Colors for the hyperref package + \definecolor{urlcolor}{rgb}{0,.145,.698} + \definecolor{linkcolor}{rgb}{.71,0.21,0.01} + \definecolor{citecolor}{rgb}{.12,.54,.11} + + % ANSI colors + \definecolor{ansi-black}{HTML}{3E424D} + \definecolor{ansi-black-intense}{HTML}{282C36} + \definecolor{ansi-red}{HTML}{E75C58} + \definecolor{ansi-red-intense}{HTML}{B22B31} + \definecolor{ansi-green}{HTML}{00A250} + \definecolor{ansi-green-intense}{HTML}{007427} + \definecolor{ansi-yellow}{HTML}{DDB62B} + \definecolor{ansi-yellow-intense}{HTML}{B27D12} + \definecolor{ansi-blue}{HTML}{208FFB} + \definecolor{ansi-blue-intense}{HTML}{0065CA} + \definecolor{ansi-magenta}{HTML}{D160C4} + \definecolor{ansi-magenta-intense}{HTML}{A03196} + \definecolor{ansi-cyan}{HTML}{60C6C8} + \definecolor{ansi-cyan-intense}{HTML}{258F8F} + \definecolor{ansi-white}{HTML}{C5C1B4} + \definecolor{ansi-white-intense}{HTML}{A1A6B2} + + % commands and environments needed by pandoc snippets + % extracted from the output of `pandoc -s` + \providecommand{\tightlist}{% + \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}} + \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} + % Add ',fontsize=\small' for more characters per line + \newenvironment{Shaded}{}{} + \newcommand{\KeywordTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\DataTypeTok}[1]{\textcolor[rgb]{0.56,0.13,0.00}{{#1}}} + \newcommand{\DecValTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\BaseNTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\FloatTok}[1]{\textcolor[rgb]{0.25,0.63,0.44}{{#1}}} + \newcommand{\CharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\StringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\CommentTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textit{{#1}}}} + \newcommand{\OtherTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{{#1}}} + \newcommand{\AlertTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\FunctionTok}[1]{\textcolor[rgb]{0.02,0.16,0.49}{{#1}}} + \newcommand{\RegionMarkerTok}[1]{{#1}} + \newcommand{\ErrorTok}[1]{\textcolor[rgb]{1.00,0.00,0.00}{\textbf{{#1}}}} + \newcommand{\NormalTok}[1]{{#1}} + + % Additional commands for more recent versions of Pandoc + \newcommand{\ConstantTok}[1]{\textcolor[rgb]{0.53,0.00,0.00}{{#1}}} + \newcommand{\SpecialCharTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\VerbatimStringTok}[1]{\textcolor[rgb]{0.25,0.44,0.63}{{#1}}} + \newcommand{\SpecialStringTok}[1]{\textcolor[rgb]{0.73,0.40,0.53}{{#1}}} + \newcommand{\ImportTok}[1]{{#1}} + \newcommand{\DocumentationTok}[1]{\textcolor[rgb]{0.73,0.13,0.13}{\textit{{#1}}}} + \newcommand{\AnnotationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\CommentVarTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\VariableTok}[1]{\textcolor[rgb]{0.10,0.09,0.49}{{#1}}} + \newcommand{\ControlFlowTok}[1]{\textcolor[rgb]{0.00,0.44,0.13}{\textbf{{#1}}}} + \newcommand{\OperatorTok}[1]{\textcolor[rgb]{0.40,0.40,0.40}{{#1}}} + \newcommand{\BuiltInTok}[1]{{#1}} + \newcommand{\ExtensionTok}[1]{{#1}} + \newcommand{\PreprocessorTok}[1]{\textcolor[rgb]{0.74,0.48,0.00}{{#1}}} + \newcommand{\AttributeTok}[1]{\textcolor[rgb]{0.49,0.56,0.16}{{#1}}} + \newcommand{\InformationTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + \newcommand{\WarningTok}[1]{\textcolor[rgb]{0.38,0.63,0.69}{\textbf{\textit{{#1}}}}} + + + % Define a nice break command that doesn't care if a line doesn't already + % exist. + \def\br{\hspace*{\fill} \\* } + % Math Jax compatability definitions + \def\gt{>} + \def\lt{<} + % Document parameters + \title{lecture\_13} + + + + + % Pygments definitions + +\makeatletter +\def\PY@reset{\let\PY@it=\relax \let\PY@bf=\relax% + \let\PY@ul=\relax \let\PY@tc=\relax% + \let\PY@bc=\relax \let\PY@ff=\relax} +\def\PY@tok#1{\csname PY@tok@#1\endcsname} +\def\PY@toks#1+{\ifx\relax#1\empty\else% + \PY@tok{#1}\expandafter\PY@toks\fi} +\def\PY@do#1{\PY@bc{\PY@tc{\PY@ul{% + \PY@it{\PY@bf{\PY@ff{#1}}}}}}} +\def\PY#1#2{\PY@reset\PY@toks#1+\relax+\PY@do{#2}} + +\expandafter\def\csname PY@tok@gd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@gu\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.50,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@gt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.27,0.87}{##1}}} +\expandafter\def\csname PY@tok@gs\endcsname{\let\PY@bf=\textbf} +\expandafter\def\csname PY@tok@gr\endcsname{\def\PY@tc##1{\textcolor[rgb]{1.00,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@cm\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@vg\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@vi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@mh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@cs\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@ge\endcsname{\let\PY@it=\textit} +\expandafter\def\csname PY@tok@vc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@il\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@go\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.53,0.53}{##1}}} +\expandafter\def\csname PY@tok@cp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.74,0.48,0.00}{##1}}} +\expandafter\def\csname PY@tok@gi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@gh\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@ni\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.60,0.60,0.60}{##1}}} +\expandafter\def\csname PY@tok@nl\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.63,0.63,0.00}{##1}}} +\expandafter\def\csname PY@tok@nn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@no\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.53,0.00,0.00}{##1}}} +\expandafter\def\csname PY@tok@na\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.49,0.56,0.16}{##1}}} +\expandafter\def\csname PY@tok@nb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@nd\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@ne\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.82,0.25,0.23}{##1}}} +\expandafter\def\csname PY@tok@nf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,1.00}{##1}}} +\expandafter\def\csname PY@tok@si\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@s2\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@nt\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@nv\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@s1\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@ch\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@m\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@gp\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.00,0.50}{##1}}} +\expandafter\def\csname PY@tok@sh\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@ow\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.67,0.13,1.00}{##1}}} +\expandafter\def\csname PY@tok@sx\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@bp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@c1\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@o\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kc\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@c\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@mf\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\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}}} +\expandafter\def\csname PY@tok@mb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@ss\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.10,0.09,0.49}{##1}}} +\expandafter\def\csname PY@tok@sr\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.53}{##1}}} +\expandafter\def\csname PY@tok@mo\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kd\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@mi\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.40,0.40,0.40}{##1}}} +\expandafter\def\csname PY@tok@kn\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@cpf\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.25,0.50,0.50}{##1}}} +\expandafter\def\csname PY@tok@kr\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@s\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@kp\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@w\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.73,0.73}{##1}}} +\expandafter\def\csname PY@tok@kt\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.69,0.00,0.25}{##1}}} +\expandafter\def\csname PY@tok@sc\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@sb\endcsname{\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} +\expandafter\def\csname PY@tok@k\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.00,0.50,0.00}{##1}}} +\expandafter\def\csname PY@tok@se\endcsname{\let\PY@bf=\textbf\def\PY@tc##1{\textcolor[rgb]{0.73,0.40,0.13}{##1}}} +\expandafter\def\csname PY@tok@sd\endcsname{\let\PY@it=\textit\def\PY@tc##1{\textcolor[rgb]{0.73,0.13,0.13}{##1}}} + +\def\PYZbs{\char`\\} +\def\PYZus{\char`\_} +\def\PYZob{\char`\{} +\def\PYZcb{\char`\}} +\def\PYZca{\char`\^} +\def\PYZam{\char`\&} +\def\PYZlt{\char`\<} +\def\PYZgt{\char`\>} +\def\PYZsh{\char`\#} +\def\PYZpc{\char`\%} +\def\PYZdl{\char`\$} +\def\PYZhy{\char`\-} +\def\PYZsq{\char`\'} +\def\PYZdq{\char`\"} +\def\PYZti{\char`\~} +% for compatibility with earlier versions +\def\PYZat{@} +\def\PYZlb{[} +\def\PYZrb{]} +\makeatother + + + % Exact colors from NB + \definecolor{incolor}{rgb}{0.0, 0.0, 0.5} + \definecolor{outcolor}{rgb}{0.545, 0.0, 0.0} + + + + + % Prevent overflowing lines due to hard-to-break entities + \sloppy + % Setup hyperref package + \hypersetup{ + breaklinks=true, % so long urls are correctly broken across lines + colorlinks=true, + urlcolor=urlcolor, + linkcolor=linkcolor, + citecolor=citecolor, + } + % Slightly bigger margins than the latex defaults + + \geometry{verbose,tmargin=1in,bmargin=1in,lmargin=1in,rmargin=1in} + + + + \begin{document} + + + \maketitle + + + + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}1}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}2}]:} \PY{n}{setdefaults} +\end{Verbatim} + + \subsection{My question from last +class}\label{my-question-from-last-class} + +\begin{figure}[htbp] +\centering +\includegraphics{efficient_soln.png} +\caption{q1} +\end{figure} + +$A=\left[\begin{array}{ccc} + 2 & -2 & 0\\ + -1& 5 & 1 \\ +3 &4 & 5 \end{array}\right]$ + +\begin{figure}[htbp] +\centering +\includegraphics{norm_A.png} +\caption{q2} +\end{figure} + +\subsection{Your questions from last +class}\label{your-questions-from-last-class} + +\begin{enumerate} +\def\labelenumi{\arabic{enumi}.} +\item + Do we have to submit a link for HW \#4 somewhere or is uploading to + Github sufficient? + + -no, your submission from HW 3 is sufficient +\item + How do I get the formulas/formatting in markdown files to show up on + github? + + -no luck for markdown equations in github, this is an ongoing request +\item + Confused about the p=1 norm part and + \textbar{}\textbar{}A\textbar{}\textbar{}\_1 +\item + When's the exam? + + -next week (3/9) +\item + What do you recommend doing to get better at figuring out the + homeworks? + + -time and experimenting (try going through the lecture examples, + verify my work) +\item + Could we have an hw or extra credit with a video lecture to learn some + simple python? + + -Sounds great! how simple? + + -\href{https://www.continuum.io/downloads}{Installing Python and + Jupyter Notebook (via Anaconda) - https://www.continuum.io/downloads} + + -\href{https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/}{Running + Matlab kernel in Jupyter - + https://anneurai.net/2015/11/12/matlab-based-ipython-notebooks/} + + -\href{https://anaconda.org/pypi/octave_kernel}{Running Octave kernel + in Jupyter - https://anaconda.org/pypi/octave\_kernel} +\end{enumerate} + + \subsection{Condition of a matrix}\label{condition-of-a-matrix} + +\subsubsection{\texorpdfstring{\emph{just checked in to see what +condition my condition was +in}}{just checked in to see what condition my condition was in}}\label{just-checked-in-to-see-what-condition-my-condition-was-in} + +\subsubsection{Matrix norms}\label{matrix-norms} + +The Euclidean norm of a vector is measure of the magnitude (in 3D this +would be: $|x|=\sqrt{x_{1}^{2}+x_{2}^{2}+x_{3}^{2}}$) in general the +equation is: + +$||x||_{e}=\sqrt{\sum_{i=1}^{n}x_{i}^{2}}$ + +For a matrix, A, the same norm is called the Frobenius norm: + +$||A||_{f}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{2}}$ + +In general we can calculate any $p$-norm where + +$||A||_{p}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{p}}$ + +so the p=1, 1-norm is + +$||A||_{1}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{1}}=\sum_{i=1}^{n}\sum_{i=1}^{m}|A_{i,j}|$ + +$||A||_{\infty}=\sqrt{\sum_{i=1}^{n}\sum_{i=1}^{m}A_{i,j}^{\infty}}=\max_{1\le i \le n}\sum_{j=1}^{m}|A_{i,j}|$ + +\subsubsection{Condition of Matrix}\label{condition-of-matrix} + +The matrix condition is the product of + +$Cond(A) = ||A||\cdot||A^{-1}||$ + +So each norm will have a different condition number, but the limit is +$Cond(A)\ge 1$ + +An estimate of the rounding error is based on the condition of A: + +$\frac{||\Delta x||}{x} \le Cond(A) \frac{||\Delta A||}{||A||}$ + +So if the coefficients of A have accuracy to \$10\^{}\{-t\} + +and the condition of A, $Cond(A)=10^{c}$ + +then the solution for x can have rounding errors up to $10^{c-t}$ + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}72}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{4}\PY{p}{;}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{1}\PY{o}{/}\PY{l+m+mi}{5}\PY{p}{]} + \PY{p}{[}\PY{n}{L}\PY{p}{,}\PY{n}{U}\PY{p}{]}\PY{p}{=}\PY{n}{LU\PYZus{}naive}\PY{p}{(}\PY{n}{A}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 1.00000 0.50000 0.33333 + 0.50000 0.33333 0.25000 + 0.33333 0.25000 0.20000 + +L = + + 1.00000 0.00000 0.00000 + 0.50000 1.00000 0.00000 + 0.33333 1.00000 1.00000 + +U = + + 1.00000 0.50000 0.33333 + 0.00000 0.08333 0.08333 + 0.00000 -0.00000 0.00556 + + + \end{Verbatim} + + Then, $A^{-1}=(LU)^{-1}=U^{-1}L^{-1}$ + +$Ld_{1}=\left[\begin{array}{c} 1 \\ 0 \\ 0 \end{array}\right]$, +$Ux_{1}=d_{1}$ ... + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}75}]:} \PY{n}{invA}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{d1}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{d2}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{d3}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d1}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d2}\PY{p}{;} + \PY{n}{invA}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d3} + \PY{n}{invA}\PY{o}{*}\PY{n}{A} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +invA = + + 9.0000 -36.0000 30.0000 + -36.0000 192.0000 -180.0000 + 30.0000 -180.0000 180.0000 + +ans = + + 1.0000e+00 3.5527e-15 2.9976e-15 + -1.3249e-14 1.0000e+00 -9.1038e-15 + 8.5117e-15 7.1054e-15 1.0000e+00 + + + \end{Verbatim} + + Find the condition of A, $cond(A)$ + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}74}]:} \PY{c}{\PYZpc{} Frobenius norm} + \PY{n}{normf\PYZus{}A} \PY{p}{=} \PY{n+nb}{sqrt}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{p}{)} + \PY{n}{normf\PYZus{}invA} \PY{p}{=} \PY{n+nb}{sqrt}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{p}{)} + + \PY{n}{cond\PYZus{}f\PYZus{}A} \PY{p}{=} \PY{n}{normf\PYZus{}A}\PY{o}{*}\PY{n}{normf\PYZus{}invA} + + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{fro\PYZsq{}}\PY{p}{)} + + \PY{c}{\PYZpc{} p=1, column sum norm} + \PY{n}{norm1\PYZus{}A} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n}{norm1\PYZus{}invA} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)} + + \PY{n}{cond\PYZus{}1\PYZus{}A}\PY{p}{=}\PY{n}{norm1\PYZus{}A}\PY{o}{*}\PY{n}{norm1\PYZus{}invA} + + \PY{c}{\PYZpc{} p=inf, row sum norm} + \PY{n}{norminf\PYZus{}A} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)} + \PY{n}{norminf\PYZus{}invA} \PY{p}{=} \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{sum}\PY{p}{(}\PY{n}{invA}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)} + \PY{n+nb}{norm}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n+nb}{inf}\PY{p}{)} + + \PY{n}{cond\PYZus{}inf\PYZus{}A}\PY{p}{=}\PY{n}{norminf\PYZus{}A}\PY{o}{*}\PY{n}{norminf\PYZus{}invA} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +normf\_A = 1.4136 +normf\_invA = 372.21 +cond\_f\_A = 526.16 +ans = 1.4136 +norm1\_A = 1.8333 +norm1\_invA = 30.000 +ans = 1.8333 +cond\_1\_A = 55.000 +norminf\_A = 1.8333 +norminf\_invA = 30.000 +ans = 1.8333 +cond\_inf\_A = 55.000 + + \end{Verbatim} + + Consider the problem again from the intro to Linear Algebra, 4 masses +are connected in series to 4 springs with spring constants $K_{i}$. +What does a high condition number mean for this problem? + +\begin{figure}[htbp] +\centering +\includegraphics{../lecture_09/mass_springs.png} +\caption{Springs-masses} +\end{figure} + +The masses haves the following amounts, 1, 2, 3, and 4 kg for masses +1-4. Using a FBD for each mass: + +$m_{1}g+k_{2}(x_{2}-x_{1})-k_{1}x_{1}=0$ + +$m_{2}g+k_{3}(x_{3}-x_{2})-k_{2}(x_{2}-x_{1})=0$ + +$m_{3}g+k_{4}(x_{4}-x_{3})-k_{3}(x_{3}-x_{2})=0$ + +$m_{4}g-k_{4}(x_{4}-x_{3})=0$ + +in matrix form: + +$\left[ \begin{array}{cccc} k_{1}+k_{2} & -k_{2} & 0 & 0 \\ -k_{2} & k_{2}+k_{3} & -k_{3} & 0 \\ 0 & -k_{3} & k_{3}+k_{4} & -k_{4} \\ 0 & 0 & -k_{4} & k_{4} \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]$ + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}21}]:} \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} + \PY{n}{k2}\PY{p}{=}\PY{l+m+mi}{100000}\PY{p}{;} + \PY{n}{k3}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} + \PY{n}{k4}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} + \PY{n}{m1}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} kg} + \PY{n}{m2}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;} + \PY{n}{m3}\PY{p}{=}\PY{l+m+mi}{3}\PY{p}{;} + \PY{n}{m4}\PY{p}{=}\PY{l+m+mi}{4}\PY{p}{;} + \PY{n}{g}\PY{p}{=}\PY{l+m+mf}{9.81}\PY{p}{;} \PY{c}{\PYZpc{} m/s\PYZca{}2} + \PY{n}{K}\PY{p}{=}\PY{p}{[}\PY{n}{k1}\PY{o}{+}\PY{n}{k2} \PY{o}{\PYZhy{}}\PY{n}{k2} \PY{l+m+mi}{0} \PY{l+m+mi}{0}\PY{p}{;} \PY{o}{\PYZhy{}}\PY{n}{k2} \PY{n}{k2}\PY{o}{+}\PY{n}{k3} \PY{o}{\PYZhy{}}\PY{n}{k3} \PY{l+m+mi}{0}\PY{p}{;} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k3} \PY{n}{k3}\PY{o}{+}\PY{n}{k4} \PY{o}{\PYZhy{}}\PY{n}{k4}\PY{p}{;} \PY{l+m+mi}{0} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k4} \PY{n}{k4}\PY{p}{]} + \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}{]} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +K = + + 100010 -100000 0 0 + -100000 100010 -10 0 + 0 -10 11 -1 + 0 0 -1 1 + +y = + + 9.8100 + 19.6200 + 29.4300 + 39.2400 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}25}]:} \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{n+nb}{inf}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{fro\PYZsq{}}\PY{p}{)} + \PY{n+nb}{cond}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = 3.2004e+05 +ans = 3.2004e+05 +ans = 2.5925e+05 +ans = 2.5293e+05 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}26}]:} \PY{n+nb}{e}\PY{p}{=}\PY{n+nb}{eig}\PY{p}{(}\PY{n}{K}\PY{p}{)} + \PY{n+nb}{max}\PY{p}{(}\PY{n+nb}{e}\PY{p}{)}\PY{o}{/}\PY{n+nb}{min}\PY{p}{(}\PY{n+nb}{e}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +e = + + 7.9078e-01 + 3.5881e+00 + 1.7621e+01 + 2.0001e+05 + +ans = 2.5293e+05 + + \end{Verbatim} + + \section{Iterative Methods}\label{iterative-methods} + +\subsection{Gauss-Seidel method}\label{gauss-seidel-method} + +If we have an intial guess for each value of a vector $x$ that we are +trying to solve, then it is easy enough to solve for one component given +the others. + +Take a 3$\times$3 matrix + +$Ax=b$ + +$\left[ \begin{array}{ccc} 3 & -0.1 & -0.2 \\ 0.1 & 7 & -0.3 \\ 0.3 & -0.2 & 10 \end{array} \right] \left[ \begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \end{array} \right]= \left[ \begin{array}{c} 7.85 \\ -19.3 \\ 71.4\end{array} \right]$ + +$x_{1}=\frac{7.85+0.1x_{2}+0.3x_{3}}{3}$ + +$x_{2}=\frac{-19.3-0.1x_{1}+0.3x_{3}}{7}$ + +$x_{3}=\frac{71.4+0.1x_{1}+0.2x_{2}}{10}$ + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}9}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{3} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.1} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.2}\PY{p}{;}\PY{l+m+mf}{0.1} \PY{l+m+mi}{7} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.3}\PY{p}{;}\PY{l+m+mf}{0.3} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.2} \PY{l+m+mi}{10}\PY{p}{]} + \PY{n}{b}\PY{p}{=}\PY{p}{[}\PY{l+m+mf}{7.85}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mf}{19.3}\PY{p}{;}\PY{l+m+mf}{71.4}\PY{p}{]} + + \PY{n}{x}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{b} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 3.00000 -0.10000 -0.20000 + 0.10000 7.00000 -0.30000 + 0.30000 -0.20000 10.00000 + +b = + + 7.8500 + -19.3000 + 71.4000 + +x = + + 3.0000 + -2.5000 + 7.0000 + + + \end{Verbatim} + + \subsubsection{Gauss-Seidel Iterative +approach}\label{gauss-seidel-iterative-approach} + +As a first guess, we can use $x_{1}=x_{2}=x_{3}=0$ + +$x_{1}=\frac{7.85+0.1(0)+0.3(0)}{3}=2.6167$ + +$x_{2}=\frac{-19.3-0.1(2.6167)+0.3(0)}{7}=-2.7945$ + +$x_{3}=\frac{71.4+0.1(2.6167)+0.2(-2.7945)}{10}=7.0056$ + +Then, we update the guess: + +$x_{1}=\frac{7.85+0.1(-2.7945)+0.3(7.0056)}{3}=2.9906$ + +$x_{2}=\frac{-19.3-0.1(2.9906)+0.3(7.0056)}{7}=-2.4996$ + +$x_{3}=\frac{71.4+0.1(2.9906)+0.2(-2.4966)}{10}=7.00029$ + +The results are conveerging to the solution we found with +\texttt{\textbackslash{}} of $x_{1}=3,~x_{2}=-2.5,~x_{3}=7$ + +We could also use an iterative method that solves for all of the +x-components in one step: + +\subsubsection{Jacobi method}\label{jacobi-method} + +$x_{1}^{i}=\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ + +$x_{2}^{i}=\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$ + +$x_{3}^{i}=\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$ + +Here the solution is a matrix multiplication and vector addition + +$\left[ \begin{array}{c} x_{1}^{i} \\ x_{2}^{i} \\ x_{3}^{i} \end{array} \right]= \left[ \begin{array}{c} 7.85/3 \\ -19.3/7 \\ 71.4/10\end{array} \right]- \left[ \begin{array}{ccc} 0 & -0.1 & -0.2 \\ 0.1 & 0 & -0.3 \\ 0.3 & -0.2 & 0 \end{array} \right] \left[ \begin{array}{c} x_{1}^{i-1} \\ x_{2}^{i-1} \\ x_{3}^{i-1} \end{array} \right]$ + +\begin{longtable}[c]{@{}llll@{}} +\toprule +\begin{minipage}[b]{0.10\columnwidth}\raggedright\strut +x\_\{j\} +\strut\end{minipage} & +\begin{minipage}[b]{0.36\columnwidth}\raggedright\strut +Jacobi method +\strut\end{minipage} & +\begin{minipage}[b]{0.05\columnwidth}\raggedright\strut +vs +\strut\end{minipage} & +\begin{minipage}[b]{0.37\columnwidth}\raggedright\strut +Gauss-Seidel +\strut\end{minipage}\tabularnewline +\midrule +\endhead +\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut +$x_{1}^{i}=$ +\strut\end{minipage} & +\begin{minipage}[t]{0.36\columnwidth}\raggedright\strut +$\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ +\strut\end{minipage} & +\begin{minipage}[t]{0.05\columnwidth}\raggedright\strut +\strut\end{minipage} & +\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut +$\frac{7.85+0.1x_{2}^{i-1}+0.3x_{3}^{i-1}}{3}$ +\strut\end{minipage}\tabularnewline +\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut +$x_{2}^{i}=$ +\strut\end{minipage} & +\begin{minipage}[t]{0.36\columnwidth}\raggedright\strut +$\frac{-19.3-0.1x_{1}^{i-1}+0.3x_{3}^{i-1}}{7}$ +\strut\end{minipage} & +\begin{minipage}[t]{0.05\columnwidth}\raggedright\strut +\strut\end{minipage} & +\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut +$\frac{-19.3-0.1x_{1}^{i}+0.3x_{3}^{i-1}}{7}$ +\strut\end{minipage}\tabularnewline +\begin{minipage}[t]{0.10\columnwidth}\raggedright\strut +$x_{3}^{i}=$ +\strut\end{minipage} & +\begin{minipage}[t]{0.36\columnwidth}\raggedright\strut +$\frac{71.4+0.1x_{1}^{i-1}+0.2x_{2}^{i-1}}{10}$ +\strut\end{minipage} & +\begin{minipage}[t]{0.05\columnwidth}\raggedright\strut +\strut\end{minipage} & +\begin{minipage}[t]{0.37\columnwidth}\raggedright\strut +$\frac{71.4+0.1x_{1}^{i}+0.2x_{2}^{i}}{10}$ +\strut\end{minipage}\tabularnewline +\bottomrule +\end{longtable} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}15}]:} \PY{n}{ba}\PY{p}{=}\PY{n}{b}\PY{o}{./}\PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)} \PY{c}{\PYZpc{} or ba=b./[A(1,1);A(2,2);A(3,3)]} + \PY{n}{sA}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZhy{}}\PY{n+nb}{diag}\PY{p}{(}\PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{)} \PY{c}{\PYZpc{} A with zeros on diagonal} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{;} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)} + \PY{n}{x0}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{x1}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x0} + \PY{n}{x2}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x1} + \PY{n}{x3}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x2} + \PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{solution is converging to [3,\PYZhy{}2.5,7]]\PYZbs{}n\PYZsq{}}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ba = + + 2.6167 + -2.7571 + 7.1400 + +sA = + + 0.00000 -0.10000 -0.20000 + 0.10000 0.00000 -0.30000 + 0.30000 -0.20000 0.00000 + +sA = + + 0.000000 -0.033333 -0.066667 + 0.014286 0.000000 -0.042857 + 0.030000 -0.020000 0.000000 + +x1 = + + 2.6167 + -2.7571 + 7.1400 + +x2 = + + 3.0008 + -2.4885 + 7.0064 + +x3 = + + 3.0008 + -2.4997 + 7.0002 + +solution is converging to [3,-2.5,7]] + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}16}]:} \PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)} + \PY{n+nb}{diag}\PY{p}{(}\PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = + + 3 + 7 + 10 + +ans = + +Diagonal Matrix + + 3 0 0 + 0 7 0 + 0 0 10 + + + \end{Verbatim} + + This method works if problem is diagonally dominant, + +$|a_{ii}|>\sum_{j=1,j\ne i}^{n}|a_{ij}|$ + +If this condition is true, then Jacobi or Gauss-Seidel should converge + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}17}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mf}{0.1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mf}{0.2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{5}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mf}{0.3}\PY{p}{]} + \PY{n}{b}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{12}\PY{p}{;}\PY{l+m+mi}{2}\PY{p}{;}\PY{l+m+mi}{4}\PY{p}{]} + \PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{b} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 0.10000 1.00000 3.00000 + 1.00000 0.20000 3.00000 + 5.00000 2.00000 0.30000 + +b = + + 12 + 2 + 4 + +ans = + + -2.9393 + 9.1933 + 1.0336 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}20}]:} \PY{n}{ba}\PY{p}{=}\PY{n}{b}\PY{o}{./}\PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)} \PY{c}{\PYZpc{} or ba=b./[A(1,1);A(2,2);A(3,3)]} + \PY{n}{sA}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZhy{}}\PY{n+nb}{diag}\PY{p}{(}\PY{n+nb}{diag}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{)} \PY{c}{\PYZpc{} A with zeros on diagonal} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{;} + \PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{sA}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)} + \PY{n}{x0}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{;} + \PY{n}{x1}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x0} + \PY{n}{x2}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x1} + \PY{n}{x3}\PY{p}{=}\PY{n}{ba}\PY{o}{\PYZhy{}}\PY{n}{sA}\PY{o}{*}\PY{n}{x2} + \PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{solution is not converging to [\PYZhy{}2.93,9.19,1.03]\PYZbs{}n\PYZsq{}}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ba = + + 120.000 + 10.000 + 13.333 + +sA = + + 0 1 3 + 1 0 3 + 5 2 0 + +sA = + + 0.00000 10.00000 30.00000 + 5.00000 0.00000 15.00000 + 16.66667 6.66667 0.00000 + +x1 = + + 120.000 + 10.000 + 13.333 + +x2 = + + -380.00 + -790.00 + -2053.33 + +x3 = + + 6.9620e+04 + 3.2710e+04 + 1.1613e+04 + +solution is not converging to [-2.93,9.19,1.03] + + \end{Verbatim} + + \subsection{Gauss-Seidel with +Relaxation}\label{gauss-seidel-with-relaxation} + +In order to force the solution to converge faster, we can introduce a +relaxation term $\lambda$. + +where the new x values are weighted between the old and new: + +$x^{i}=\lambda x^{i}+(1-\lambda)x^{i-1}$ + +after solving for x, lambda weights the current approximation with the +previous approximation for the updated x + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}105}]:} \PY{c}{\PYZpc{} rearrange A and b} + \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{3} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.1} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.2}\PY{p}{;}\PY{l+m+mf}{0.1} \PY{l+m+mi}{7} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.3}\PY{p}{;}\PY{l+m+mf}{0.3} \PY{o}{\PYZhy{}}\PY{l+m+mf}{0.2} \PY{l+m+mi}{10}\PY{p}{]} + \PY{n}{b}\PY{p}{=}\PY{p}{[}\PY{l+m+mf}{7.85}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mf}{19.3}\PY{p}{;}\PY{l+m+mf}{71.4}\PY{p}{]} + + \PY{n}{iters}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{100}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100} + \PY{n}{lambda}\PY{p}{=}\PY{l+m+mi}{2}\PY{o}{/}\PY{l+m+mi}{100}\PY{o}{*}\PY{n}{i}\PY{p}{;} + \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{ea}\PY{p}{,}\PY{n}{iters}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{]}\PY{p}{=}\PY{n}{Jacobi\PYZus{}rel}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n}{b}\PY{p}{,}\PY{n}{lambda}\PY{p}{)}\PY{p}{;} + \PY{k}{end} + \PY{n+nb}{plot}\PY{p}{(}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}\PY{p}{]}\PY{o}{*}\PY{l+m+mi}{2}\PY{o}{/}\PY{l+m+mi}{100}\PY{p}{,}\PY{n}{iters}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 3.00000 -0.10000 -0.20000 + 0.10000 7.00000 -0.30000 + 0.30000 -0.20000 10.00000 + +b = + + 7.8500 + -19.3000 + 71.4000 + + + \end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_13_files/lecture_13_22_1.pdf} + \end{center} + { \hspace*{\fill} \\} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}107}]:} \PY{n}{l}\PY{p}{=}\PY{n}{fminbnd}\PY{p}{(}\PY{p}{@}\PY{p}{(}\PY{n}{l}\PY{p}{)} \PY{n}{lambda\PYZus{}fcn}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n}{b}\PY{p}{,}\PY{n}{l}\PY{p}{)}\PY{p}{,}\PY{l+m+mf}{0.5}\PY{p}{,}\PY{l+m+mf}{1.5}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +l = 0.99158 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}108}]:} \PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{b} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = + + 3.0000 + -2.5000 + 7.0000 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}109}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{ea}\PY{p}{,}\PY{n}{iter}\PY{p}{]}\PY{p}{=}\PY{n}{Jacobi\PYZus{}rel}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n}{b}\PY{p}{,}\PY{n}{l}\PY{p}{,}\PY{l+m+mf}{0.000001}\PY{p}{)} + \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{ea}\PY{p}{,}\PY{n}{iter}\PY{p}{]}\PY{p}{=}\PY{n}{Jacobi\PYZus{}rel}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n}{b}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mf}{0.000001}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +x = + + 3.0000 + -2.5000 + 7.0000 + +ea = + + 1.8289e-07 + 2.1984e-08 + 2.3864e-08 + +iter = 8 +x = + + 3.0000 + -2.5000 + 7.0000 + +ea = + + 1.9130e-08 + 7.6449e-08 + 3.3378e-08 + +iter = 8 + + \end{Verbatim} + + \subsection{Nonlinear Systems}\label{nonlinear-systems} + +Consider two simultaneous nonlinear equations with two unknowns: + +$x_{1}^{2}+x_{1}x_{2}=10$ + +$x_{2}+3x_{1}x_{2}^{2}=57$ + +Graphically, we are looking for the solution: + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}121}]:} \PY{n}{x11}\PY{p}{=}\PY{n+nb}{linspace}\PY{p}{(}\PY{l+m+mf}{0.5}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{;} + \PY{n}{x12}\PY{p}{=}\PY{p}{(}\PY{l+m+mi}{10}\PY{o}{\PYZhy{}}\PY{n}{x11}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{./}\PY{n}{x11}\PY{p}{;} + + \PY{n}{x22}\PY{p}{=}\PY{n+nb}{linspace}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{8}\PY{p}{)}\PY{p}{;} + \PY{n}{x21}\PY{p}{=}\PY{p}{(}\PY{l+m+mi}{57}\PY{o}{\PYZhy{}}\PY{n}{x22}\PY{p}{)}\PY{o}{.*}\PY{n}{x22}\PY{o}{.\PYZca{}}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{/}\PY{l+m+mi}{3}\PY{p}{;} + + \PY{n+nb}{plot}\PY{p}{(}\PY{n}{x11}\PY{p}{,}\PY{n}{x12}\PY{p}{,}\PY{n}{x21}\PY{p}{,}\PY{n}{x22}\PY{p}{)} + \PY{c}{\PYZpc{} Solution at x\PYZus{}1=2, x\PYZus{}2=3} + \PY{n+nb}{hold} \PY{n}{on}\PY{p}{;} + \PY{n+nb}{plot}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{o\PYZsq{}}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_13_files/lecture_13_27_0.pdf} + \end{center} + { \hspace*{\fill} \\} + + \subsection{Newton-Raphson part II}\label{newton-raphson-part-ii} + +Remember the first order approximation for the next point in a function +is: + +$f(x_{i+1})=f(x_{i})+(x_{i+1}-x_{i})f'(x_{i})$ + +then, $f(x_{i+1})=0$ so we are left with: + +$x_{i+1}=x_{i}-\frac{f(x_{i})}{f'(x_{i})}$ + +We can use the same formula, but now we have multiple dimensions so we +need to determine the Jacobian + +$[J]=\left[ \begin{array}{cccc} \frac{\partial f_{1,i}}{\partial x_{1}} & \frac{\partial f_{1,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{1,i}}{\partial x_{n}} \\ \frac{\partial f_{2,i}}{\partial x_{1}} & \frac{\partial f_{2,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{2,i}}{\partial x_{n}} \\ \vdots & \vdots & & \vdots \\ \frac{\partial f_{n,i}}{\partial x_{1}} & \frac{\partial f_{n,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{n,i}}{\partial x_{n}} \\ \end{array} \right]$ + +$\left[ \begin{array}{c} f_{1,i+1} \\ f_{2,i+1} \\ \vdots \\ f_{n,i+1}\end{array} \right]= \left[ \begin{array}{c} f_{1,i} \\ f_{2,i} \\ \vdots \\ f_{n,i}\end{array} \right]+ \left[ \begin{array}{cccc} \frac{\partial f_{1,i}}{\partial x_{1}} & \frac{\partial f_{1,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{1,i}}{\partial x_{n}} \\ \frac{\partial f_{2,i}}{\partial x_{1}} & \frac{\partial f_{2,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{2,i}}{\partial x_{n}} \\ \vdots & \vdots & & \vdots \\ \frac{\partial f_{n,i}}{\partial x_{1}} & \frac{\partial f_{n,i}}{\partial x_{2}} & \cdots & \frac{\partial f_{n,i}}{\partial x_{n}} \\ \end{array} \right] \left( \left[ \begin{array}{c} x_{i+1} \\ x_{i+1} \\ \vdots \\ x_{i+1}\end{array} \right]- \left[ \begin{array}{c} f_{1,i} \\ f_{2,i} \\ \vdots \\ f_{n,i}\end{array} \right]\right)$ + +\subsubsection{Solution is again in the form +Ax=b}\label{solution-is-again-in-the-form-axb} + +$[J]([x_{i+1}]-[x_{i}])=-[f]$ + +so + +$[x_{i+1}]= [x_{i}]-[J]^{-1}[f]$ + +\subsection{Example of Jacobian +calculation}\label{example-of-jacobian-calculation} + +\subsubsection{Nonlinear springs supporting two masses in +series}\label{nonlinear-springs-supporting-two-masses-in-series} + +Two springs are connected to two masses, with $m_1$=1 kg and +$m_{2}$=2 kg. The springs are identical, but they have nonlinear +spring constants, of $k_1$=10 N/m and $k_2$=-4 N/m + +We want to solve for the final position of the masses ($x_1$ and +$x_2$) + +$m_{1}g+k_{1}(x_{2}-x_{1})+k_{2}(x_{2}-x_{1})^{2}+k_{1}x_{1}+k_{2}x_{1}^{2}=0$ + +$m_{2}g-k_{1}(x_{2}-x_{1})-k_{2}(x_2-x_1)^{2}=0$ + +$J(1,1)=\frac{\partial f_{1}}{\partial x_{1}}=-k_{1}-2k_{2}(x_{2}-x_{1})+k_{1}+2k_{2}x_{1}$ + +$J(1,2)=\frac{\partial f_1}{\partial x_{2}}=k_{1}+2k_{2}(x_{2}-x_{1})$ + +$J(2,1)=\frac{\partial f_2}{\partial x_{1}}=k_{1}+2k_{2}(x_{2}-x_{1})$ + +$J(2,2)=\frac{\partial f_2}{\partial x_{2}}=-k_{1}-2k_{2}(x_{2}-x_{1})$ + +Use an initial guess of $x_1=x_2=0$ + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor} }]:} \PY{n}{m1}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} kg } + \PY{n}{m2}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;} \PY{c}{\PYZpc{} kg} + \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} + \PY{n}{k2}\PY{p}{=}\PY{o}{\PYZhy{}}\PY{l+m+mi}{4}\PY{p}{;} \PY{c}{\PYZpc{} N/m\PYZca{}2} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}214}]:} \PY{k}{function}\PY{+w}{ }[f,J]\PY{p}{=}\PY{n+nf}{mass\PYZus{}spring}\PY{p}{(}x\PY{p}{)} + \PY{+w}{ }\PY{c}{\PYZpc{} Function to calculate function values f1 and f2 as well as Jacobian } + \PY{c}{\PYZpc{} for 2 masses and 2 identical nonlinear springs} + \PY{n}{m1}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} kg } + \PY{n}{m2}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;} \PY{c}{\PYZpc{} kg} + \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{100}\PY{p}{;} \PY{c}{\PYZpc{} N/m} + \PY{n}{k2}\PY{p}{=}\PY{o}{\PYZhy{}}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m\PYZca{}2} + \PY{n}{g}\PY{p}{=}\PY{l+m+mf}{9.81}\PY{p}{;} \PY{c}{\PYZpc{} m/s\PYZca{}2} + \PY{n}{x1}\PY{p}{=}\PY{n}{x}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{x2}\PY{p}{=}\PY{n}{x}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{;} + \PY{n}{J}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{n}{k1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{k1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k2}\PY{o}{*}\PY{n}{x1}\PY{p}{,}\PY{n}{k1}\PY{o}{+}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{p}{;} + \PY{n}{k1}\PY{o}{+}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{n}{k1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{p}{]}\PY{p}{;} + \PY{n}{f}\PY{p}{=}\PY{p}{[}\PY{n}{m1}\PY{o}{*}\PY{n}{g}\PY{o}{+}\PY{n}{k1}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{+}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{k1}\PY{o}{*}\PY{n}{x1}\PY{o}{\PYZhy{}}\PY{n}{k2}\PY{o}{*}\PY{n}{x1}\PYZca{}\PY{l+m+mi}{2}\PY{p}{;} + \PY{n}{m2}\PY{o}{*}\PY{n}{g}\PY{o}{\PYZhy{}}\PY{n}{k1}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{\PYZhy{}}\PY{n}{k2}\PY{o}{*}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{.\PYZca{}}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} + \PY{k}{end} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}217}]:} \PY{p}{[}\PY{n}{f}\PY{p}{,}\PY{n}{J}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{]}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +f = + + -190.19 + 129.62 + +J = + + -200 120 + 120 -120 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}227}]:} \PY{n}{x0}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} + \PY{p}{[}\PY{n}{f0}\PY{p}{,}\PY{n}{J0}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{n}{x0}\PY{p}{)}\PY{p}{;} + \PY{n}{x1}\PY{p}{=}\PY{n}{x0}\PY{o}{\PYZhy{}}\PY{n}{J0}\PY{o}{\PYZbs{}}\PY{n}{f0} + \PY{n}{ea}\PY{p}{=}\PY{p}{(}\PY{n}{x1}\PY{o}{\PYZhy{}}\PY{n}{x0}\PY{p}{)}\PY{o}{./}\PY{n}{x1} + \PY{p}{[}\PY{n}{f1}\PY{p}{,}\PY{n}{J1}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{n}{x1}\PY{p}{)}\PY{p}{;} + \PY{n}{x2}\PY{p}{=}\PY{n}{x1}\PY{o}{\PYZhy{}}\PY{n}{J1}\PY{o}{\PYZbs{}}\PY{n}{f1} + \PY{n}{ea}\PY{p}{=}\PY{p}{(}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{x1}\PY{p}{)}\PY{o}{./}\PY{n}{x2} + \PY{p}{[}\PY{n}{f2}\PY{p}{,}\PY{n}{J2}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{n}{x2}\PY{p}{)}\PY{p}{;} + \PY{n}{x3}\PY{p}{=}\PY{n}{x2}\PY{o}{\PYZhy{}}\PY{n}{J2}\PY{o}{\PYZbs{}}\PY{n}{f2} + \PY{n}{ea}\PY{p}{=}\PY{p}{(}\PY{n}{x3}\PY{o}{\PYZhy{}}\PY{n}{x2}\PY{p}{)}\PY{o}{./}\PY{n}{x3} + \PY{n}{x}\PY{p}{=}\PY{n}{x3} + \PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{3} + \PY{n}{xold}\PY{p}{=}\PY{n}{x}\PY{p}{;} + \PY{p}{[}\PY{n}{f}\PY{p}{,}\PY{n}{J}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{;} + \PY{n}{x}\PY{p}{=}\PY{n}{x}\PY{o}{\PYZhy{}}\PY{n}{J}\PY{o}{\PYZbs{}}\PY{n}{f}\PY{p}{;} + \PY{n}{ea}\PY{p}{=}\PY{p}{(}\PY{n}{x}\PY{o}{\PYZhy{}}\PY{n}{xold}\PY{p}{)}\PY{o}{./}\PY{n}{x} + \PY{k}{end} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +x1 = + + -1.5142 + -1.4341 + +ea = + + 2.9812 + 2.3946 + +x2 = + + 0.049894 + 0.248638 + +ea = + + 31.3492 + 6.7678 + +x3 = + + 0.29701 + 0.49722 + +ea = + + 0.83201 + 0.49995 + +x = + + 0.29701 + 0.49722 + +ea = + + 0.021392 + 0.012890 + +ea = + + 1.4786e-05 + 8.9091e-06 + +ea = + + 7.0642e-12 + 4.2565e-12 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}228}]:} \PY{n}{x} + \PY{n}{X0}\PY{p}{=}\PY{n+nb}{fsolve}\PY{p}{(}\PY{p}{@}\PY{p}{(}\PY{n}{x}\PY{p}{)} \PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{n}{x}\PY{p}{)}\PY{p}{,}\PY{p}{[}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{5}\PY{p}{]}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +x = + + 0.30351 + 0.50372 + +X0 = + + 0.30351 + 0.50372 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}236}]:} \PY{p}{[}\PY{n}{X}\PY{p}{,}\PY{n}{Y}\PY{p}{]}\PY{p}{=}\PY{n+nb}{meshgrid}\PY{p}{(}\PY{n+nb}{linspace}\PY{p}{(}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{20}\PY{p}{)}\PY{p}{,}\PY{n+nb}{linspace}\PY{p}{(}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{20}\PY{p}{)}\PY{p}{)}\PY{p}{;} + \PY{p}{[}\PY{n}{N}\PY{p}{,}\PY{n}{M}\PY{p}{]}\PY{p}{=}\PY{n+nb}{size}\PY{p}{(}\PY{n}{X}\PY{p}{)}\PY{p}{;} + \PY{n}{F}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{n+nb}{size}\PY{p}{(}\PY{n}{X}\PY{p}{)}\PY{p}{)}\PY{p}{;} + \PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{n}{N} + \PY{k}{for} \PY{n}{j}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{n}{M} + \PY{p}{[}\PY{n}{f}\PY{p}{,}\PY{o}{\PYZti{}}\PY{p}{]}\PY{p}{=}\PY{n}{mass\PYZus{}spring}\PY{p}{(}\PY{p}{[}\PY{n}{X}\PY{p}{(}\PY{n}{i}\PY{p}{,}\PY{n}{j}\PY{p}{)}\PY{p}{,}\PY{n}{Y}\PY{p}{(}\PY{n}{i}\PY{p}{,}\PY{n}{j}\PY{p}{)}\PY{p}{]}\PY{p}{)}\PY{p}{;} + \PY{n}{F}\PY{p}{(}\PY{n}{i}\PY{p}{,}\PY{n}{j}\PY{p}{)}\PY{p}{=}\PY{n}{f}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{k}{end} + \PY{k}{end} + \PY{n+nb}{pcolor}\PY{p}{(}\PY{n}{X}\PY{p}{,}\PY{n}{Y}\PY{p}{,}\PY{n}{F}\PY{p}{)} + \PY{n+nb}{xlabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x\PYZus{}1\PYZsq{}}\PY{p}{)} + \PY{n+nb}{ylabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x\PYZus{}2\PYZsq{}}\PY{p}{)} + \PY{n+nb}{colorbar}\PY{p}{(}\PY{p}{)} + \PY{n+nb}{figure}\PY{p}{(}\PY{p}{)} + \PY{n+nb}{pcolor}\PY{p}{(}\PY{n}{X}\PY{p}{,}\PY{n}{Y}\PY{p}{,}\PY{n}{F}\PY{p}{)} + \PY{n+nb}{xlabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x\PYZus{}1\PYZsq{}}\PY{p}{)} + \PY{n+nb}{ylabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x\PYZus{}2\PYZsq{}}\PY{p}{)} + \PY{n+nb}{colorbar}\PY{p}{(}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_13_files/lecture_13_34_0.pdf} + \end{center} + { \hspace*{\fill} \\} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_13_files/lecture_13_34_1.pdf} + \end{center} + { \hspace*{\fill} \\} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor} }]:} +\end{Verbatim} + + + % Add a bibliography block to the postdoc + + + + \end{document} diff --git a/lecture_13/lecture_13_files/lecture_13_22_1.pdf b/lecture_13/lecture_13_files/lecture_13_22_1.pdf new file mode 100644 index 0000000..292be46 Binary files /dev/null and b/lecture_13/lecture_13_files/lecture_13_22_1.pdf differ diff --git a/lecture_13/lecture_13_files/lecture_13_22_1.svg b/lecture_13/lecture_13_files/lecture_13_22_1.svg new file mode 100644 index 0000000..c8482cc --- /dev/null +++ b/lecture_13/lecture_13_files/lecture_13_22_1.svg @@ -0,0 +1,121 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 10 + + + + + 20 + + + + + 30 + + + + + 40 + + + + + 50 + + + + + 0 + + + + + 0.5 + + + + + 1 + + + + + 1.5 + + + + + 2 + + + + + + + + + gnuplot_plot_1a + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_13/lecture_13_files/lecture_13_27_0.pdf b/lecture_13/lecture_13_files/lecture_13_27_0.pdf new file mode 100644 index 0000000..45aaf4e Binary files /dev/null and b/lecture_13/lecture_13_files/lecture_13_27_0.pdf differ diff --git a/lecture_13/lecture_13_files/lecture_13_27_0.svg b/lecture_13/lecture_13_files/lecture_13_27_0.svg new file mode 100644 index 0000000..acc1eeb --- /dev/null +++ b/lecture_13/lecture_13_files/lecture_13_27_0.svg @@ -0,0 +1,131 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 5 + + + + + 10 + + + + + 15 + + + + + 20 + + + + + 0 + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + + + gnuplot_plot_1a + + + + + + gnuplot_plot_2a + + + + gnuplot_plot_3a + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_13/lecture_13_files/lecture_13_34_0.pdf b/lecture_13/lecture_13_files/lecture_13_34_0.pdf new file mode 100644 index 0000000..d9bb774 Binary files /dev/null and b/lecture_13/lecture_13_files/lecture_13_34_0.pdf differ diff --git a/lecture_13/lecture_13_files/lecture_13_34_0.svg b/lecture_13/lecture_13_files/lecture_13_34_0.svg new file mode 100644 index 0000000..5163d90 --- /dev/null +++ b/lecture_13/lecture_13_files/lecture_13_34_0.svg @@ -0,0 +1,2040 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gnuplot_plot_1a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + 0.2 + + + + + + + + + 0.4 + + + + + + + + + 0.6 + + + + + + + + + 0.8 + + + + + + + + + 1 + + + + + + + + + + + 0 + + + + + + + + + 0.2 + + + + + + + + + 0.4 + + + + + + + + + 0.6 + + + + + + + + + 0.8 + + + + + + + + + 1 + + + + + x2 + + + + + + + + + + + + + + + + + + gnuplot_plot_1b + + + +; + + + + + + + -150 + + + + + -100 + + + + + -50 + + + + + 0 + + + + + 50 + + + + + 100 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_13/lecture_13_files/lecture_13_34_1.pdf b/lecture_13/lecture_13_files/lecture_13_34_1.pdf new file mode 100644 index 0000000..d9bb774 Binary files /dev/null and b/lecture_13/lecture_13_files/lecture_13_34_1.pdf differ diff --git a/lecture_13/lecture_13_files/lecture_13_34_1.svg b/lecture_13/lecture_13_files/lecture_13_34_1.svg new file mode 100644 index 0000000..5163d90 --- /dev/null +++ b/lecture_13/lecture_13_files/lecture_13_34_1.svg @@ -0,0 +1,2040 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gnuplot_plot_1a + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + + + + + 0.2 + + + + + + + + + 0.4 + + + + + + + + + 0.6 + + + + + + + + + 0.8 + + + + + + + + + 1 + + + + + + + + + + + 0 + + + + + + + + + 0.2 + + + + + + + + + 0.4 + + + + + + + + + 0.6 + + + + + + + + + 0.8 + + + + + + + + + 1 + + + + + x2 + + + + + + + + + + + + + + + + + + gnuplot_plot_1b + + + +; + + + + + + + -150 + + + + + -100 + + + + + -50 + + + + + 0 + + + + + 50 + + + + + 100 + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_13/nohup.out b/lecture_13/nohup.out new file mode 100644 index 0000000..ee0677e --- /dev/null +++ b/lecture_13/nohup.out @@ -0,0 +1,2 @@ + +(evince:3288): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -71 and height 20 diff --git a/lecture_13/norm_A.png b/lecture_13/norm_A.png new file mode 100644 index 0000000..5f2d273 Binary files /dev/null and b/lecture_13/norm_A.png differ diff --git a/lecture_13/octave-workspace b/lecture_13/octave-workspace new file mode 100644 index 0000000..8c437bb Binary files /dev/null and b/lecture_13/octave-workspace differ diff --git a/linear_algebra/LU_suggested.html b/linear_algebra/LU_suggested.html new file mode 100644 index 0000000..f1998e1 --- /dev/null +++ b/linear_algebra/LU_suggested.html @@ -0,0 +1,39 @@ + + + + + + + + + + + +

Linear Algebra Review

+

(Gauss Elimination) Suggested problems

+

No due date

+
    +
  1. Determine the lower (L) and upper (U) triangular matrices with LU-decomposition for the following matrices:

    +
      +
    1. \(A=\left[ \begin{array}{cc} 1 & 3 \\ 2 & 1 \end{array} \right]\)

    2. +
    3. \(A=\left[ \begin{array}{cc} 1 & 1 \\ 2 & 3 \end{array} \right]\)

    4. +
    5. \(A=\left[ \begin{array}{cc} 1 & 1 \\ 2 & -2 \end{array} \right]\)

    6. +
    7. \(A=\left[ \begin{array}{ccc} 1 & 3 & 1 \\ -4 & -9 & 2 \\ 0 & 3 & 6\end{array} \right]\)

    8. +
    9. \(A=\left[ \begin{array}{ccc} 1 & 3 & 1 \\ -4 & -9 & 2 \\ 0 & 3 & 6\end{array} \right]\)

    10. +
    11. \(A=\left[ \begin{array}{ccc} 1 & 3 & -5 \\ 1 & 4 & -8 \\ -3 & -7 & 9\end{array} \right]\)

    12. +
    13. \(A=\left[ \begin{array}{ccc} 1 & 2 & -1 \\ 2 & 2 & 2 \\ 1 & -1 & 2\end{array} \right]\)

    14. +
  2. +
  3. Calculate the determinant of A from 1a-g.

  4. +
  5. Determine the Cholesky factorization, C, of the following matrices, where

    +

    \(C_{ii}=\sqrt{a_{ii}-\sum_{k=1}^{i-1}C_{ki}^{2}}\)

    +

    \(C_{ij}=\frac{a_{ij}-\sum_{k=1}^{i-1}C_{ki}C_{kj}}{C_{ii}}\).

    +
      +
    1. A=\(\left[ \begin{array}{cc} 3 & 2 \\ 2 & 1 \end{array} \right]\)

    2. +
    3. A=\(\left[ \begin{array}{cc} 10 & 5 \\ 5 & 20 \end{array} \right]\)

    4. +
    5. A=\(\left[ \begin{array}{ccc} 10 & -10 & 20 \\ -10 & 20 & 10 \\ 20 & 10 & 30 \end{array} \right]\)

    6. +
    7. A=\(\left[ \begin{array}{cccc} 21 & -1 & 0 & 0 \\ -1 & 21 & -1 & 0 \\ 0 & -1 & 21 & -1 \\ 0 & 0 & -1 & 1 \end{array} \right]\)

    8. +
  6. +
  7. Verify that \(C^{T}C=A\) for 3a-d

  8. +
+ + diff --git a/linear_algebra/LU_suggested.md b/linear_algebra/LU_suggested.md new file mode 100644 index 0000000..f809813 --- /dev/null +++ b/linear_algebra/LU_suggested.md @@ -0,0 +1,68 @@ +# Linear Algebra Review +## (Gauss Elimination) Suggested problems +### No due date + +1. Determine the lower (L) and upper (U) triangular matrices with LU-decomposition for the +following matrices: + + a. $A=\left[ \begin{array}{cc} + 1 & 3 \\ + 2 & 1 \end{array} \right]$ + + a. $A=\left[ \begin{array}{cc} + 1 & 1 \\ + 2 & 3 \end{array} \right]$ + + a. $A=\left[ \begin{array}{cc} + 1 & 1 \\ + 2 & -2 \end{array} \right]$ + + b. $A=\left[ \begin{array}{ccc} + 1 & 3 & 1 \\ + -4 & -9 & 2 \\ + 0 & 3 & 6\end{array} \right]$ + + c. $A=\left[ \begin{array}{ccc} + 1 & 3 & 1 \\ + -4 & -9 & 2 \\ + 0 & 3 & 6\end{array} \right]$ + + d. $A=\left[ \begin{array}{ccc} + 1 & 3 & -5 \\ + 1 & 4 & -8 \\ + -3 & -7 & 9\end{array} \right]$ + + d. $A=\left[ \begin{array}{ccc} + 1 & 2 & -1 \\ + 2 & 2 & 2 \\ + 1 & -1 & 2\end{array} \right]$ + +2. Calculate the determinant of A from 1a-g. + +3. Determine the Cholesky factorization, C, of the following matrices, where + + $C_{ii}=\sqrt{a_{ii}-\sum_{k=1}^{i-1}C_{ki}^{2}}$ + + $C_{ij}=\frac{a_{ij}-\sum_{k=1}^{i-1}C_{ki}C_{kj}}{C_{ii}}$. + + a. A=$\left[ \begin{array}{cc} + 3 & 2 \\ + 2 & 1 \end{array} \right]$ + + a. A=$\left[ \begin{array}{cc} + 10 & 5 \\ + 5 & 20 \end{array} \right]$ + + a. A=$\left[ \begin{array}{ccc} + 10 & -10 & 20 \\ + -10 & 20 & 10 \\ + 20 & 10 & 30 \end{array} \right]$ + + a. A=$\left[ \begin{array}{cccc} + 21 & -1 & 0 & 0 \\ + -1 & 21 & -1 & 0 \\ + 0 & -1 & 21 & -1 \\ + 0 & 0 & -1 & 1 \end{array} \right]$ + +4. Verify that $C^{T}C=A$ for 3a-d +