forked from sed12008/ME3255S2017
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
5,052 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
function [x,Aug] = GaussNaive(A,y) | ||
% 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+1; | ||
Aug = [A y]; | ||
% forward elimination | ||
for k = 1:n-1 | ||
for i = k+1:n | ||
factor = Aug(i,k)/Aug(k,k); | ||
Aug(i,k:nb) = Aug(i,k:nb)-factor*Aug(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function [x,Aug,npivots] = GaussPivot(A,b) | ||
% 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+1; | ||
Aug=[A b]; | ||
npivots=0; % initially no pivots used | ||
% forward elimination | ||
for k = 1:n-1 | ||
% partial pivoting | ||
[big,i]=max(abs(Aug(k:n,k))); | ||
ipr=i+k-1; | ||
if ipr~=k | ||
npivots=npivots+1; % if the max is not the current index ipr, pivot count | ||
Aug([k,ipr],:)=Aug([ipr,k],:); | ||
end | ||
for i = k+1:n | ||
factor=Aug(i,k)/Aug(k,k); | ||
Aug(i,k:nb)=Aug(i,k:nb)-factor*Aug(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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
function x = Tridiag(e,f,g,r) | ||
% Tridiag: Tridiagonal equation solver banded system | ||
% x = Tridiag(e,f,g,r): Tridiagonal system solver. | ||
% input: | ||
% e = subdiagonal vector | ||
% f = diagonal vector | ||
% g = superdiagonal vector | ||
% r = right hand side vector | ||
% output: | ||
% x = solution vector | ||
n=length(f); | ||
% forward elimination | ||
for k = 2:n | ||
factor = e(k)/f(k-1); | ||
f(k) = f(k) - factor*g(k-1); | ||
r(k) = r(k) - factor*r(k-1); | ||
end | ||
% back substitution | ||
x(n) = r(n)/f(n); | ||
for k = n-1:-1:1 | ||
x(k) = (r(k)-g(k)*x(k+1))/f(k); | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
\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}Gauss Elimination}{1}{section.1}} | ||
\newlabel{gauss-elimination}{{1}{1}{Gauss Elimination}{section.1}{}} | ||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.0.1}Solving sets of equations with matrix operations}{1}{subsubsection.1.0.1}} | ||
\newlabel{solving-sets-of-equations-with-matrix-operations}{{1.0.1}{1}{Solving sets of equations with matrix operations}{subsubsection.1.0.1}{}} | ||
\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Gauss elimination}{4}{subsection.1.1}} | ||
\newlabel{gauss-elimination}{{1.1}{4}{Gauss elimination}{subsection.1.1}{}} | ||
\@writefile{toc}{\contentsline {subsubsection}{\numberline {1.1.1}Solving sets of equations systematically}{4}{subsubsection.1.1.1}} | ||
\newlabel{solving-sets-of-equations-systematically}{{1.1.1}{4}{Solving sets of equations systematically}{subsubsection.1.1.1}{}} | ||
\@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{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 | ||
{1}{261.39424pt}} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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_10.aux | ||
I found no \citation commands---while reading file lecture_10.aux | ||
I found no \bibdata command---while reading file lecture_10.aux | ||
I found no \bibstyle command---while reading file lecture_10.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) |
Oops, something went wrong.