diff --git a/HW4/README.md b/HW4/README.md new file mode 100644 index 0000000..7f04a9a --- /dev/null +++ b/HW4/README.md @@ -0,0 +1,37 @@ +# Homework #3 +## due 3/1/17 by 11:59pm + + +1. Use your repository 'roots_and_optimization'. Document all the HW4 work under the +heading `# Homework #4` in your `README.md` file + + a. Create a function called 'collar_potential_energy' that computes the total + potential energy of a collar connected to a spring and sliding on a rod. As shown in + the figure given a position, xc, and angle, theta: + + ![Collar-mass on an inclined rod](collar_mass.png) + + The spring is unstretched when x_C=0.5 m. The potential energy due to gravity is: + + PE_g=m x_C\*g\*sin(theta) + + where m=0.5 kg, and g is the acceleration due to gravity, + + and the potential energy due to the spring is: + + PE_s=1/2\*K \*(DL)^2 + + where DL = 0.5 - sqrt(0.5^2+(0.5-x_C)^2) and K=30 N/m. + + b. Use the `goldmin.m` function to solve for the minimum potential energy at xc when + theta=0. *create an anonymous function with `@(x) collar_potential_energy(x,theta)` in + the input for goldmin. Be sure to include the script that solves for xc* + + c. Create a for-loop that solves for the minimum potential energy position, xc, at a + given angle, theta, for theta = 0..90 degrees. + + d. Include a plot of xc vs theta. `plot(theta,xc)` with + + `![Steady-state position of collar on rod at angle theta](plot.png)` + +3. Commit your changes to your repository. Sync your local repository with github. diff --git a/HW4/collar_mass.png b/HW4/collar_mass.png new file mode 100644 index 0000000..f9b2836 Binary files /dev/null and b/HW4/collar_mass.png differ diff --git a/HW4/collar_mass.svg b/HW4/collar_mass.svg new file mode 100644 index 0000000..cc18c3d --- /dev/null +++ b/HW4/collar_mass.svg @@ -0,0 +1,270 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + xc + + + + + + + + 𝝷 + + + L0=0.5m + + diff --git a/lecture_10/lecture_10.aux b/lecture_10/lecture_10.aux index 14a6f0d..d8d4c62 100644 --- a/lecture_10/lecture_10.aux +++ b/lecture_10/lecture_10.aux @@ -28,13 +28,13 @@ \@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Springs-masses\relax }}{4}{figure.caption.1}} \@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Automate Gauss Elimination}{6}{subsection.1.2}} \newlabel{automate-gauss-elimination}{{1.2}{6}{Automate Gauss Elimination}{subsection.1.2}{}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Problem (Diagonal element is zero)}{6}{subsection.1.3}} -\newlabel{problem-diagonal-element-is-zero}{{1.3}{6}{Problem (Diagonal element is zero)}{subsection.1.3}{}} -\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.3.1}Spring-Mass System again}{8}{subsubsection.1.3.1}} -\newlabel{spring-mass-system-again}{{1.3.1}{8}{Spring-Mass System again}{subsubsection.1.3.1}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Problem (Diagonal element is zero)}{7}{subsection.1.3}} +\newlabel{problem-diagonal-element-is-zero}{{1.3}{7}{Problem (Diagonal element is zero)}{subsection.1.3}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.3.1}Spring-Mass System again}{9}{subsubsection.1.3.1}} +\newlabel{spring-mass-system-again}{{1.3.1}{9}{Spring-Mass System again}{subsubsection.1.3.1}{}} \@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces Springs-masses\relax }}{9}{figure.caption.2}} -\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}Tridiagonal matrix}{9}{subsection.1.4}} -\newlabel{tridiagonal-matrix}{{1.4}{9}{Tridiagonal matrix}{subsection.1.4}{}} \gdef \LT@i {\LT@entry - {2}{67.64778pt}\LT@entry + {2}{61.69104pt}\LT@entry {1}{261.39424pt}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}Tridiagonal matrix}{10}{subsection.1.4}} +\newlabel{tridiagonal-matrix}{{1.4}{10}{Tridiagonal matrix}{subsection.1.4}{}} diff --git a/lecture_10/lecture_10.ipynb b/lecture_10/lecture_10.ipynb index 78e529d..46d4f00 100644 --- a/lecture_10/lecture_10.ipynb +++ b/lecture_10/lecture_10.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": 14, + "execution_count": 1, "metadata": { "collapsed": true }, @@ -13,7 +13,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 2, "metadata": { "collapsed": true }, @@ -58,7 +58,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 3, "metadata": { "collapsed": false }, @@ -223,6 +223,30 @@ "plot(x11,x21,x21,x22)" ] }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans =\n", + "\n", + " 0.40000\n", + " 0.20000\n", + "\n" + ] + } + ], + "source": [ + "A=[1,3;2,1]; y=[1;1];\n", + "A\\y % matlab's Ax=y solution for x" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -251,20 +275,11 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "error: 'X22' undefined near line 1 column 16\n", - "error: 'X13' undefined near line 1 column 14\n", - "error: evaluating argument list element number 3\n" - ] - }, { "data": { "image/svg+xml": [ @@ -312,282 +327,357 @@ "\n", "\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-2\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-1.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-1\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-0.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t0\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t0.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t1\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t1.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t2\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-2\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-1.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-1\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t-0.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t0\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t0.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t1\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t1.5\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", "\n", - "\t\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t2\n", "\t\n", "\n", "\n", "\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t-6\n", + "\t\t\n", + "\t\t-30\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t-4\n", + "\t\t\n", + "\t\t-20\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t-2\n", + "\t\t\n", + "\t\t-10\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t0\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t2\n", + "\t\t\n", + "\t\t10\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t4\n", + "\t\t\n", + "\t\t20\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", + "\t\n", + "\n", + "\t\n", + "\n", + "\t\n", "\n", - "\t\t\n", - "\t\t6\n", + "\t\t\n", + "\t\t30\n", "\t\n", "\n", "\n", "\n", "\n", - "\t\n", - "\n", - "\t\t\n", - "\t\t8\n", + "\t\t\n", + "\t\tx3\n", "\t\n", "\n", "\n", "\n", - "\n", - "\t\n", "\tgnuplot_plot_1a\n", - "\n", + "\n", "\n", "\n", - "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\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n", - "\t\n", + "\t\t\n", + "\t\tx1\n", + "\t\n", + "\n", "\n", - "\t\n", + "\t\n", + "\t\tx2\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\tx3\n", + "\t\n", + "\n", "\n", - "\t\n", + "\n", "\n", "" ], @@ -600,18 +690,19 @@ } ], "source": [ - "x11=linspace(-2,2,5);\n", - "x12=linspace(-2,2,5);\n", + "N=25;\n", + "x11=linspace(-2,2,N);\n", + "x12=linspace(-2,2,N);\n", "[X11,X12]=meshgrid(x11,x12);\n", - "X13=1-10*X11-2*X22;\n", + "X13=1-10*X11-2*X12;\n", "\n", - "x21=linspace(-2,2,5);\n", - "x22=linspace(-2,2,5);\n", + "x21=linspace(-2,2,N);\n", + "x22=linspace(-2,2,N);\n", "[X21,X22]=meshgrid(x21,x22);\n", "X23=1-2*X11-X22;\n", "\n", - "x31=linspace(-2,2,5);\n", - "x32=linspace(-2,2,5);\n", + "x31=linspace(-2,2,N);\n", + "x32=linspace(-2,2,N);\n", "[X31,X32]=meshgrid(x31,x32);\n", "X33=1/10*(1-X31-2*X32);\n", "\n", @@ -621,7 +712,10 @@ "mesh(X31,X32,X33)\n", "x=[10,2, 1;2,1, 1; 1, 2, 10]\\[1;1;1];\n", "plot3(x(1),x(2),x(3),'o')\n", - "view(45,45)" + "xlabel('x1')\n", + "ylabel('x2')\n", + "zlabel('x3')\n", + "view(10,45)" ] }, { @@ -676,7 +770,7 @@ "\n", "then, $3/5x_{2}+4/5(-1/5)=1$ so $x_{2}=\\frac{8}{5}$\n", "\n", - "finally, $10x_{1}+2(8/5)" + "finally, $10x_{1}+2(8/5)+1(-\\frac{1}{5})=1$" ] }, { @@ -720,7 +814,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 10, "metadata": { "collapsed": false }, @@ -759,7 +853,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 11, "metadata": { "collapsed": false }, @@ -785,7 +879,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 12, "metadata": { "collapsed": false }, @@ -811,7 +905,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 13, "metadata": { "collapsed": false }, @@ -836,7 +930,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 14, "metadata": { "collapsed": false }, @@ -862,7 +956,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 15, "metadata": { "collapsed": false }, @@ -898,7 +992,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 16, "metadata": { "collapsed": false }, @@ -962,7 +1056,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 17, "metadata": { "collapsed": false }, @@ -1000,7 +1094,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 32, "metadata": { "collapsed": false }, @@ -1031,7 +1125,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 33, "metadata": { "collapsed": false }, @@ -1062,7 +1156,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 34, "metadata": { "collapsed": false }, @@ -1096,6 +1190,28 @@ "format short" ] }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans = -3.0000\n", + "ans = 3.0000\n" + ] + } + ], + "source": [ + "% determinant is (-1)^(number_of_pivots)*diagonal_elements\n", + "det(Ab)\n", + "Aug(1,1)*Aug(2,2)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -1138,7 +1254,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 24, "metadata": { "collapsed": false }, @@ -1211,13 +1327,13 @@ "\n", "|method |Number of Floating point operations for n$\\times$n-matrix|\n", "|----------------|---------|\n", - "| Naive Gauss | n-cubed |\n", + "| Gauss | n-cubed |\n", "| Tridiagonal | n |" ] }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 25, "metadata": { "collapsed": false }, @@ -1229,6 +1345,13 @@ "ans =\n", "\n", " 9.8100 27.4680 61.8030 101.0430\n", + "\n", + "ans =\n", + "\n", + " 9.8100\n", + " 27.4680\n", + " 61.8030\n", + " 101.0430\n", "\n" ] } @@ -1237,12 +1360,13 @@ "e=[0;-5;-2;-1];\n", "g=[-5;-2;-1;0];\n", "f=[15;7;3;1];\n", - "Tridiag(e,f,g,y)\n" + "Tridiag(e,f,g,y)\n", + "K\\y\n" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 26, "metadata": { "collapsed": true }, @@ -1265,7 +1389,7 @@ " x = GaussPivot(A,b);\n", " t_GE(n) = toc;\n", " tic;\n", - " x = GaussPivot(Atd,b);\n", + " x = A\\b;\n", " t_GE_tridiag(n) = toc;\n", " tic;\n", " x = Tridiag(e,f,g,b);\n", @@ -1275,7 +1399,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 28, "metadata": { "collapsed": false }, @@ -1329,26 +1453,31 @@ "\n", "\n", "\t\t\n", + "\t\t10-5\n", + "\t\n", + "\n", + "\n", + "\t\t\n", "\t\t10-4\n", "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t10-3\n", "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t10-2\n", "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t10-1\n", "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t100\n", "\t\n", "\n", @@ -1358,21 +1487,16 @@ "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t101\n", "\t\n", "\n", "\n", - "\t\t\n", + "\t\t\n", "\t\t102\n", "\t\n", "\n", "\n", - "\t\t\n", - "\t\t103\n", - "\t\n", - "\n", - "\n", "\n", "\n", "\t\n", @@ -1388,19 +1512,38 @@ "\n", "\n", "\n", - "\tgnuplot_plot_1a\n", - "\n", + "\n", + "\n", + "\n", + "\t\n", + "\tGauss elim\n", + "\n", "\n", "\n", - "\t\n", + "\t\n", + "\t\tGauss elim\n", "\t\n", - "\tgnuplot_plot_2a\n", + "\n", "\n", - "\t\n", + "\t\n", "\t\n", - "\tgnuplot_plot_3a\n", + "\tMatlab \\\n", + "\n", + "\t\n", + "\t\tMatlab \n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\tTriDiag\n", "\n", - "\t\n", + "\t\n", + "\t\tTriDiag\n", + "\t\n", + "\n", + "\n", + "\t\n", "\t\n", "\n", "\n", @@ -1422,12 +1565,92 @@ } ], "source": [ - "n=1:200;\n", + "n=1:100;\n", "loglog(n,t_GE,n,t_TD,n,t_GE_tridiag)\n", + "legend('Gauss elim','Matlab \\','TriDiag')\n", "xlabel('number of elements')\n", "ylabel('time (s)')" ] }, + { + "cell_type": "code", + "execution_count": 29, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "x =\n", + "\n", + " 9.8100\n", + " 27.4680\n", + " 61.8030\n", + " 101.0430\n", + "\n", + "Aug =\n", + "\n", + " 15.00000 -5.00000 0.00000 0.00000 9.81000\n", + " 0.00000 5.33333 -2.00000 0.00000 22.89000\n", + " 0.00000 0.00000 2.25000 -1.00000 38.01375\n", + " 0.00000 0.00000 0.00000 0.55556 56.13500\n", + "\n", + "npivots = 0\n" + ] + } + ], + "source": [ + "[x,Aug,npivots]=GaussPivot(K,y)" + ] + }, + { + "cell_type": "code", + "execution_count": 30, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 15.00000 -5.00000 0.00000 0.00000\n", + " 0.00000 5.33333 -2.00000 0.00000\n", + " 0.00000 0.00000 2.25000 -1.00000\n", + " 0.00000 0.00000 0.00000 0.55556\n", + "\n" + ] + } + ], + "source": [ + "A=Aug(1:4,1:4)" + ] + }, + { + "cell_type": "code", + "execution_count": 31, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans = 100.00\n", + "detA = 100.00\n" + ] + } + ], + "source": [ + "det(A)\n", + "detA=A(1,1)*A(2,2)*A(3,3)*A(4,4)" + ] + }, { "cell_type": "code", "execution_count": null, diff --git a/lecture_10/lecture_10.log b/lecture_10/lecture_10.log index 088d911..9e3113d 100644 --- a/lecture_10/lecture_10.log +++ b/lecture_10/lecture_10.log @@ -1,4 +1,4 @@ -This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.1.11) 20 FEB 2017 17:21 +This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.1.11) 21 FEB 2017 11:46 entering extended mode restricted \write18 enabled. %&-line parsing enabled. @@ -772,28 +772,27 @@ Underfull \hbox (badness 10000) in paragraph at lines 323--324 [] -[2 <./lecture_10_files/lecture_10_3_0.pdf>] -LaTeX Font Info: Try loading font information for TS1+cmtt on input line 359 +LaTeX Font Info: Try loading font information for TS1+cmtt on input line 327 . - (/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmtt.fd File: ts1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions -) - -File: lecture_10_files/lecture_10_5_1.pdf Graphic file (type pdf) +) [2 <./lecture_10_files/lecture_10_3_0.pdf>] + +File: lecture_10_files/lecture_10_6_0.pdf Graphic file (type pdf) - -Package pdftex.def Info: lecture_10_files/lecture_10_5_1.pdf used on input line - 371. + +Package pdftex.def Info: lecture_10_files/lecture_10_6_0.pdf used on input line + 382. (pdftex.def) Requested size: 449.6789pt x 337.25917pt. -Underfull \hbox (badness 10000) in paragraph at lines 373--374 +Underfull \hbox (badness 10000) in paragraph at lines 384--385 [] +[3 <./lecture_10_files/lecture_10_6_0.pdf>] 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 378. -[3 <./lecture_10_files/lecture_10_5_1.pdf>] +(Font) Font shape `T1/ppl/b/n' tried instead on input line 389. + ! LaTeX Error: Unknown graphics extension: .svg. @@ -801,10 +800,10 @@ See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... -l.433 ...egraphics{../lecture_09/mass_springs.svg} +l.444 ...egraphics{../lecture_09/mass_springs.svg} ? -[4] [5] [6] [7] +[4] [5] [6] [7] [8] ! LaTeX Error: Unknown graphics extension: .svg. @@ -812,45 +811,45 @@ See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ... -l.712 ...egraphics{../lecture_09/mass_springs.svg} +l.735 ...egraphics{../lecture_09/mass_springs.svg} ? -[8] [9] +[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 812. - [10] - -File: lecture_10_files/lecture_10_27_0.pdf Graphic file (type pdf) - - -Package pdftex.def Info: lecture_10_files/lecture_10_27_0.pdf used on input lin -e 839. -(pdftex.def) Requested size: 449.6789pt x 337.25917pt. +(Font) Font shape `T1/cmtt/m/n' tried instead on input line 843. + +File: lecture_10_files/lecture_10_29_0.pdf Graphic file (type pdf) -Underfull \hbox (badness 10000) in paragraph at lines 841--842 + +Package pdftex.def Info: lecture_10_files/lecture_10_29_0.pdf used on input lin +e 871. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [11] +Underfull \hbox (badness 10000) in paragraph at lines 873--874 [] -Package atveryend Info: Empty hook `BeforeClearDocument' on input line 852. -[11 <./lecture_10_files/lecture_10_27_0.pdf>] -Package atveryend Info: Empty hook `AfterLastShipout' on input line 852. +[12 <./lecture_10_files/lecture_10_29_0.pdf>] +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 933. + [13] +Package atveryend Info: Empty hook `AfterLastShipout' on input line 933. (./lecture_10.aux) -Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 852. -Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 852. +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 933. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 933. Package rerunfilecheck Info: File `lecture_10.out' has not changed. (rerunfilecheck) Checksum: F41F49C8B1F4406369908EBDD24F2572;629. LaTeX Warning: There were multiply-defined labels. -Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 852. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 933. ) Here is how much of TeX's memory you used: - 10939 strings out of 493029 - 163764 string characters out of 6136234 - 273062 words of memory out of 5000000 - 14225 multiletter control sequences out of 15000+600000 - 35480 words of font info for 90 fonts, out of 8000000 for 9000 + 10943 strings out of 493029 + 163805 string characters out of 6136234 + 273063 words of memory out of 5000000 + 14226 multiletter control sequences out of 15000+600000 + 35779 words of font info for 91 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 36i,8n,77p,494b,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 @@ -863,10 +862,10 @@ fb> -Output written on lecture_10.pdf (11 pages, 162693 bytes). +Output written on lecture_10.pdf (13 pages, 190161 bytes). PDF statistics: - 165 PDF objects out of 1000 (max. 8388607) - 133 compressed objects within 2 object streams - 27 named destinations out of 1000 (max. 500000) + 176 PDF objects out of 1000 (max. 8388607) + 142 compressed objects within 2 object streams + 29 named destinations out of 1000 (max. 500000) 80 words of extra memory for PDF output out of 10000 (max. 10000000) diff --git a/lecture_10/lecture_10.pdf b/lecture_10/lecture_10.pdf index 447bbe2..d75909f 100644 Binary files a/lecture_10/lecture_10.pdf and b/lecture_10/lecture_10.pdf differ diff --git a/lecture_10/lecture_10.tex b/lecture_10/lecture_10.tex index 1131881..633c945 100644 --- a/lecture_10/lecture_10.tex +++ b/lecture_10/lecture_10.tex @@ -277,11 +277,11 @@ \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}14}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg} +{\color{incolor}In [{\color{incolor}1}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}15}]:} \PY{n}{setdefaults} +{\color{incolor}In [{\color{incolor}2}]:} \PY{n}{setdefaults} \end{Verbatim} \section{Gauss Elimination}\label{gauss-elimination} @@ -310,11 +310,11 @@ \subsubsection{Solving sets of equations with matrix lines: \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}16}]:} \PY{n}{x21}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} - \PY{n}{x11}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{x21}\PY{p}{;} - \PY{n}{x21}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} - \PY{n}{x22}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{x21}\PY{p}{;} - \PY{n+nb}{plot}\PY{p}{(}\PY{n}{x11}\PY{p}{,}\PY{n}{x21}\PY{p}{,}\PY{n}{x21}\PY{p}{,}\PY{n}{x22}\PY{p}{)} +{\color{incolor}In [{\color{incolor}3}]:} \PY{n}{x21}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} + \PY{n}{x11}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{o}{*}\PY{n}{x21}\PY{p}{;} + \PY{n}{x21}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{:}\PY{l+m+mi}{2}\PY{p}{]}\PY{p}{;} + \PY{n}{x22}\PY{p}{=}\PY{l+m+mi}{1}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{o}{*}\PY{n}{x21}\PY{p}{;} + \PY{n+nb}{plot}\PY{p}{(}\PY{n}{x11}\PY{p}{,}\PY{n}{x21}\PY{p}{,}\PY{n}{x21}\PY{p}{,}\PY{n}{x22}\PY{p}{)} \end{Verbatim} \begin{center} @@ -322,7 +322,21 @@ \subsubsection{Solving sets of equations with matrix \end{center} { \hspace*{\fill} \\} - For a $3\times3$ matrix, the solution is the intersection of the 3 + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}4}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} \PY{n}{y}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} + \PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{y} \PY{c}{\PYZpc{} matlab\PYZsq{}s Ax=y solution for x} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = + + 0.40000 + 0.20000 + + + \end{Verbatim} + + For a \(3\times3\) matrix, the solution is the intersection of the 3 planes. \(10x_{1}+2x_{2}+x_{3}=1\) @@ -331,44 +345,41 @@ \subsubsection{Solving sets of equations with matrix \(x_{1}+2x_{2}+10x_{3}=1\) -$\left[ \begin{array}{ccc} 10 & 2 & 1 \\ 2 & 1 & 1 \\ 1 & 2 & 10\end{array} \right] +$\left[ \begin{array}{ccc} 10 & 2 & 1\\ 2 & 1 & 1 \\ 1 & 2 & 10\end{array} \right] \left[\begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \end{array}\right]= \left[\begin{array}{c} 1 \\ 1 \\ 1\end{array}\right]$ \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}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l+s}{\PYZsq{}}\PY{l+s}{x1\PYZsq{}}\PY{p}{)} + \PY{n+nb}{ylabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x2\PYZsq{}}\PY{p}{)} + \PY{n+nb}{zlabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{x3\PYZsq{}}\PY{p}{)} + \PY{n+nb}{view}\PY{p}{(}\PY{l+m+mi}{10}\PY{p}{,}\PY{l+m+mi}{45}\PY{p}{)} \end{Verbatim} - \begin{Verbatim}[commandchars=\\\{\}] -error: 'X22' undefined near line 1 column 16 -error: 'X13' undefined near line 1 column 14 -error: evaluating argument list element number 3 - - \end{Verbatim} - \begin{center} - \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_10_files/lecture_10_5_1.pdf} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_10_files/lecture_10_6_0.pdf} \end{center} { \hspace*{\fill} \\} @@ -416,13 +427,13 @@ \subsubsection{Solving sets of equations 10 & 2 & 1 & 1\\ 0 & 3/5 & 4/5 & 4/5 \\ 0 & 0 & 7.5 & -1.5\end{array} -\right] $ +\right]$ now, \(7.5x_{3}=-1.5\) so \(x_{3}=-\frac{1}{5}\) then, \(3/5x_{2}+4/5(-1/5)=1\) so \(x_{2}=\frac{8}{5}\) -finally, \$10x\_\{1\}+2(8/5) +finally, \(10x_{1}+2(8/5)+1(-\frac{1}{5})=1\) Consider the problem again from the intro to Linear Algebra, 4 masses are connected in series to 4 springs with K=10 N/m. What are the final @@ -450,7 +461,7 @@ \subsubsection{Solving sets of equations \(\left[ \begin{array}{cccc} 2k & -k & 0 & 0 \\ -k & 2k & -k & 0 \\ 0 & -k & 2k & -k \\ 0 & 0 & -k & k \end{array} \right] \left[ \begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array} \right]= \left[ \begin{array}{c} m_{1}g \\ m_{2}g \\ m_{3}g \\ m_{4}g \end{array} \right]\) \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}18}]:} \PY{n}{k}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} +{\color{incolor}In [{\color{incolor}10}]:} \PY{n}{k}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} \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}{;} @@ -479,7 +490,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}19}]:} \PY{n}{K1}\PY{p}{=}\PY{p}{[}\PY{n}{K} \PY{n}{y}\PY{p}{]}\PY{p}{;} +{\color{incolor}In [{\color{incolor}11}]:} \PY{n}{K1}\PY{p}{=}\PY{p}{[}\PY{n}{K} \PY{n}{y}\PY{p}{]}\PY{p}{;} \PY{n}{K1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{p}{=}\PY{n}{K1}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{p}{:}\PY{p}{)}\PY{o}{/}\PY{l+m+mi}{2}\PY{o}{+}\PY{n}{K1}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{p}{:}\PY{p}{)} \end{Verbatim} @@ -495,7 +506,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}20}]:} \PY{n}{K2}\PY{p}{=}\PY{n}{K1}\PY{p}{;} +{\color{incolor}In [{\color{incolor}12}]:} \PY{n}{K2}\PY{p}{=}\PY{n}{K1}\PY{p}{;} \PY{n}{K2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY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}\PY{p}{:}\PY{p}{)} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] @@ -526,7 +537,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}22}]:} \PY{n}{yp}\PY{p}{=}\PY{n}{K2}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{5}\PY{p}{)}\PY{p}{;} +{\color{incolor}In [{\color{incolor}14}]:} \PY{n}{yp}\PY{p}{=}\PY{n}{K2}\PY{p}{(}\PY{p}{:}\PY{p}{,}\PY{l+m+mi}{5}\PY{p}{)}\PY{p}{;} \PY{n}{x4}\PY{p}{=}\PY{n}{yp}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{)}\PY{o}{/}\PY{n}{K2}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)} \PY{n}{x3}\PY{p}{=}\PY{p}{(}\PY{n}{yp}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{+}\PY{l+m+mi}{10}\PY{o}{*}\PY{n}{x4}\PY{p}{)}\PY{o}{/}\PY{n}{K2}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)} \PY{n}{x2}\PY{p}{=}\PY{p}{(}\PY{n}{yp}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{+}\PY{l+m+mi}{10}\PY{o}{*}\PY{n}{x3}\PY{p}{)}\PY{o}{/}\PY{n}{K2}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)} @@ -542,7 +553,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}23}]:} \PY{n}{K}\PY{o}{\PYZbs{}}\PY{n}{y} +{\color{incolor}In [{\color{incolor}15}]:} \PY{n}{K}\PY{o}{\PYZbs{}}\PY{n}{y} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] @@ -565,7 +576,7 @@ \subsubsection{Solving sets of equations \texttt{x=GaussNaive(A,y)} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}24}]:} \PY{n}{x}\PY{p}{=}\PY{n}{GaussNaive}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{n}{y}\PY{p}{)} +{\color{incolor}In [{\color{incolor}16}]:} \PY{n}{x}\PY{p}{=}\PY{n}{GaussNaive}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{n}{y}\PY{p}{)} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] @@ -606,7 +617,7 @@ \subsubsection{Solving sets of equations \end{enumerate} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}25}]:} \PY{n}{format} \PY{n}{short} +{\color{incolor}In [{\color{incolor}17}]:} \PY{n}{format} \PY{n}{short} \PY{n}{Aa}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{6}\PY{p}{,}\PY{l+m+mi}{7}\PY{p}{;}\PY{l+m+mi}{2}\PY{p}{,}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{6}\PY{p}{]}\PY{p}{;} \PY{n}{ya}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{8}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{5}\PY{p}{]}\PY{p}{;} \PY{n}{GaussNaive}\PY{p}{(}\PY{n}{Aa}\PY{p}{,}\PY{n}{ya}\PY{p}{)} \PY{n}{Aa}\PY{o}{\PYZbs{}}\PY{n}{ya} @@ -634,7 +645,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}26}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{Aug}\PY{p}{,}\PY{n}{npivots}\PY{p}{]}\PY{p}{=}\PY{n}{GaussPivot}\PY{p}{(}\PY{n}{Aa}\PY{p}{,}\PY{n}{ya}\PY{p}{)} +{\color{incolor}In [{\color{incolor}32}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{Aug}\PY{p}{,}\PY{n}{npivots}\PY{p}{]}\PY{p}{=}\PY{n}{GaussPivot}\PY{p}{(}\PY{n}{Aa}\PY{p}{,}\PY{n}{ya}\PY{p}{)} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] @@ -655,7 +666,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}27}]:} \PY{n}{format} \PY{n}{long} +{\color{incolor}In [{\color{incolor}33}]:} \PY{n}{format} \PY{n}{long} \PY{n}{Ab}\PY{p}{=}\PY{p}{[}\PY{l+m+mf}{0.3E\PYZhy{}13}\PY{p}{,}\PY{l+m+mf}{3.0000}\PY{p}{;}\PY{l+m+mf}{1.0000}\PY{p}{,}\PY{l+m+mf}{1.0000}\PY{p}{]}\PY{p}{;}\PY{n}{yb}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{o}{+}\PY{l+m+mf}{0.1e\PYZhy{}13}\PY{p}{;}\PY{l+m+mf}{1.0000}\PY{p}{]}\PY{p}{;} \PY{n}{GaussNaive}\PY{p}{(}\PY{n}{Ab}\PY{p}{,}\PY{n}{yb}\PY{p}{)} \PY{n}{Ab}\PY{o}{\PYZbs{}}\PY{n}{yb} @@ -676,7 +687,7 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}28}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{Aug}\PY{p}{,}\PY{n}{npivots}\PY{p}{]}\PY{p}{=}\PY{n}{GaussPivot}\PY{p}{(}\PY{n}{Ab}\PY{p}{,}\PY{n}{yb}\PY{p}{)} +{\color{incolor}In [{\color{incolor}34}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{Aug}\PY{p}{,}\PY{n}{npivots}\PY{p}{]}\PY{p}{=}\PY{n}{GaussPivot}\PY{p}{(}\PY{n}{Ab}\PY{p}{,}\PY{n}{yb}\PY{p}{)} \PY{n}{Ab}\PY{o}{\PYZbs{}}\PY{n}{yb} \PY{n}{format} \PY{n}{short} \end{Verbatim} @@ -699,6 +710,18 @@ \subsubsection{Solving sets of equations 0.666666666666667 + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}36}]:} \PY{c}{\PYZpc{} determinant is (\PYZhy{}1)\PYZca{}(number\PYZus{}of\PYZus{}pivots)*diagonal\PYZus{}elements} + \PY{n+nb}{det}\PY{p}{(}\PY{n}{Ab}\PY{p}{)} + \PY{n}{Aug}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{Aug}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = -3.0000 +ans = 3.0000 + \end{Verbatim} \subsubsection{Spring-Mass System again}\label{spring-mass-system-again} @@ -729,7 +752,7 @@ \subsubsection{Solving sets of equations \(\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}29}]:} \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{n}{k2}\PY{p}{=}\PY{l+m+mi}{5}\PY{p}{;}\PY{n}{k3}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;}\PY{n}{k4}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} N/m} +{\color{incolor}In [{\color{incolor}24}]:} \PY{n}{k1}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{n}{k2}\PY{p}{=}\PY{l+m+mi}{5}\PY{p}{;}\PY{n}{k3}\PY{p}{=}\PY{l+m+mi}{2}\PY{p}{;}\PY{n}{k4}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{;} \PY{c}{\PYZpc{} N/m} \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}{;} @@ -782,16 +805,17 @@ \subsubsection{Solving sets of equations n\(\times\)n-matrix\tabularnewline \midrule \endhead -Naive Gauss & n-cubed\tabularnewline +Gauss & n-cubed\tabularnewline Tridiagonal & n\tabularnewline \bottomrule \end{longtable} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}30}]:} \PY{n+nb}{e}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{5}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} +{\color{incolor}In [{\color{incolor}25}]:} \PY{n+nb}{e}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{0}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{5}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{2}\PY{p}{;}\PY{o}{\PYZhy{}}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} \PY{n}{g}\PY{p}{=}\PY{p}{[}\PY{o}{\PYZhy{}}\PY{l+m+mi}{5}\PY{p}{;}\PY{o}{\PYZhy{}}\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{p}{;} \PY{n}{f}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{15}\PY{p}{;}\PY{l+m+mi}{7}\PY{p}{;}\PY{l+m+mi}{3}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{]}\PY{p}{;} \PY{n}{Tridiag}\PY{p}{(}\PY{n+nb}{e}\PY{p}{,}\PY{n}{f}\PY{p}{,}\PY{n}{g}\PY{p}{,}\PY{n}{y}\PY{p}{)} + \PY{n}{K}\PY{o}{\PYZbs{}}\PY{n}{y} \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] @@ -799,11 +823,18 @@ \subsubsection{Solving sets of equations 9.8100 27.4680 61.8030 101.0430 +ans = + + 9.8100 + 27.4680 + 61.8030 + 101.0430 + \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}12}]:} \PY{c}{\PYZpc{} tic ... t=toc } +{\color{incolor}In [{\color{incolor}26}]:} \PY{c}{\PYZpc{} tic ... t=toc } \PY{c}{\PYZpc{} is Matlab timer used for debugging programs} \PY{n}{t\PYZus{}GE} \PY{p}{=} \PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{100}\PY{p}{)}\PY{p}{;} \PY{n}{t\PYZus{}GE\PYZus{}tridiag} \PY{p}{=} \PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{100}\PY{p}{)}\PY{p}{;} @@ -820,7 +851,7 @@ \subsubsection{Solving sets of equations \PY{n}{x} \PY{p}{=} \PY{n}{GaussPivot}\PY{p}{(}\PY{n}{A}\PY{p}{,}\PY{n}{b}\PY{p}{)}\PY{p}{;} \PY{n}{t\PYZus{}GE}\PY{p}{(}\PY{n}{n}\PY{p}{)} \PY{p}{=} \PY{n+nb}{toc}\PY{p}{;} \PY{n+nb}{tic}\PY{p}{;} - \PY{n}{x} \PY{p}{=} \PY{n}{GaussPivot}\PY{p}{(}\PY{n}{Atd}\PY{p}{,}\PY{n}{b}\PY{p}{)}\PY{p}{;} + \PY{n}{x} \PY{p}{=} \PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{b}\PY{p}{;} \PY{n}{t\PYZus{}GE\PYZus{}tridiag}\PY{p}{(}\PY{n}{n}\PY{p}{)} \PY{p}{=} \PY{n+nb}{toc}\PY{p}{;} \PY{n+nb}{tic}\PY{p}{;} \PY{n}{x} \PY{p}{=} \PY{n}{Tridiag}\PY{p}{(}\PY{n+nb}{e}\PY{p}{,}\PY{n}{f}\PY{p}{,}\PY{n}{g}\PY{p}{,}\PY{n}{b}\PY{p}{)}\PY{p}{;} @@ -829,17 +860,67 @@ \subsubsection{Solving sets of equations \end{Verbatim} \begin{Verbatim}[commandchars=\\\{\}] -{\color{incolor}In [{\color{incolor}13}]:} \PY{n}{n}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{200}\PY{p}{;} +{\color{incolor}In [{\color{incolor}28}]:} \PY{n}{n}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}\PY{p}{;} \PY{n+nb}{loglog}\PY{p}{(}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}GE}\PY{p}{,}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}TD}\PY{p}{,}\PY{n}{n}\PY{p}{,}\PY{n}{t\PYZus{}GE\PYZus{}tridiag}\PY{p}{)} + \PY{n+nb}{legend}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{Gauss elim\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{Matlab \PYZbs{}\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{TriDiag\PYZsq{}}\PY{p}{)} \PY{n+nb}{xlabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{number of elements\PYZsq{}}\PY{p}{)} \PY{n+nb}{ylabel}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{time (s)\PYZsq{}}\PY{p}{)} \end{Verbatim} \begin{center} - \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_10_files/lecture_10_27_0.pdf} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_10_files/lecture_10_29_0.pdf} \end{center} { \hspace*{\fill} \\} + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}29}]:} \PY{p}{[}\PY{n}{x}\PY{p}{,}\PY{n}{Aug}\PY{p}{,}\PY{n}{npivots}\PY{p}{]}\PY{p}{=}\PY{n}{GaussPivot}\PY{p}{(}\PY{n}{K}\PY{p}{,}\PY{n}{y}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +x = + + 9.8100 + 27.4680 + 61.8030 + 101.0430 + +Aug = + + 15.00000 -5.00000 0.00000 0.00000 9.81000 + 0.00000 5.33333 -2.00000 0.00000 22.89000 + 0.00000 0.00000 2.25000 -1.00000 38.01375 + 0.00000 0.00000 0.00000 0.55556 56.13500 + +npivots = 0 + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}30}]:} \PY{n}{A}\PY{p}{=}\PY{n}{Aug}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{4}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 15.00000 -5.00000 0.00000 0.00000 + 0.00000 5.33333 -2.00000 0.00000 + 0.00000 0.00000 2.25000 -1.00000 + 0.00000 0.00000 0.00000 0.55556 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}31}]:} \PY{n+nb}{det}\PY{p}{(}\PY{n}{A}\PY{p}{)} + \PY{n}{detA}\PY{p}{=}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{o}{*}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{o}{*}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{3}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{o}{*}\PY{n}{A}\PY{p}{(}\PY{l+m+mi}{4}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = 100.00 +detA = 100.00 + + \end{Verbatim} + \begin{Verbatim}[commandchars=\\\{\}] {\color{incolor}In [{\color{incolor} }]:} \end{Verbatim} diff --git a/lecture_10/lecture_10_files/lecture_10_29_0.pdf b/lecture_10/lecture_10_files/lecture_10_29_0.pdf new file mode 100644 index 0000000..20bdd51 Binary files /dev/null and b/lecture_10/lecture_10_files/lecture_10_29_0.pdf differ diff --git a/lecture_10/lecture_10_files/lecture_10_29_0.svg b/lecture_10/lecture_10_files/lecture_10_29_0.svg new file mode 100644 index 0000000..eb8af2c --- /dev/null +++ b/lecture_10/lecture_10_files/lecture_10_29_0.svg @@ -0,0 +1,148 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 10-5 + + + + + 10-4 + + + + + 10-3 + + + + + 10-2 + + + + + 10-1 + + + + + 100 + + + + + 100 + + + + + 101 + + + + + 102 + + + + + + + + + time (s) + + + + + number of elements + + + + + + + + + Gauss elim + + + + + Gauss elim + + + + + + Matlab \ + + + Matlab + + + + + + TriDiag + + + TriDiag + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_10/lecture_10_files/lecture_10_6_0.pdf b/lecture_10/lecture_10_files/lecture_10_6_0.pdf new file mode 100644 index 0000000..53b6aa0 Binary files /dev/null and b/lecture_10/lecture_10_files/lecture_10_6_0.pdf differ diff --git a/lecture_10/lecture_10_files/lecture_10_6_0.svg b/lecture_10/lecture_10_files/lecture_10_6_0.svg new file mode 100644 index 0000000..73465c0 --- /dev/null +++ b/lecture_10/lecture_10_files/lecture_10_6_0.svg @@ -0,0 +1,397 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -2 + + + + + + + + + + + -1.5 + + + + + + + + + + + -1 + + + + + + + + + + + -0.5 + + + + + + + + + + + 0 + + + + + + + + + + + 0.5 + + + + + + + + + + + 1 + + + + + + + + + + + 1.5 + + + + + + + + + + + 2 + + + + + + + + + + + -2 + + + + + + + + + + + -1.5 + + + + + + + + + + + -1 + + + + + + + + + + + -0.5 + + + + + + + + + + + 0 + + + + + + + + + + + 0.5 + + + + + + + + + + + 1 + + + + + + + + + + + 1.5 + + + + + + + + + + + 2 + + + + + + + + + + + -30 + + + + + + + + + + + + + -20 + + + + + + + + + + + + + -10 + + + + + + + + + + + + + 0 + + + + + + + + + + + + + 10 + + + + + + + + + + + + + 20 + + + + + + + + + + + + + 30 + + + + + + + x3 + + + + + gnuplot_plot_1a + + + + + + gnuplot_plot_2a + + + + gnuplot_plot_3a + + + + gnuplot_plot_4a + + + + + + + + + + + + + + + x1 + + + + + x2 + + + + + x3 + + + + + + \ No newline at end of file diff --git a/lecture_10/octave-workspace b/lecture_10/octave-workspace index ba49ea8..8a9aba2 100644 Binary files a/lecture_10/octave-workspace and b/lecture_10/octave-workspace differ diff --git a/lecture_11/LU_naive.m b/lecture_11/LU_naive.m new file mode 100644 index 0000000..92efde6 --- /dev/null +++ b/lecture_11/LU_naive.m @@ -0,0 +1,27 @@ +function [L, U] = LU_naive(A) +% GaussNaive: naive Gauss elimination +% x = GaussNaive(A,b): Gauss elimination without pivoting. +% input: +% A = coefficient matrix +% y = right hand side vector +% output: +% x = solution vector +[m,n] = size(A); +if m~=n, error('Matrix A must be square'); end +nb = n; +L=diag(ones(n,1)); +U=A; +% forward elimination +for k = 1:n-1 + for i = k+1:n + fik = U(i,k)/U(k,k); + L(i,k)=fik; + U(i,k:nb) = U(i,k:nb)-fik*U(k,k:nb); + end +end +%% back substitution +%x = zeros(n,1); +%x(n) = Aug(n,nb)/Aug(n,n); +%for i = n-1:-1:1 +% x(i) = (Aug(i,nb)-Aug(i,i+1:n)*x(i+1:n))/Aug(i,i); +%end diff --git a/lecture_11/LU_pivot.m b/lecture_11/LU_pivot.m new file mode 100644 index 0000000..37abb26 --- /dev/null +++ b/lecture_11/LU_pivot.m @@ -0,0 +1,36 @@ +function [L,U,P] = LU_pivot(A) +% GaussPivot: Gauss elimination pivoting +% x = GaussPivot(A,b): Gauss elimination with pivoting. +% input: +% A = coefficient matrix +% b = right hand side vector +% output: +% x = solution vector +[m,n]=size(A); +if m~=n, error('Matrix A must be square'); end +nb = n; +L=diag(ones(n,1)); +U=A; +P=diag(ones(n,1)); +% forward elimination +for k = 1:n-1 + % partial pivoting + [big,i]=max(abs(U(k:n,k))); + ipr=i+k-1; + if ipr~=k + P([k,ipr],:)=P([ipr,k],:); % if the max is not the current index ipr, pivot count + %L([k,ipr],:)=L([ipr,k],:); + %U([k,ipr],:)=U([ipr,k],:); + end + for i = k+1:n + fik=U(i,k)/U(k,k); + L(i,k)=fik; + U(i,k:nb)=U(i,k:nb)-fik*U(k,k:nb); + end +end +% back substitution +%x=zeros(n,1); +%x(n)=Aug(n,nb)/Aug(n,n); +%for i = n-1:-1:1 +% x(i)=(Aug(i,nb)-Aug(i,i+1:n)*x(i+1:n))/Aug(i,i); +%end diff --git a/lecture_11/lecture_11.aux b/lecture_11/lecture_11.aux new file mode 100644 index 0000000..cf3c530 --- /dev/null +++ b/lecture_11/lecture_11.aux @@ -0,0 +1,28 @@ +\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 {section}{\numberline {1}LU Decomposition}{1}{section.1}} +\newlabel{lu-decomposition}{{1}{1}{LU Decomposition}{section.1}{}} +\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.0.1}efficient storage of matrices for solutions}{1}{subsubsection.1.0.1}} +\newlabel{efficient-storage-of-matrices-for-solutions}{{1.0.1}{1}{efficient storage of matrices for solutions}{subsubsection.1.0.1}{}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Pivoting for LU factorization}{2}{subsection.1.1}} +\newlabel{pivoting-for-lu-factorization}{{1.1}{2}{Pivoting for LU factorization}{subsection.1.1}{}} +\@writefile{lof}{\contentsline {figure}{\numberline {1}{\ignorespaces Springs-masses\relax }}{5}{figure.caption.1}} +\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Cholesky Factorization}{6}{subsection.1.2}} +\newlabel{cholesky-factorization}{{1.2}{6}{Cholesky Factorization}{subsection.1.2}{}} diff --git a/lecture_11/lecture_11.bbl b/lecture_11/lecture_11.bbl new file mode 100644 index 0000000..e69de29 diff --git a/lecture_11/lecture_11.blg b/lecture_11/lecture_11.blg new file mode 100644 index 0000000..f6400af --- /dev/null +++ b/lecture_11/lecture_11.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_11.aux +I found no \citation commands---while reading file lecture_11.aux +I found no \bibdata command---while reading file lecture_11.aux +I found no \bibstyle command---while reading file lecture_11.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_11/lecture_11.ipynb b/lecture_11/lecture_11.ipynb new file mode 100644 index 0000000..c290a47 --- /dev/null +++ b/lecture_11/lecture_11.ipynb @@ -0,0 +1,685 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "%plot --format svg" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "setdefaults" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# LU Decomposition\n", + "### efficient storage of matrices for solutions\n", + "\n", + "Considering the same solution set:\n", + "\n", + "$y=Ax$\n", + "\n", + "Assume that we can perform Gauss elimination and achieve this formula:\n", + "\n", + "$Ux=d$ \n", + "\n", + "Where, $U$ is an upper triangular matrix that we derived from Gauss elimination and $d$ is the set of dependent variables after Gauss elimination. \n", + "\n", + "Assume there is a lower triangular matrix, $L$, with ones on the diagonal and same dimensions of $U$ and the following is true:\n", + "\n", + "$L(Ux-d)=Ax-y=0$\n", + "\n", + "Now, $Ax=LUx$, so $A=LU$, and $y=Ld$.\n", + "\n", + "$2x_{1}+x_{2}=1$\n", + "\n", + "$x_{1}+3x_{2}=1$\n", + "\n", + "\n", + "$\\left[ \\begin{array}{cc}\n", + "2 & 1 \\\\\n", + "1 & 3 \\end{array} \\right]\n", + "\\left[\\begin{array}{c} \n", + "x_{1} \\\\ \n", + "x_{2} \\end{array}\\right]=\n", + "\\left[\\begin{array}{c} \n", + "1 \\\\\n", + "1\\end{array}\\right]$\n", + "\n", + "f21=0.5\n", + "\n", + "A(2,1)=1-1 = 0 \n", + "\n", + "A(2,2)=3-0.5=2.5\n", + "\n", + "y(2)=1-0.5=0.5\n", + "\n", + "$L(Ux-d)=\n", + "\\left[ \\begin{array}{cc}\n", + "1 & 0 \\\\\n", + "0.5 & 1 \\end{array} \\right]\n", + "\\left(\\left[ \\begin{array}{cc}\n", + "2 & 1 \\\\\n", + "0 & 2.5 \\end{array} \\right]\n", + "\\left[\\begin{array}{c} \n", + "x_{1} \\\\ \n", + "x_{2} \\end{array}\\right]-\n", + "\\left[\\begin{array}{c} \n", + "1 \\\\\n", + "0.5\\end{array}\\right]\\right)=0$\n" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "A =\n", + "\n", + " 2 1\n", + " 1 3\n", + "\n", + "L =\n", + "\n", + " 1.00000 0.00000\n", + " 0.50000 1.00000\n", + "\n", + "U =\n", + "\n", + " 2.00000 1.00000\n", + " 0.00000 2.50000\n", + "\n", + "ans =\n", + "\n", + " 2 1\n", + " 1 3\n", + "\n", + "d =\n", + "\n", + " 1.00000\n", + " 0.50000\n", + "\n", + "y =\n", + "\n", + " 1\n", + " 1\n", + "\n" + ] + } + ], + "source": [ + "A=[2,1;1,3]\n", + "L=[1,0;0.5,1]\n", + "U=[2,1;0,2.5]\n", + "L*U\n", + "\n", + "d=[1;0.5]\n", + "y=L*d" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Pivoting for LU factorization\n", + "\n", + "LU factorization uses the same method as Gauss elimination so it is also necessary to perform partial pivoting when creating the lower and upper triangular matrices. \n", + "\n", + "Matlab and Octave use pivoting in the command \n", + "\n", + "`[L,U,P]=lu(A)`\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "'lu' is a built-in function from the file libinterp/corefcn/lu.cc\n", + "\n", + " -- Built-in Function: [L, U] = lu (A)\n", + " -- Built-in Function: [L, U, P] = lu (A)\n", + " -- Built-in Function: [L, U, P, Q] = lu (S)\n", + " -- Built-in Function: [L, U, P, Q, R] = lu (S)\n", + " -- Built-in Function: [...] = lu (S, THRES)\n", + " -- Built-in Function: Y = lu (...)\n", + " -- Built-in Function: [...] = lu (..., \"vector\")\n", + " Compute the LU decomposition of A.\n", + "\n", + " If A is full subroutines from LAPACK are used and if A is sparse\n", + " then UMFPACK is used.\n", + "\n", + " The result is returned in a permuted form, according to the\n", + " optional return value P. For example, given the matrix 'a = [1, 2;\n", + " 3, 4]',\n", + "\n", + " [l, u, p] = lu (A)\n", + "\n", + " returns\n", + "\n", + " l =\n", + "\n", + " 1.00000 0.00000\n", + " 0.33333 1.00000\n", + "\n", + " u =\n", + "\n", + " 3.00000 4.00000\n", + " 0.00000 0.66667\n", + "\n", + " p =\n", + "\n", + " 0 1\n", + " 1 0\n", + "\n", + " The matrix is not required to be square.\n", + "\n", + " When called with two or three output arguments and a spare input\n", + " matrix, 'lu' does not attempt to perform sparsity preserving column\n", + " permutations. Called with a fourth output argument, the sparsity\n", + " preserving column transformation Q is returned, such that 'P * A *\n", + " Q = L * U'.\n", + "\n", + " Called with a fifth output argument and a sparse input matrix, 'lu'\n", + " attempts to use a scaling factor R on the input matrix such that 'P\n", + " * (R \\ A) * Q = L * U'. This typically leads to a sparser and more\n", + " stable factorization.\n", + "\n", + " An additional input argument THRES, that defines the pivoting\n", + " threshold can be given. THRES can be a scalar, in which case it\n", + " defines the UMFPACK pivoting tolerance for both symmetric and\n", + " unsymmetric cases. If THRES is a 2-element vector, then the first\n", + " element defines the pivoting tolerance for the unsymmetric UMFPACK\n", + " pivoting strategy and the second for the symmetric strategy. By\n", + " default, the values defined by 'spparms' are used ([0.1, 0.001]).\n", + "\n", + " Given the string argument \"vector\", 'lu' returns the values of P\n", + " and Q as vector values, such that for full matrix, 'A (P,:) = L *\n", + " U', and 'R(P,:) * A (:, Q) = L * U'.\n", + "\n", + " With two output arguments, returns the permuted forms of the upper\n", + " and lower triangular matrices, such that 'A = L * U'. With one\n", + " output argument Y, then the matrix returned by the LAPACK routines\n", + " is returned. If the input matrix is sparse then the matrix L is\n", + " embedded into U to give a return value similar to the full case.\n", + " For both full and sparse matrices, 'lu' loses the permutation\n", + " information.\n", + "\n", + " See also: luupdate, ilu, chol, hess, qr, qz, schur, svd.\n", + "\n", + "Additional help for built-in functions and operators is\n", + "available in the online version of the manual. Use the command\n", + "'doc ' to search the manual index.\n", + "\n", + "Help and information about Octave is also available on the WWW\n", + "at http://www.octave.org and via the help@octave.org\n", + "mailing list.\n" + ] + } + ], + "source": [ + "help lu" + ] + }, + { + "cell_type": "code", + "execution_count": 22, + "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\t5e-05\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.0001\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.00015\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.0002\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.00025\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0.0003\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t0\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t20\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t40\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t60\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t80\n", + "\t\n", + "\n", + "\n", + "\t\t\n", + "\t\t100\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\t\n", + "\tLU decomp\n", + "\n", + "\n", + "\n", + "\t\n", + "\t\tLU decomp\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\tOctave \\\\\n", + "\n", + "\t\n", + "\t\tOctave \\\n", + "\t\n", + "\n", + "\n", + "\t\n", + "\t\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "" + ], + "text/plain": [ + "" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "% time LU solution vs backslash\n", + "t_lu=zeros(100,1);\n", + "t_bs=zeros(100,1);\n", + "for N=1:100\n", + " A=rand(N,N);\n", + " y=rand(N,1);\n", + " [L,U,P]=lu(A);\n", + "\n", + " tic; d=L\\y; x=U\\d; t_lu(N)=toc;\n", + "\n", + " tic; x=A\\y; t_bs(N)=toc;\n", + "end\n", + "plot([1:100],t_lu,[1:100],t_bs) \n", + "legend('LU decomp','Octave \\\\')" + ] + }, + { + "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 K=10 N/m. What are the final positions of the masses? \n", + "\n", + "![Springs-masses](../lecture_09/mass_springs.svg)\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(x_{2}-x_{1})-kx_{1}=0$\n", + "\n", + "$m_{2}g+k(x_{3}-x_{2})-k(x_{2}-x_{1})=0$\n", + "\n", + "$m_{3}g+k(x_{4}-x_{3})-k(x_{3}-x_{2})=0$\n", + "\n", + "$m_{4}g-k(x_{4}-x_{3})=0$\n", + "\n", + "in matrix form:\n", + "\n", + "$\\left[ \\begin{array}{cccc}\n", + "2k & -k & 0 & 0 \\\\\n", + "-k & 2k & -k & 0 \\\\\n", + "0 & -k & 2k & -k \\\\\n", + "0 & 0 & -k & k \\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": 24, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "K =\n", + "\n", + " 20 -10 0 0\n", + " -10 20 -10 0\n", + " 0 -10 20 -10\n", + " 0 0 -10 10\n", + "\n", + "y =\n", + "\n", + " 9.8100\n", + " 19.6200\n", + " 29.4300\n", + " 39.2400\n", + "\n" + ] + } + ], + "source": [ + "k=10; % N/m\n", + "m1=1; % kg\n", + "m2=2;\n", + "m3=3;\n", + "m4=4;\n", + "g=9.81; % m/s^2\n", + "K=[2*k -k 0 0; -k 2*k -k 0; 0 -k 2*k -k; 0 0 -k k]\n", + "y=[m1*g;m2*g;m3*g;m4*g]" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "This matrix, K, is symmetric. \n", + "\n", + "`K(i,j)==K(j,i)`\n", + "\n", + "Now we can use,\n", + "\n", + "## Cholesky Factorization\n", + "\n", + "We can decompose the matrix, K into two matrices, $U$ and $U^{T}$, where\n", + "\n", + "$K=U^{T}U$\n", + "\n", + "each of the components of U can be calculated with the following equations:\n", + "\n", + "$u_{ii}=\\sqrt{a_{ii}-\\sum_{k=1}^{i-1}u_{ki}^{2}}$\n", + "\n", + "$u_{ij}=\\frac{a_{ij}-\\sum_{k=1}^{i-1}u_{ki}u_{kj}}{u_{ii}}$\n", + "\n", + "so for K" + ] + }, + { + "cell_type": "code", + "execution_count": 25, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "K =\n", + "\n", + " 20 -10 0 0\n", + " -10 20 -10 0\n", + " 0 -10 20 -10\n", + " 0 0 -10 10\n", + "\n" + ] + } + ], + "source": [ + "K" + ] + }, + { + "cell_type": "code", + "execution_count": 26, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "u11 = 4.4721\n", + "u12 = -2.2361\n", + "u13 = 0\n", + "u14 = 0\n", + "u22 = 3.8730\n", + "u23 = -2.5820\n", + "u24 = 0\n", + "u33 = 3.6515\n", + "u34 = -2.7386\n", + "u44 = 1.5811\n", + "U =\n", + "\n", + " 4.47214 -2.23607 0.00000 0.00000\n", + " 0.00000 3.87298 -2.58199 0.00000\n", + " 0.00000 0.00000 3.65148 -2.73861\n", + " 0.00000 0.00000 0.00000 1.58114\n", + "\n" + ] + } + ], + "source": [ + "u11=sqrt(K(1,1))\n", + "u12=(K(1,2))/u11\n", + "u13=(K(1,3))/u11\n", + "u14=(K(1,4))/u11\n", + "u22=sqrt(K(2,2)-u12^2)\n", + "u23=(K(2,3)-u12*u13)/u22\n", + "u24=(K(2,4)-u12*u14)/u22\n", + "u33=sqrt(K(3,3)-u13^2-u23^2)\n", + "u34=(K(3,4)-u13*u14-u23*u24)/u33\n", + "u44=sqrt(K(4,4)-u14^2-u24^2-u34^2)\n", + "U=[u11,u12,u13,u14;0,u22,u23,u24;0,0,u33,u34;0,0,0,u44]" + ] + }, + { + "cell_type": "code", + "execution_count": 27, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "ans =\n", + "\n", + " 20.00000 -10.00000 0.00000 0.00000\n", + " -10.00000 20.00000 -10.00000 0.00000\n", + " 0.00000 -10.00000 20.00000 -10.00000\n", + " 0.00000 0.00000 -10.00000 10.00000\n", + "\n" + ] + } + ], + "source": [ + "U'*U" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "average time spent for Cholesky factored solution = 1.623154e-05+/-1.166726e-05\n", + "average time spent for backslash solution = 1.675844e-05+/-1.187234e-05\n" + ] + } + ], + "source": [ + "% time solution for Cholesky vs backslash\n", + "t_chol=zeros(1000,1);\n", + "t_bs=zeros(1000,1);\n", + "for i=1:1000\n", + " tic; d=U'*y; x=U\\d; t_chol(i)=toc;\n", + " tic; x=K\\y; t_bs(i)=toc;\n", + "end\n", + "fprintf('average time spent for Cholesky factored solution = %e+/-%e',mean(t_chol),std(t_chol))\n", + "\n", + "fprintf('average time spent for backslash solution = %e+/-%e',mean(t_bs),std(t_bs))" + ] + } + ], + "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_11/lecture_11.log b/lecture_11/lecture_11.log new file mode 100644 index 0000000..10423a7 --- /dev/null +++ b/lecture_11/lecture_11.log @@ -0,0 +1,826 @@ +This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015/Debian) (preloaded format=pdflatex 2017.1.11) 22 FEB 2017 22:01 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**lecture_11.tex +(./lecture_11.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_11.aux) +\openout1 = `lecture_11.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_11.out) (./lecture_11.out) +\@outlinefile=\write4 +\openout4 = `lecture_11.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 <14.4> not available +(Font) Font shape `T1/ppl/b/n' tried instead on input line 287. +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 290. + + +Package hyperref Warning: Difference (2) between bookmark levels is greater +(hyperref) than one, level fixed on input line 290. + +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 11.40997pt on input line 294. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 8.33606pt on input line 294. +LaTeX Font Info: Font shape `U/msa/m/n' will be +(Font) scaled to size 6.25204pt on input line 294. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 11.40997pt on input line 294. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 8.33606pt on input line 294. +LaTeX Font Info: Font shape `U/msb/m/n' will be +(Font) scaled to size 6.25204pt on input line 294. +[1 + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] +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 372. +LaTeX Font Info: Try loading font information for TS1+cmtt on input line 387 +. + +(/usr/share/texlive/texmf-dist/tex/latex/base/ts1cmtt.fd +File: ts1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions +) [2] [3] +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 473. + + +File: lecture_11_files/lecture_11_6_0.pdf Graphic file (type pdf) + + +Package pdftex.def Info: lecture_11_files/lecture_11_6_0.pdf used on input line + 487. +(pdftex.def) Requested size: 449.6789pt x 337.25917pt. + [4] +Underfull \hbox (badness 10000) in paragraph at lines 489--490 + + [] + + +File: mass_springs.png Graphic file (type png) + +Package pdftex.def Info: mass_springs.png used on input line 497. +(pdftex.def) Requested size: 89.93611pt x 152.576pt. + +[5 <./lecture_11_files/lecture_11_6_0.pdf> <./mass_springs.png>] [6] [7] +Package atveryend Info: Empty hook `BeforeClearDocument' on input line 656. + +[8] +Package atveryend Info: Empty hook `AfterLastShipout' on input line 656. + (./lecture_11.aux) +Package atveryend Info: Executing hook `AtVeryEndDocument' on input line 656. +Package atveryend Info: Executing hook `AtEndAfterFileList' on input line 656. +Package rerunfilecheck Info: File `lecture_11.out' has not changed. +(rerunfilecheck) Checksum: 06B2288B56AA590C3216AAE67971C54B;297. +Package atveryend Info: Empty hook `AtVeryVeryEnd' on input line 656. + ) +Here is how much of TeX's memory you used: + 10920 strings out of 493029 + 163179 string characters out of 6136234 + 268780 words of memory out of 5000000 + 14206 multiletter control sequences out of 15000+600000 + 39052 words of font info for 103 fonts, out of 8000000 for 9000 + 1141 hyphenation exceptions out of 8191 + 36i,9n,77p,460b,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_11.pdf (8 pages, 154124 bytes). +PDF statistics: + 117 PDF objects out of 1000 (max. 8388607) + 92 compressed objects within 1 object stream + 14 named destinations out of 1000 (max. 500000) + 43 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/lecture_11/lecture_11.out b/lecture_11/lecture_11.out new file mode 100644 index 0000000..41c2cd3 --- /dev/null +++ b/lecture_11/lecture_11.out @@ -0,0 +1,4 @@ +\BOOKMARK [1][-]{section.1}{LU Decomposition}{}% 1 +\BOOKMARK [2][-]{subsubsection.1.0.1}{efficient storage of matrices for solutions}{section.1}% 2 +\BOOKMARK [2][-]{subsection.1.1}{Pivoting for LU factorization}{section.1}% 3 +\BOOKMARK [2][-]{subsection.1.2}{Cholesky Factorization}{section.1}% 4 diff --git a/lecture_11/lecture_11.pdf b/lecture_11/lecture_11.pdf new file mode 100644 index 0000000..3e2c828 Binary files /dev/null and b/lecture_11/lecture_11.pdf differ diff --git a/lecture_11/lecture_11.tex b/lecture_11/lecture_11.tex new file mode 100644 index 0000000..22d4064 --- /dev/null +++ b/lecture_11/lecture_11.tex @@ -0,0 +1,656 @@ + +% 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\_11} + + + + + % 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}18}]:} \PY{c}{\PYZpc{}plot \PYZhy{}\PYZhy{}format svg} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}19}]:} \PY{n}{setdefaults} +\end{Verbatim} + + \section{LU Decomposition}\label{lu-decomposition} + +\subsubsection{efficient storage of matrices for +solutions}\label{efficient-storage-of-matrices-for-solutions} + +Considering the same solution set: + +\(y=Ax\) + +Assume that we can perform Gauss elimination and achieve this formula: + +\(Ux=d\) + +Where, \(U\) is an upper triangular matrix that we derived from Gauss +elimination and \(d\) is the set of dependent variables after Gauss +elimination. + +Assume there is a lower triangular matrix, \(L\), with ones on the +diagonal and same dimensions of \(U\) and the following is true: + +\(L(Ux-d)=Ax-y=0\) + +Now, \(Ax=LUx\), so \(A=LU\), and \(y=Ld\). + +\(2x_{1}+x_{2}=1\) + +\(x_{1}+3x_{2}=1\) + +\(\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]\) + +f21=0.5 + +A(2,1)=1-1 = 0 + +A(2,2)=3-0.5=2.5 + +y(2)=1-0.5=0.5 + +\(L(Ux-d)= \left[ \begin{array}{cc} 1 & 0 \\ 0.5 & 1 \end{array} \right] \left(\left[ \begin{array}{cc} 2 & 1 \\ 0 & 2.5 \end{array} \right] \left[\begin{array}{c} x_{1} \\ x_{2} \end{array}\right]- \left[\begin{array}{c} 1 \\ 0.5\end{array}\right]\right)=0\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}3}]:} \PY{n}{A}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{]} + \PY{n}{L}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{;}\PY{l+m+mf}{0.5}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{]} + \PY{n}{U}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{2}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mf}{2.5}\PY{p}{]} + \PY{n}{L}\PY{o}{*}\PY{n}{U} + + \PY{n}{d}\PY{p}{=}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{;}\PY{l+m+mf}{0.5}\PY{p}{]} + \PY{n}{y}\PY{p}{=}\PY{n}{L}\PY{o}{*}\PY{n}{d} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +A = + + 2 1 + 1 3 + +L = + + 1.00000 0.00000 + 0.50000 1.00000 + +U = + + 2.00000 1.00000 + 0.00000 2.50000 + +ans = + + 2 1 + 1 3 + +d = + + 1.00000 + 0.50000 + +y = + + 1 + 1 + + + \end{Verbatim} + + \subsection{Pivoting for LU +factorization}\label{pivoting-for-lu-factorization} + +LU factorization uses the same method as Gauss elimination so it is also +necessary to perform partial pivoting when creating the lower and upper +triangular matrices. + +Matlab and Octave use pivoting in the command + +\texttt{{[}L,U,P{]}=lu(A)} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}4}]:} \PY{n}{help} \PY{n+nb}{lu} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +'lu' is a built-in function from the file libinterp/corefcn/lu.cc + + -- Built-in Function: [L, U] = lu (A) + -- Built-in Function: [L, U, P] = lu (A) + -- Built-in Function: [L, U, P, Q] = lu (S) + -- Built-in Function: [L, U, P, Q, R] = lu (S) + -- Built-in Function: [{\ldots}] = lu (S, THRES) + -- Built-in Function: Y = lu ({\ldots}) + -- Built-in Function: [{\ldots}] = lu ({\ldots}, "vector") + Compute the LU decomposition of A. + + If A is full subroutines from LAPACK are used and if A is sparse + then UMFPACK is used. + + The result is returned in a permuted form, according to the + optional return value P. For example, given the matrix 'a = [1, 2; + 3, 4]', + + [l, u, p] = lu (A) + + returns + + l = + + 1.00000 0.00000 + 0.33333 1.00000 + + u = + + 3.00000 4.00000 + 0.00000 0.66667 + + p = + + 0 1 + 1 0 + + The matrix is not required to be square. + + When called with two or three output arguments and a spare input + matrix, 'lu' does not attempt to perform sparsity preserving column + permutations. Called with a fourth output argument, the sparsity + preserving column transformation Q is returned, such that 'P * A * + Q = L * U'. + + Called with a fifth output argument and a sparse input matrix, 'lu' + attempts to use a scaling factor R on the input matrix such that 'P + * (R \textbackslash{} A) * Q = L * U'. This typically leads to a sparser and more + stable factorization. + + An additional input argument THRES, that defines the pivoting + threshold can be given. THRES can be a scalar, in which case it + defines the UMFPACK pivoting tolerance for both symmetric and + unsymmetric cases. If THRES is a 2-element vector, then the first + element defines the pivoting tolerance for the unsymmetric UMFPACK + pivoting strategy and the second for the symmetric strategy. By + default, the values defined by 'spparms' are used ([0.1, 0.001]). + + Given the string argument "vector", 'lu' returns the values of P + and Q as vector values, such that for full matrix, 'A (P,:) = L * + U', and 'R(P,:) * A (:, Q) = L * U'. + + With two output arguments, returns the permuted forms of the upper + and lower triangular matrices, such that 'A = L * U'. With one + output argument Y, then the matrix returned by the LAPACK routines + is returned. If the input matrix is sparse then the matrix L is + embedded into U to give a return value similar to the full case. + For both full and sparse matrices, 'lu' loses the permutation + information. + + See also: luupdate, ilu, chol, hess, qr, qz, schur, svd. + +Additional help for built-in functions and operators is +available in the online version of the manual. Use the command +'doc ' to search the manual index. + +Help and information about Octave is also available on the WWW +at http://www.octave.org and via the help@octave.org +mailing list. + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}22}]:} \PY{c}{\PYZpc{} time LU solution vs backslash} + \PY{n}{t\PYZus{}lu}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{100}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{t\PYZus{}bs}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{100}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{k}{for} \PY{n}{N}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100} + \PY{n}{A}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{n}{N}\PY{p}{)}\PY{p}{;} + \PY{n}{y}\PY{p}{=}\PY{n+nb}{rand}\PY{p}{(}\PY{n}{N}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{p}{[}\PY{n}{L}\PY{p}{,}\PY{n}{U}\PY{p}{,}\PY{n}{P}\PY{p}{]}\PY{p}{=}\PY{n+nb}{lu}\PY{p}{(}\PY{n}{A}\PY{p}{)}\PY{p}{;} + + \PY{n+nb}{tic}\PY{p}{;} \PY{n}{d}\PY{p}{=}\PY{n}{L}\PY{o}{\PYZbs{}}\PY{n}{y}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d}\PY{p}{;} \PY{n}{t\PYZus{}lu}\PY{p}{(}\PY{n}{N}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + + \PY{n+nb}{tic}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{A}\PY{o}{\PYZbs{}}\PY{n}{y}\PY{p}{;} \PY{n}{t\PYZus{}bs}\PY{p}{(}\PY{n}{N}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \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{p}{,}\PY{n}{t\PYZus{}lu}\PY{p}{,}\PY{p}{[}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{100}\PY{p}{]}\PY{p}{,}\PY{n}{t\PYZus{}bs}\PY{p}{)} + \PY{n+nb}{legend}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{LU decomp\PYZsq{}}\PY{p}{,}\PY{l+s}{\PYZsq{}}\PY{l+s}{Octave \PYZbs{}\PYZbs{}\PYZsq{}}\PY{p}{)} +\end{Verbatim} + + \begin{center} + \adjustimage{max size={0.9\linewidth}{0.9\paperheight}}{lecture_11_files/lecture_11_6_0.pdf} + \end{center} + { \hspace*{\fill} \\} + + Consider the problem again from the intro to Linear Algebra, 4 masses +are connected in series to 4 springs with K=10 N/m. What are the final +positions of the masses? + +\begin{figure}[htbp] +\centering +\includegraphics{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(x_{2}-x_{1})-kx_{1}=0\) + +\(m_{2}g+k(x_{3}-x_{2})-k(x_{2}-x_{1})=0\) + +\(m_{3}g+k(x_{4}-x_{3})-k(x_{3}-x_{2})=0\) + +\(m_{4}g-k(x_{4}-x_{3})=0\) + +in matrix form: + +\(\left[ \begin{array}{cccc} 2k & -k & 0 & 0 \\ -k & 2k & -k & 0 \\ 0 & -k & 2k & -k \\ 0 & 0 & -k & k \end{array} \right] \left[ \begin{array}{c} x_{1} \\ x_{2} \\ x_{3} \\ x_{4} \end{array} \right]= \left[ \begin{array}{c} m_{1}g \\ m_{2}g \\ m_{3}g \\ m_{4}g \end{array} \right]\) + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}24}]:} \PY{n}{k}\PY{p}{=}\PY{l+m+mi}{10}\PY{p}{;} \PY{c}{\PYZpc{} N/m} + \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{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{0} \PY{l+m+mi}{0}\PY{p}{;} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{0}\PY{p}{;} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{l+m+mi}{2}\PY{o}{*}\PY{n}{k} \PY{o}{\PYZhy{}}\PY{n}{k}\PY{p}{;} \PY{l+m+mi}{0} \PY{l+m+mi}{0} \PY{o}{\PYZhy{}}\PY{n}{k} \PY{n}{k}\PY{p}{]} + \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 = + + 20 -10 0 0 + -10 20 -10 0 + 0 -10 20 -10 + 0 0 -10 10 + +y = + + 9.8100 + 19.6200 + 29.4300 + 39.2400 + + + \end{Verbatim} + + This matrix, K, is symmetric. + +\texttt{K(i,j)==K(j,i)} + +Now we can use, + +\subsection{Cholesky Factorization}\label{cholesky-factorization} + +We can decompose the matrix, K into two matrices, \(U\) and \(U^{T}\), +where + +\(K=U^{T}U\) + +each of the components of U can be calculated with the following +equations: + +\(u_{ii}=\sqrt{a_{ii}-\sum_{k=1}^{i-1}u_{ki}^{2}}\) + +\(u_{ij}=\frac{a_{ij}-\sum_{k=1}^{i-1}u_{ki}u_{kj}}{u_{ii}}\) + +so for K + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}25}]:} \PY{n}{K} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +K = + + 20 -10 0 0 + -10 20 -10 0 + 0 -10 20 -10 + 0 0 -10 10 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}26}]:} \PY{n}{u11}\PY{p}{=}\PY{n+nb}{sqrt}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{)} + \PY{n}{u12}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{2}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11} + \PY{n}{u13}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{3}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11} + \PY{n}{u14}\PY{p}{=}\PY{p}{(}\PY{n}{K}\PY{p}{(}\PY{l+m+mi}{1}\PY{p}{,}\PY{l+m+mi}{4}\PY{p}{)}\PY{p}{)}\PY{o}{/}\PY{n}{u11} + \PY{n}{u22}\PY{p}{=}\PY{n+nb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\PYZca{}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{u24}\PYZca{}\PY{l+m+mi}{2}\PY{o}{\PYZhy{}}\PY{n}{u34}\PYZca{}\PY{l+m+mi}{2}\PY{p}{)} + \PY{n}{U}\PY{p}{=}\PY{p}{[}\PY{n}{u11}\PY{p}{,}\PY{n}{u12}\PY{p}{,}\PY{n}{u13}\PY{p}{,}\PY{n}{u14}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u22}\PY{p}{,}\PY{n}{u23}\PY{p}{,}\PY{n}{u24}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u33}\PY{p}{,}\PY{n}{u34}\PY{p}{;}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{l+m+mi}{0}\PY{p}{,}\PY{n}{u44}\PY{p}{]} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +u11 = 4.4721 +u12 = -2.2361 +u13 = 0 +u14 = 0 +u22 = 3.8730 +u23 = -2.5820 +u24 = 0 +u33 = 3.6515 +u34 = -2.7386 +u44 = 1.5811 +U = + + 4.47214 -2.23607 0.00000 0.00000 + 0.00000 3.87298 -2.58199 0.00000 + 0.00000 0.00000 3.65148 -2.73861 + 0.00000 0.00000 0.00000 1.58114 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}27}]:} \PY{n}{U}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{U} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +ans = + + 20.00000 -10.00000 0.00000 0.00000 + -10.00000 20.00000 -10.00000 0.00000 + 0.00000 -10.00000 20.00000 -10.00000 + 0.00000 0.00000 -10.00000 10.00000 + + + \end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +{\color{incolor}In [{\color{incolor}37}]:} \PY{c}{\PYZpc{} time solution for Cholesky vs backslash} + \PY{n}{t\PYZus{}chol}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1000}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{n}{t\PYZus{}bs}\PY{p}{=}\PY{n+nb}{zeros}\PY{p}{(}\PY{l+m+mi}{1000}\PY{p}{,}\PY{l+m+mi}{1}\PY{p}{)}\PY{p}{;} + \PY{k}{for} \PY{n}{i}\PY{p}{=}\PY{l+m+mi}{1}\PY{p}{:}\PY{l+m+mi}{1000} + \PY{n+nb}{tic}\PY{p}{;} \PY{n}{d}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZsq{}}\PY{o}{*}\PY{n}{y}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{U}\PY{o}{\PYZbs{}}\PY{n}{d}\PY{p}{;} \PY{n}{t\PYZus{}chol}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \PY{n+nb}{tic}\PY{p}{;} \PY{n}{x}\PY{p}{=}\PY{n}{K}\PY{o}{\PYZbs{}}\PY{n}{y}\PY{p}{;} \PY{n}{t\PYZus{}bs}\PY{p}{(}\PY{n}{i}\PY{p}{)}\PY{p}{=}\PY{n+nb}{toc}\PY{p}{;} + \PY{k}{end} + \PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{average time spent for Cholesky factored solution = \PYZpc{}e+/\PYZhy{}\PYZpc{}e\PYZsq{}}\PY{p}{,}\PY{n+nb}{mean}\PY{p}{(}\PY{n}{t\PYZus{}chol}\PY{p}{)}\PY{p}{,}\PY{n+nb}{std}\PY{p}{(}\PY{n}{t\PYZus{}chol}\PY{p}{)}\PY{p}{)} + + \PY{n+nb}{fprintf}\PY{p}{(}\PY{l+s}{\PYZsq{}}\PY{l+s}{average time spent for backslash solution = \PYZpc{}e+/\PYZhy{}\PYZpc{}e\PYZsq{}}\PY{p}{,}\PY{n+nb}{mean}\PY{p}{(}\PY{n}{t\PYZus{}bs}\PY{p}{)}\PY{p}{,}\PY{n+nb}{std}\PY{p}{(}\PY{n}{t\PYZus{}bs}\PY{p}{)}\PY{p}{)} +\end{Verbatim} + + \begin{Verbatim}[commandchars=\\\{\}] +average time spent for Cholesky factored solution = 1.623154e-05+/-1.166726e-05 +average time spent for backslash solution = 1.675844e-05+/-1.187234e-05 + + \end{Verbatim} + + + % Add a bibliography block to the postdoc + + + + \end{document} diff --git a/lecture_11/lecture_11_files/lecture_11_6_0.pdf b/lecture_11/lecture_11_files/lecture_11_6_0.pdf new file mode 100644 index 0000000..40e3f28 Binary files /dev/null and b/lecture_11/lecture_11_files/lecture_11_6_0.pdf differ diff --git a/lecture_11/lecture_11_files/lecture_11_6_0.svg b/lecture_11/lecture_11_files/lecture_11_6_0.svg new file mode 100644 index 0000000..bb1f18d --- /dev/null +++ b/lecture_11/lecture_11_files/lecture_11_6_0.svg @@ -0,0 +1,149 @@ + + +Gnuplot +Produced by GNUPLOT 5.0 patchlevel 3 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + + + + + 5e-05 + + + + + 0.0001 + + + + + 0.00015 + + + + + 0.0002 + + + + + 0.00025 + + + + + 0.0003 + + + + + 0 + + + + + 20 + + + + + 40 + + + + + 60 + + + + + 80 + + + + + 100 + + + + + + + + + + + + + LU decomp + + + + + LU decomp + + + + + + Octave \\ + + + Octave \ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/lecture_11/mass_springs.png b/lecture_11/mass_springs.png new file mode 100644 index 0000000..259a333 Binary files /dev/null and b/lecture_11/mass_springs.png differ diff --git a/lecture_11/mass_springs.svg b/lecture_11/mass_springs.svg new file mode 100644 index 0000000..2bec8a4 --- /dev/null +++ b/lecture_11/mass_springs.svg @@ -0,0 +1,214 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + m1 + m2 + m3 + + + m4 + + + + + + + + + diff --git a/lecture_11/nohup.out b/lecture_11/nohup.out new file mode 100644 index 0000000..838862f --- /dev/null +++ b/lecture_11/nohup.out @@ -0,0 +1,2 @@ + +(evince:15386): Gtk-WARNING **: gtk_widget_size_allocate(): attempt to allocate widget with width -71 and height 20 diff --git a/lecture_11/octave-workspace b/lecture_11/octave-workspace new file mode 100644 index 0000000..2e1bdfa Binary files /dev/null and b/lecture_11/octave-workspace differ diff --git a/linear_algebra/gauss_suggested.md b/linear_algebra/gauss_suggested.md new file mode 100644 index 0000000..6b1f6b6 --- /dev/null +++ b/linear_algebra/gauss_suggested.md @@ -0,0 +1,71 @@ +# Linear Algebra Review +## (Gauss Elimination) Suggested problems +### No due date + +1. Solve for x when Ax=b for the following problems: + + a. $A=\left[ \begin{array}{cc} + 1 & 3 \\ + 2 & 1 \end{array} \right] + b= + \left[\begin{array}{c} + 1 \\ + 1\end{array}\right]$ + + a. $A=\left[ \begin{array}{cc} + 1 & 1 \\ + 2 & 3 \end{array} \right] + b= + \left[\begin{array}{c} + 3 \\ + 4\end{array}\right]$ + + a. $A=\left[ \begin{array}{cc} + 1 & 1 \\ + 2 & -2 \end{array} \right] + b= + \left[\begin{array}{c} + 4 \\ + 2\end{array}\right]$ + + b. $A=\left[ \begin{array}{ccc} + 1 & 3 & 1 \\ + -4 & -9 & 2 \\ + 0 & 3 & 6\end{array} \right] + b= + \left[\begin{array}{c} + 0 \\ + 0 \\ + 0\end{array}\right]$ + + c. $A=\left[ \begin{array}{ccc} + 1 & 3 & 1 \\ + -4 & -9 & 2 \\ + 0 & 3 & 6\end{array} \right] + b= + \left[\begin{array}{c} + 1 \\ + -1 \\ + -3\end{array}\right]$ + + d. $A=\left[ \begin{array}{ccc} + 1 & 3 & -5 \\ + 1 & 4 & -8 \\ + -3 & -7 & 9\end{array} \right] + b= + \left[\begin{array}{c} + 1 \\ + -1 \\ + -3\end{array}\right]$ + + d. $A=\left[ \begin{array}{ccc} + 1 & 2 & -1 \\ + 2 & 2 & 2 \\ + 1 & -1 & 2\end{array} \right] + b= + \left[\begin{array}{c} + 2 \\ + 12 \\ + 5\end{array}\right]$ + +2. Calculate the determinant of A from 1a-g. diff --git a/linear_algebra/gauss_suggested.pdf b/linear_algebra/gauss_suggested.pdf new file mode 100644 index 0000000..a78b277 Binary files /dev/null and b/linear_algebra/gauss_suggested.pdf differ