Skip to content

3/8/17 #9

Merged
merged 2 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lecture_13/LU_naive.m
Original file line number Diff line number Diff line change
@@ -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
60 changes: 32 additions & 28 deletions lecture_13/lecture_13.aux
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,41 @@
\@writefile{toc}{\contentsline {subsection}{\numberline {0.2}Your questions from last class}{1}{subsection.0.2}}
\newlabel{your-questions-from-last-class}{{0.2}{1}{Your questions from last class}{subsection.0.2}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {2}{\ignorespaces q2\relax }}{2}{figure.caption.2}}
\@writefile{toc}{\contentsline {subsection}{\numberline {0.3}Condition of a matrix}{2}{subsection.0.3}}
\newlabel{condition-of-a-matrix}{{0.3}{2}{Condition of a matrix}{subsection.0.3}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.1}\emph {just checked in to see what condition my condition was in}}{2}{subsubsection.0.3.1}}
\newlabel{just-checked-in-to-see-what-condition-my-condition-was-in}{{0.3.1}{2}{\texorpdfstring {\emph {just checked in to see what condition my condition was in}}{just checked in to see what condition my condition was in}}{subsubsection.0.3.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.2}Matrix norms}{2}{subsubsection.0.3.2}}
\newlabel{matrix-norms}{{0.3.2}{2}{Matrix norms}{subsubsection.0.3.2}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {0.3.3}Condition of Matrix}{3}{subsubsection.0.3.3}}
\newlabel{condition-of-matrix}{{0.3.3}{3}{Condition of Matrix}{subsubsection.0.3.3}{}}
\@writefile{toc}{\contentsline {section}{\numberline {1}Markdown examples}{2}{section.1}}
\newlabel{markdown-examples}{{1}{2}{Markdown examples}{section.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Condition of a matrix}{3}{subsection.1.1}}
\newlabel{condition-of-a-matrix}{{1.1}{3}{Condition of a matrix}{subsection.1.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}\emph {just checked in to see what condition my condition was in}}{3}{subsubsection.1.1.1}}
\newlabel{just-checked-in-to-see-what-condition-my-condition-was-in}{{1.1.1}{3}{\texorpdfstring {\emph {just checked in to see what condition my condition was in}}{just checked in to see what condition my condition was in}}{subsubsection.1.1.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Matrix norms}{3}{subsubsection.1.1.2}}
\newlabel{matrix-norms}{{1.1.2}{3}{Matrix norms}{subsubsection.1.1.2}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.3}Condition of Matrix}{3}{subsubsection.1.1.3}}
\newlabel{condition-of-matrix}{{1.1.3}{3}{Condition of Matrix}{subsubsection.1.1.3}{}}
\@writefile{lof}{\contentsline {figure}{\numberline {3}{\ignorespaces Springs-masses\relax }}{5}{figure.caption.3}}
\@writefile{toc}{\contentsline {section}{\numberline {1}Iterative Methods}{6}{section.1}}
\newlabel{iterative-methods}{{1}{6}{Iterative Methods}{section.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Gauss-Seidel method}{6}{subsection.1.1}}
\newlabel{gauss-seidel-method}{{1.1}{6}{Gauss-Seidel method}{subsection.1.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Gauss-Seidel Iterative approach}{7}{subsubsection.1.1.1}}
\newlabel{gauss-seidel-iterative-approach}{{1.1.1}{7}{Gauss-Seidel Iterative approach}{subsubsection.1.1.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.2}Jacobi method}{7}{subsubsection.1.1.2}}
\newlabel{jacobi-method}{{1.1.2}{7}{Jacobi method}{subsubsection.1.1.2}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}P=2 norm is ratio of biggest eigenvalue to smallest eigenvalue!}{7}{subsection.1.2}}
\newlabel{p2-norm-is-ratio-of-biggest-eigenvalue-to-smallest-eigenvalue}{{1.2}{7}{P=2 norm is ratio of biggest eigenvalue to smallest eigenvalue!}{subsection.1.2}{}}
\@writefile{toc}{\contentsline {section}{\numberline {2}Iterative Methods}{7}{section.2}}
\newlabel{iterative-methods}{{2}{7}{Iterative Methods}{section.2}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.1}Gauss-Seidel method}{7}{subsection.2.1}}
\newlabel{gauss-seidel-method}{{2.1}{7}{Gauss-Seidel method}{subsection.2.1}{}}
\gdef \LT@i {\LT@entry
{1}{52.97838pt}\LT@entry
{1}{181.1121pt}\LT@entry
{1}{35.4892pt}\LT@entry
{1}{179.80707pt}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}Gauss-Seidel with Relaxation}{11}{subsection.1.2}}
\newlabel{gauss-seidel-with-relaxation}{{1.2}{11}{Gauss-Seidel with Relaxation}{subsection.1.2}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.3}Nonlinear Systems}{13}{subsection.1.3}}
\newlabel{nonlinear-systems}{{1.3}{13}{Nonlinear Systems}{subsection.1.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.4}Newton-Raphson part II}{14}{subsection.1.4}}
\newlabel{newton-raphson-part-ii}{{1.4}{14}{Newton-Raphson part II}{subsection.1.4}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.4.1}Solution is again in the form Ax=b}{15}{subsubsection.1.4.1}}
\newlabel{solution-is-again-in-the-form-axb}{{1.4.1}{15}{Solution is again in the form Ax=b}{subsubsection.1.4.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {1.5}Example of Jacobian calculation}{15}{subsection.1.5}}
\newlabel{example-of-jacobian-calculation}{{1.5}{15}{Example of Jacobian calculation}{subsection.1.5}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.5.1}Nonlinear springs supporting two masses in series}{15}{subsubsection.1.5.1}}
\newlabel{nonlinear-springs-supporting-two-masses-in-series}{{1.5.1}{15}{Nonlinear springs supporting two masses in series}{subsubsection.1.5.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.1}Gauss-Seidel Iterative approach}{8}{subsubsection.2.1.1}}
\newlabel{gauss-seidel-iterative-approach}{{2.1.1}{8}{Gauss-Seidel Iterative approach}{subsubsection.2.1.1}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.1.2}Jacobi method}{8}{subsubsection.2.1.2}}
\newlabel{jacobi-method}{{2.1.2}{8}{Jacobi method}{subsubsection.2.1.2}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.2}Gauss-Seidel with Relaxation}{11}{subsection.2.2}}
\newlabel{gauss-seidel-with-relaxation}{{2.2}{11}{Gauss-Seidel with Relaxation}{subsection.2.2}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.3}Nonlinear Systems}{13}{subsection.2.3}}
\newlabel{nonlinear-systems}{{2.3}{13}{Nonlinear Systems}{subsection.2.3}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.4}Newton-Raphson part II}{14}{subsection.2.4}}
\newlabel{newton-raphson-part-ii}{{2.4}{14}{Newton-Raphson part II}{subsection.2.4}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.4.1}Solution is again in the form Ax=b}{15}{subsubsection.2.4.1}}
\newlabel{solution-is-again-in-the-form-axb}{{2.4.1}{15}{Solution is again in the form Ax=b}{subsubsection.2.4.1}{}}
\@writefile{toc}{\contentsline {subsection}{\numberline {2.5}Example of Jacobian calculation}{15}{subsection.2.5}}
\newlabel{example-of-jacobian-calculation}{{2.5}{15}{Example of Jacobian calculation}{subsection.2.5}{}}
\@writefile{toc}{\contentsline {subsubsection}{\numberline {2.5.1}Nonlinear springs supporting two masses in series}{15}{subsubsection.2.5.1}}
\newlabel{nonlinear-springs-supporting-two-masses-in-series}{{2.5.1}{15}{Nonlinear springs supporting two masses in series}{subsubsection.2.5.1}{}}
Loading