Task 2 code

This commit is contained in:
PolishPigeon 2021-11-11 19:19:57 +01:00
parent 4116b23f4a
commit 5c984d09a7
16 changed files with 421 additions and 118 deletions

View File

@ -0,0 +1,43 @@
function x = jacobiMethod(Matrix, Vector)
[Rows,~] = size(Matrix);
D = diag(diag(Matrix));
inverseD = inv(D);
U = triu(Matrix, 1); % Generates upper triangular part of matrix
% where the second variable denotes on which diagonal of matrix should we
% start
L = tril(Matrix, -1); % Generates lower triangular part of matrix
% where the second variable denotes on which diagonal of matrix should we
% start
initial_x = ones(Rows, 1);
initial_x = - inverseD * ( ( L + U ) * initial_x) + inverseD * initial_x; % As per formula
% We will be using D \ initial_x and D \ () since it is faster and more
% accurate according to matlab
whichIterationAreWeOn = 0;
currentError = inf; % We set it to inf so that it the algorithm will always start
% (See condition below)
demandedTolerance = 1e-10;
while currentError >= demandedTolerance
x = - inverseD * ( ( L + U ) * initial_x) + inverseD * initial_x; % As per formula
currentError = norm(x - initial_x);
disp(currentError);
if currentError <= demandedTolerance
currentError = norm(Matrix*x-Vector);
disp(currentError);
if currentError <= demandedTolerance
break;
else
demandedTolerance = demandedTolerance * 2;
end
end
initial_x = x;
whichIterationAreWeOn = whichIterationAreWeOn + 1;
end
disp("Final demandedTolerance");
disp(demandedTolerance);
disp("Final Iteration: ");
disp(whichIterationAreWeOn);
disp("A\b matlab:");
disp(Matrix / Vector);
end

View File

@ -0,0 +1,50 @@
function x = jacobiMethod(Matrix, Vector)
[Rows,~] = size(Matrix);
[L, D, U] = decomposeMatrix(Matrix);
initial_x = ones(Rows, 1);
whichIterationAreWeOn = 0;
currentError = inf; % We set it to inf so that the algorithm will always start
% (See condition below)
demandedTolerance = 1e-10;
while currentError >= demandedTolerance
x = jacobiEquation(D, L, U, initial_x, Vector);
currentError = norm(x - initial_x);
%disp(currentError);
if currentError <= demandedTolerance
currentError = norm(Matrix*x-Vector);
%disp(currentError);
if currentError <= demandedTolerance
break;
else
demandedTolerance = demandedTolerance * 2;
end
end
initial_x = x;
whichIterationAreWeOn = whichIterationAreWeOn + 1;
end
disp("Final demandedTolerance");
disp(demandedTolerance);
disp("Final Iteration: ");
disp(whichIterationAreWeOn);
disp("A\b matlab:");
disp(Matrix \ Vector);
end
function [L, D, U] = decomposeMatrix(Matrix)
D = diag(diag(Matrix));
U = triu(Matrix, 1); % Generates upper triangular part of matrix
% where the second variable denotes on which diagonal of matrix should we
% start
L = tril(Matrix, -1); % Generates lower triangular part of matrix
% where the second variable denotes on which diagonal of matrix should we
% start
end
function x = jacobiEquation(D, L, U, initial_x, Vector)
x = - D \ ( L + U ) * initial_x + D \ Vector; % As per formula
% We will be using D \ Vector and D \ ( ) instead of inverseD since
% this is faster according to matlab
end

View File

@ -0,0 +1,4 @@
PWD /home/kuchy/Zlew/Studia/SEM_5/enume_done/Project/matlabproject/ENUME_Project_31/projectA
INPUT /etc/texmf/web2c/texmf.cnf
INPUT /usr/share/texmf/web2c/texmf.cnf
INPUT /usr/share/texlive/texmf-dist/web2c/texmf.cnf

View File

@ -46,30 +46,38 @@
\@writefile{lot}{\addvspace {10\p@ }}
\@writefile{toc}{\contentsline {section}{\numberline {3.1}Problem}{11}{section.3.1}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3.2}Theoretical introduction}{11}{section.3.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3.3}Solution}{12}{section.3.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3.4}Discussion of the result}{12}{section.3.4}\protected@file@percent }
\@writefile{toc}{\contentsline {chapter}{\numberline {4}Problem 4 - QR method of finding eigenvalues}{13}{chapter.4}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {3.2.1}Procedure}{12}{subsection.3.2.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{Decomposing matrix}{12}{section*.6}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{Jacobi's method}{13}{section*.7}\protected@file@percent }
\@writefile{toc}{\contentsline {paragraph}{Converging}{13}{section*.8}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{Gauss-Seidel method}{13}{section*.9}\protected@file@percent }
\@writefile{toc}{\contentsline {paragraph}{Converging}{15}{section*.10}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{Stop tests}{15}{section*.11}\protected@file@percent }
\@writefile{toc}{\contentsline {subsubsection}{\textbf {A} and \textbf {b}}{15}{section*.12}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3.3}Solution}{16}{section.3.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {3.4}Discussion of the result}{16}{section.3.4}\protected@file@percent }
\@writefile{toc}{\contentsline {chapter}{\numberline {4}Problem 4 - QR method of finding eigenvalues}{17}{chapter.4}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Problem}{13}{section.4.1}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.2}Theoretical introduction}{13}{section.4.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.3}Solution}{13}{section.4.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.4}Discussion of the result}{13}{section.4.4}\protected@file@percent }
\@writefile{toc}{\contentsline {chapter}{\numberline {5}Code appendix}{14}{chapter.5}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.1}Problem}{17}{section.4.1}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.2}Theoretical introduction}{17}{section.4.2}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.3}Solution}{17}{section.4.3}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {4.4}Discussion of the result}{17}{section.4.4}\protected@file@percent }
\@writefile{toc}{\contentsline {chapter}{\numberline {5}Code appendix}{18}{chapter.5}\protected@file@percent }
\@writefile{lof}{\addvspace {10\p@ }}
\@writefile{lot}{\addvspace {10\p@ }}
\@writefile{toc}{\contentsline {section}{\numberline {5.1}Task 2 Code}{14}{section.5.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.1}Main function}{14}{subsection.5.1.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.2}checkIfMatrixIsSquareMatrix}{14}{subsection.5.1.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.3}gaussianEliminationWithPartialPivoting}{16}{subsection.5.1.3}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.4}partialPivoting}{16}{subsection.5.1.4}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.5}partialPivotingSwapOneRow}{16}{subsection.5.1.5}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.6}swapRowMatrix}{17}{subsection.5.1.6}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.7}swapValueVector}{17}{subsection.5.1.7}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.8}gaussianElimination}{17}{subsection.5.1.8}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.9}substractRows}{17}{subsection.5.1.9}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.10}backSubstitutionPhase}{18}{subsection.5.1.10}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.11}iterativeResidualCorrection}{18}{subsection.5.1.11}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.12}improveSolution}{18}{subsection.5.1.12}\protected@file@percent }
\@writefile{toc}{\contentsline {section}{\numberline {5.1}Task 2 Code}{18}{section.5.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.1}Main function}{18}{subsection.5.1.1}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.2}checkIfMatrixIsSquareMatrix}{18}{subsection.5.1.2}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.3}gaussianEliminationWithPartialPivoting}{20}{subsection.5.1.3}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.4}partialPivoting}{20}{subsection.5.1.4}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.5}partialPivotingSwapOneRow}{20}{subsection.5.1.5}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.6}swapRowMatrix}{20}{subsection.5.1.6}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.7}swapValueVector}{21}{subsection.5.1.7}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.8}gaussianElimination}{21}{subsection.5.1.8}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.9}substractRows}{21}{subsection.5.1.9}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.10}backSubstitutionPhase}{22}{subsection.5.1.10}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.11}iterativeResidualCorrection}{22}{subsection.5.1.11}\protected@file@percent }
\@writefile{toc}{\contentsline {subsection}{\numberline {5.1.12}improveSolution}{22}{subsection.5.1.12}\protected@file@percent }
\bibcite{texbook}{1}
\gdef \@abspage@last{20}
\gdef \@abspage@last{24}

View File

@ -1,13 +1,17 @@
# Fdb version 3
["pdflatex"] 1636562354 "projectA.tex" "projectA.pdf" "projectA" 1636562355
"/etc/texmf/web2c/texmf.cnf" 1624878795 475 c0e671620eb5563b2130f56340a5fde8 ""
["pdflatex"] 1636652315 "projectA.tex" "projectA.pdf" "projectA" 1636652316
"/etc/texmf/web2c/texmf.cnf" 1635008344 475 c0e671620eb5563b2130f56340a5fde8 ""
"/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc" 1165713224 4850 80dc9bab7f31fb78a000ccfed0e27cab ""
"/usr/share/texlive/texmf-dist/fonts/map/fontname/texfonts.map" 1577235249 3524 cb3e574dea2d1052e39280babc910dc8 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx0500.tfm" 1136768653 3584 0913860e6fa2bdf78ecaf460b391112b ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx0700.tfm" 1136768653 3584 ca0c423beaacd28d53ddce5a826cd558 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx1000.tfm" 1136768653 3584 2d666ecf6d466d8b007246bc2f94d9da ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx1200.tfm" 1136768653 3584 402da0b29eafbad07963b1224b222f18 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx1440.tfm" 1136768653 3584 13049b61b922a28b158a38aeff75ee9b ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx2074.tfm" 1136768653 3584 7666d038713b9e38abb5c2e0f6972188 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx2488.tfm" 1136768653 3584 0181dbc4d429c3ba4e30feba37b5df96 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm0500.tfm" 1136768653 3584 178baad7ffca7f5d3428a83bd7cc64c3 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm0700.tfm" 1136768653 3584 cf973739aac7ab6247f9150296af7954 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm1000.tfm" 1136768653 3584 adb004a0c8e7c46ee66cad73671f37b4 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm1200.tfm" 1136768653 3584 f80ddd985bd00e29e9a6047ebd9d4781 ""
"/usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm1440.tfm" 1136768653 3584 3169d30142b88a27d4ab0e3468e963a2 ""
@ -46,6 +50,7 @@
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb" 1248133631 36299 5f9df58c2139e7edcf37c8fca4bd384d ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb" 1248133631 36281 c355509802a035cadc5f15869451dcee ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb" 1248133631 35752 024fb6c41858982481f6968b5fc26508 ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr5.pfb" 1248133631 31809 8670ca339bf94e56da1fc21c80635e2a ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb" 1248133631 32762 224316ccc9ad3ca0423a14971cfa7fc1 ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb" 1248133631 32569 5e5ddc8df908dea60932f3c484a54c0d ""
"/usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb" 1248133631 32716 08e384dc442464e7285e891af9f45947 ""
@ -134,24 +139,24 @@
"/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc" 1565080000 2971 def0b6c1f0b107b3b936def894055589 ""
"/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc" 1565080000 2900 1537cc8184ad1792082cd229ecc269f4 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx1000.pfb" 1565080000 145408 43d44302ca7d82d487f511f83e309505 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx1200.pfb" 1624878812 140176 d4962f948b4cc0adf4d3dde77a128c95 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb" 1624878812 135942 859a90cad7494a1e79c94baf546d7de5 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx2074.pfb" 1624878812 140194 627cc7f36c05b80e25d178974ccb3442 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx2488.pfb" 1624878812 135938 299ac3a69892db3b7674a8b2543b0a77 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx1200.pfb" 1635008356 140176 d4962f948b4cc0adf4d3dde77a128c95 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb" 1635008356 135942 859a90cad7494a1e79c94baf546d7de5 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx2074.pfb" 1635008356 140194 627cc7f36c05b80e25d178974ccb3442 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfbx2488.pfb" 1635008356 135938 299ac3a69892db3b7674a8b2543b0a77 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb" 1565080000 138258 6525c253f16cededa14c7fd0da7f67b2 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfrm1200.pfb" 1624878812 136101 f533469f523533d38317ab5729d00c8a ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfrm1728.pfb" 1624878812 131438 3aa300b3e40e5c8ba7b4e5c6cebc5dd6 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfrm1200.pfb" 1635008356 136101 f533469f523533d38317ab5729d00c8a ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfrm1728.pfb" 1635008356 131438 3aa300b3e40e5c8ba7b4e5c6cebc5dd6 ""
"/usr/share/texmf/fonts/type1/public/cm-super/sfti1000.pfb" 1565080000 186554 e8f0fa8ca05e038f257a06405232745f ""
"/usr/share/texmf/web2c/texmf.cnf" 1613593815 38841 799d1dd9682a55ce442e10c99777ecc1 ""
"/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map" 1624878842 5160710 ecf427ae8fa19139d8691f526e47bb9b ""
"/var/lib/texmf/web2c/pdftex/pdflatex.fmt" 1624878876 2570852 ef2a47e64eb64912b01ccaedc81044b8 ""
"projectA.aux" 1636562355 6685 63dddfb0988a9db0d4ffd399103f6601 "pdflatex"
"projectA.out" 1636562355 2848 ab2d85b1aeb40c5b6549c89277facc94 "pdflatex"
"projectA.tex" 1636562354 18255 e6b15b580c018a44cae8a28806057e96 ""
"projectA.toc" 1636562355 3775 bed17e2056b97f55fa15459455b98f4f "pdflatex"
"/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map" 1635008389 5160710 ecf427ae8fa19139d8691f526e47bb9b ""
"/var/lib/texmf/web2c/pdftex/pdflatex.fmt" 1635008460 2570450 6e12b1c097cbda0f70015645294afd24 ""
"projectA.aux" 1636652316 7542 3466a5c49e146316b2747c87e3182194 "pdflatex"
"projectA.out" 1636652316 2911 459e056486686f90e191bd60beda3c97 "pdflatex"
"projectA.tex" 1636652315 22941 64789b46d963c8fcfba0c8d9b0e3b707 ""
"projectA.toc" 1636652316 4302 46ea473c6ff48ccab560b42034bf7a52 "pdflatex"
(generated)
"projectA.out"
"projectA.log"
"projectA.toc"
"projectA.pdf"
"projectA.toc"
"projectA.aux"

View File

@ -1,4 +1,4 @@
PWD /home/kuchy/Zlew/Studia/SEM_5/enume_done/matlabproject/projectA
PWD /home/kuchy/Zlew/Studia/SEM_5/enume_done/Project/matlabproject/ENUME_Project_31/projectA
INPUT /etc/texmf/web2c/texmf.cnf
INPUT /usr/share/texmf/web2c/texmf.cnf
INPUT /usr/share/texlive/texmf-dist/web2c/texmf.cnf
@ -818,6 +818,10 @@ INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecti1000.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx10.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx7.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/public/cm/cmbx5.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm0700.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx0700.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecrm0500.tfm
INPUT /usr/share/texlive/texmf-dist/fonts/tfm/jknappen/ec/ecbx0500.tfm
INPUT /usr/share/texlive/texmf-dist/tex/latex/bera/ts1fvm.fd
INPUT /usr/share/texlive/texmf-dist/tex/latex/bera/ts1fvm.fd
INPUT /usr/share/texlive/texmf-dist/tex/latex/bera/ts1fvm.fd
@ -836,6 +840,7 @@ INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr5.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb
INPUT /usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb

View File

@ -1,4 +1,4 @@
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) (preloaded format=pdflatex 2021.6.28) 10 NOV 2021 17:39
This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020/Debian) (preloaded format=pdflatex 2021.10.23) 11 NOV 2021 18:38
entering extended mode
restricted \write18 enabled.
file:line:error style messages enabled.
@ -530,65 +530,75 @@ Chapter 3.
[11
] [12]
./projectA.tex:472: Extra }, or forgotten $.
l.472 l_{n1} & l_{n2} & l_{n3} & \cdots & 0}
I've deleted a group-closing symbol because it seems to be
spurious, as in `$x}$'. But perhaps the } is legitimate and
you forgot something else, as in `\hbox{$x}'. In such cases
the way to recover is to insert both the forgotten and the
deleted material, e.g., by typing `I$}'.
[13] [14] [15] [16]
Chapter 4.
[13
[17
]
Chapter 5.
LaTeX Font Info: Trying to load font information for TS1+fvm on input line 442.
LaTeX Font Info: Trying to load font information for TS1+fvm on input line 590.
(/usr/share/texlive/texmf-dist/tex/latex/bera/ts1fvm.fd
File: ts1fvm.fd 2004/09/07 scalable font definitions for TS1/fvm.
)
LaTeX Font Info: Font shape `TS1/fvm/m/n' will be
(Font) scaled to size 8.50006pt on input line 442.
[14
(Font) scaled to size 8.50006pt on input line 590.
[18
] [15] [16]
] [19] [20]
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 547.
(textcomp) Default family used instead on input line 695.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 549.
[17]
(textcomp) Default family used instead on input line 697.
[21]
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 560.
(textcomp) Default family used instead on input line 708.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 561.
(textcomp) Default family used instead on input line 709.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 570.
(textcomp) Default family used instead on input line 718.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 582.
(textcomp) Default family used instead on input line 730.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 595.
(textcomp) Default family used instead on input line 743.
Package textcomp Info: Symbol \textminus not provided by
(textcomp) font family fvm in TS1 encoding.
(textcomp) Default family used instead on input line 596.
[18] [19
(textcomp) Default family used instead on input line 744.
[22] [23
] (./projectA.aux)
Package rerunfilecheck Info: File `projectA.out' has not changed.
(rerunfilecheck) Checksum: AB2D85B1AEB40C5B6549C89277FACC94;2848.
(rerunfilecheck) Checksum: 459E056486686F90E191BD60BEDA3C97;2911.
)
Here is how much of TeX's memory you used:
12516 strings out of 479304
217744 string characters out of 5869779
803334 words of memory out of 5000000
29304 multiletter control sequences out of 15000+600000
421462 words of font info for 72 fonts, out of 8000000 for 9000
12539 strings out of 479304
217974 string characters out of 5869778
942409 words of memory out of 5000000
29309 multiletter control sequences out of 15000+600000
424556 words of font info for 76 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
81i,8n,88p,411b,2249s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/bera/fvmr8a.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1000.pfb></usr/share/texmf/fonts/type1/public/cm-supe
r/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2074.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2488.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1728.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfti1000.pfb>
Output written on projectA.pdf (20 pages, 278345 bytes).
81i,8n,88p,407b,2253s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}{/usr/share/texmf/fonts/enc/dvips/cm-super/cm-super-ts1.enc}{/usr/share/texlive/texmf-dist/fonts/enc/dvips/base/8r.enc}</usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmbx7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmex10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr5.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy10.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/amsfonts/cm/cmsy7.pfb></usr/share/texlive/texmf-dist/fonts/type1/public/bera/fvmr8a.pfb></usr/share/texmf/fonts/type1/pu
blic/cm-super/sfbx1000.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx1440.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2074.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfbx2488.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1000.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1200.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfrm1728.pfb></usr/share/texmf/fonts/type1/public/cm-super/sfti1000.pfb>
Output written on projectA.pdf (24 pages, 296296 bytes).
PDF statistics:
549 PDF objects out of 1000 (max. 8388607)
502 compressed objects within 6 object streams
190 named destinations out of 1000 (max. 500000)
321 words of extra memory for PDF output out of 10000 (max. 10000000)
585 PDF objects out of 1000 (max. 8388607)
533 compressed objects within 6 object streams
204 named destinations out of 1000 (max. 500000)
329 words of extra memory for PDF output out of 10000 (max. 10000000)

View File

@ -17,24 +17,25 @@
\BOOKMARK [0][-]{chapter.3}{Problem 3 - Solving a system of n linear equations - iterative algorithm}{}% 17
\BOOKMARK [1][-]{section.3.1}{Problem}{chapter.3}% 18
\BOOKMARK [1][-]{section.3.2}{Theoretical introduction}{chapter.3}% 19
\BOOKMARK [1][-]{section.3.3}{Solution}{chapter.3}% 20
\BOOKMARK [1][-]{section.3.4}{Discussion of the result}{chapter.3}% 21
\BOOKMARK [0][-]{chapter.4}{Problem 4 - QR method of finding eigenvalues}{}% 22
\BOOKMARK [1][-]{section.4.1}{Problem}{chapter.4}% 23
\BOOKMARK [1][-]{section.4.2}{Theoretical introduction}{chapter.4}% 24
\BOOKMARK [1][-]{section.4.3}{Solution}{chapter.4}% 25
\BOOKMARK [1][-]{section.4.4}{Discussion of the result}{chapter.4}% 26
\BOOKMARK [0][-]{chapter.5}{Code appendix}{}% 27
\BOOKMARK [1][-]{section.5.1}{Task 2 Code}{chapter.5}% 28
\BOOKMARK [2][-]{subsection.5.1.1}{Main function}{section.5.1}% 29
\BOOKMARK [2][-]{subsection.5.1.2}{checkIfMatrixIsSquareMatrix}{section.5.1}% 30
\BOOKMARK [2][-]{subsection.5.1.3}{gaussianEliminationWithPartialPivoting}{section.5.1}% 31
\BOOKMARK [2][-]{subsection.5.1.4}{partialPivoting}{section.5.1}% 32
\BOOKMARK [2][-]{subsection.5.1.5}{partialPivotingSwapOneRow}{section.5.1}% 33
\BOOKMARK [2][-]{subsection.5.1.6}{swapRowMatrix}{section.5.1}% 34
\BOOKMARK [2][-]{subsection.5.1.7}{swapValueVector}{section.5.1}% 35
\BOOKMARK [2][-]{subsection.5.1.8}{gaussianElimination}{section.5.1}% 36
\BOOKMARK [2][-]{subsection.5.1.9}{substractRows}{section.5.1}% 37
\BOOKMARK [2][-]{subsection.5.1.10}{backSubstitutionPhase}{section.5.1}% 38
\BOOKMARK [2][-]{subsection.5.1.11}{iterativeResidualCorrection}{section.5.1}% 39
\BOOKMARK [2][-]{subsection.5.1.12}{improveSolution}{section.5.1}% 40
\BOOKMARK [2][-]{subsection.3.2.1}{Procedure}{section.3.2}% 20
\BOOKMARK [1][-]{section.3.3}{Solution}{chapter.3}% 21
\BOOKMARK [1][-]{section.3.4}{Discussion of the result}{chapter.3}% 22
\BOOKMARK [0][-]{chapter.4}{Problem 4 - QR method of finding eigenvalues}{}% 23
\BOOKMARK [1][-]{section.4.1}{Problem}{chapter.4}% 24
\BOOKMARK [1][-]{section.4.2}{Theoretical introduction}{chapter.4}% 25
\BOOKMARK [1][-]{section.4.3}{Solution}{chapter.4}% 26
\BOOKMARK [1][-]{section.4.4}{Discussion of the result}{chapter.4}% 27
\BOOKMARK [0][-]{chapter.5}{Code appendix}{}% 28
\BOOKMARK [1][-]{section.5.1}{Task 2 Code}{chapter.5}% 29
\BOOKMARK [2][-]{subsection.5.1.1}{Main function}{section.5.1}% 30
\BOOKMARK [2][-]{subsection.5.1.2}{checkIfMatrixIsSquareMatrix}{section.5.1}% 31
\BOOKMARK [2][-]{subsection.5.1.3}{gaussianEliminationWithPartialPivoting}{section.5.1}% 32
\BOOKMARK [2][-]{subsection.5.1.4}{partialPivoting}{section.5.1}% 33
\BOOKMARK [2][-]{subsection.5.1.5}{partialPivotingSwapOneRow}{section.5.1}% 34
\BOOKMARK [2][-]{subsection.5.1.6}{swapRowMatrix}{section.5.1}% 35
\BOOKMARK [2][-]{subsection.5.1.7}{swapValueVector}{section.5.1}% 36
\BOOKMARK [2][-]{subsection.5.1.8}{gaussianElimination}{section.5.1}% 37
\BOOKMARK [2][-]{subsection.5.1.9}{substractRows}{section.5.1}% 38
\BOOKMARK [2][-]{subsection.5.1.10}{backSubstitutionPhase}{section.5.1}% 39
\BOOKMARK [2][-]{subsection.5.1.11}{iterativeResidualCorrection}{section.5.1}% 40
\BOOKMARK [2][-]{subsection.5.1.12}{improveSolution}{section.5.1}% 41

Binary file not shown.

Binary file not shown.

View File

@ -335,7 +335,9 @@ We should also try to solve the equations from problem 2a) and 2b) for n = 10 us
\section{Theoretical introduction}
Itertaive methods differ from the Gauss elimination method since they are iterative, which means that our solution will improve with each iteration. Building on that we can cnclude that the number of iterations will depend on what accuracy we want to achieve.
We should also answer the question what happens if the sufficient condition is not fullfiled.
Itertaive methods differ from the Gauss elimination method since they are iterative, which means that our solution will improve with each iteration. Building on that we can cnclude that the number of iterations will depend on what accuracy we want to achieve. Since we are using iterative method we don't have the guarantee of how many iterations will be neeeded before we reach the solution,
In general:
We start with:
@ -346,6 +348,9 @@ And we generate next vectors \textbf{$x^{i+1}$} in such way:
Where $\mathbf{M}$ is some matrix.
\subsection{Procedure}
\subsubsection{Decomposing matrix}
For both Jacobi and Gauss-Seidel method we first decompose starting matrix $ \mathbf{A} $ to:
\[ \mathbf{A} = \mathbf{L} + \mathbf{D} + \mathbf{U} \]
where:
@ -376,8 +381,8 @@ We can get:
\end{bmatrix}
\]
\[ \mathbf{U} = \begin{bmatrix}
0 & 0 & 0\\
0 & 0 & 0\\
0 & 3 & 3\\
0 & 0 & 3\\
0 & 0 & 0
\end{bmatrix}
\]
@ -412,10 +417,153 @@ so:
\end{bmatrix}
\]
\subsubsection{Jacobi's method}
After decomposing matrix we can write the system of equations
\[ \mathbf{A}\mathbf{x} = \mathbf{b} \]
in the form:
\[ \mathbf{D}\mathbf{x} = -(\mathbf{L}+\mathbf{U})\mathbf{x}+\mathbf{b}
\]
If we assume that diagonal entries of matrix \textbf{A} are nonzero, then matrix \textbf{D} is nonsingular therefore we can propose such an iterative method:
\[ \mathbf{x}^{i+1} = -\mathbf{D}^{-1}(\mathbf{L}+\mathbf{U})\mathbf{x}^{(i)}+\mathbf{D}^{-1}\mathbf{x}
\]
This is the Jacobi's method.
We can rewritte this equation in the form of \textit{n} independent scalar equations:
\[
{x}_j^{i+1} = -\frac{1}{d_{jj}}(
\sum^n_{k=1} (l_{jk} + u_{jk})x_k^{(i)}+b_j)
) \]
Where $d_{jj}$; $l_{jk}$; $u_{jk}$ are the elements of the respective matrixes \textbf{D}, \textbf{L}, \textbf{U}
Thanks to this we can do those computations in paraller, totally or partially if we are using a computer that enables a parallelization of the computations.
\paragraph{Converging}
Jacobi's method is convergent if we have strong diagonal dominance of the matrix \textbf{A}
\subsubsection{Gauss-Seidel method}
After decomposing matrix we can write the system of equations
\[ \mathbf{A}\mathbf{x} = \mathbf{b} \]
in the form:
\[ (\mathbf{L}+\mathbf{D})\mathbf{x} = -\mathbf{U}\mathbf{x}+\mathbf{b}
\]
Again we assume that \textbf{D} is nonsingular, in doing so we propose following iterative method:
\[ \mathbf{D}\mathbf{x}^{(i+1)} = -\mathbf{L}\mathbf{x}^{(i+1)}-\mathbf{U}\mathbf{x}^{(i)}+\mathbf{b}
\]
Since matrix \textbf{L} is subdiagonal, provided that we organse the calculation of elements of the vector $x^{(i_1)}$ in a proper way, it does not hurt that $x^{(i_1)}$ is on the right side of the equation.
In order to organise the calculation in the correct way we:
First take into account the structure of matrixes \textbf{D} and \textbf{L}:
\[
\begin{bmatrix}
d_{11}x_1^{(i_1)}\\
d_{22}x_2^{(i_1)}\\
d_{33}x_3^{(i_1)}\\
\vdots\\
d_{nn}x_n^{(i_1)}
\end{bmatrix}
=
-
\begin{bmatrix}
0 & 0 & 0 & \cdots & 0\\
l_{21} & 0 & 0 & \cdots & 0\\
l_{32} & l_{32} & 0 & \cdots & 0\\
\vdots & \vdots & \vdots & \vdots & \vdots\\
l_{n1} & l_{n2} & l_{n3} & \cdots & 0}
\end{bmatrix}
\begin{bmatrix}
x_1^{(i_1)}\\
x_2^{(i_1)}\\
x_3^{(i_1)}\\
\vdots\\
x_n^{(i_1)}
\end{bmatrix}
-
\mathbf{w}^{(i)}
\]
Where
\[ \mathbf{w}^{(i)} = \mathbf{U}\mathbf{x}^{(i)} - \mathbf{b} \]
\newpage
So the order of calculations is as follows:
\[ x_1^{(i+1)} = -\frac{w_1^{(i)}}{d_{11}} \]
\[ x_2^{(i+1)} = -\frac{-l_{21}x_1^{(i+1)} - w_2^{(i)}}{d_{22}} \]
\[ x_3^{(i+1)} = -\frac{-l_{31}x_1^{(i+1)} -l_{32}x_2^{(i+1)} - w_3^{(i)}}{d_{33}} \]
And so on
As opposed to Jacobi's method, Gauss-Seidel method computations must be performed sequentially. Every subsequent scalar equations uses results from the computation of the previous equations.
\paragraph{Converging}
Gauss-Seidel method is convergent if the matrix \textbf{A} is strongly row or column diagonnaly dominant. If the matrix is symmetric, the method is also convergent if the matrix \textbf{A} is positive definite. This method is also usually faster convergent compared to Jacobi's method.
\subsubsection{Stop tests}
There are two ways to check when to terminate iterations of the methods we just discussed:
\begin{enumerate}
\item Check differences between two subsequent iteration points
\[
\| \mathbf{x}^{(i+1)} - \mathbf{x}^{(i)} \| \leq \delta
\]
Where $\delta$ is an assumed tolerance, (in our case $10^{-10}$). What we are really interested in though is whether the solution of the system of equation has required accuracy. If we want to check that we can additionaly check (higher level, more computationally demanding test):
\item Check differences between two subsequent iteration points
\[
\| \mathbf{A}\mathbf{x}^{(i+1)} - \mathbf{b}\| \leq \delta_2
\]
Where $\delta_2$ is an assumed tolerance. If this test is not passed then we can diminish the value of $\delta_2$ and continue with the iterations. Value of $\delta_2$ can not be too small since we are limited by the numerical errors.
\end{enumerate}
\subsubsection{\textbf{A} and \textbf{b}}
We have been given with the following system:
\[
\systeme{10x_1-4x_2+x_3+2x_4=-8, 2x_1-6x_2+3x_3-x_4=-12, x_1+4x_2-12x_3+x_4=4, 2x_1+3x_2-3x_3-10x_4=1}
\]
Therefore our matrices will look like this:
\[
\textbf{A} = \begin{bmatrix}
10 & -4 & 1 & 2 \\
2 & -6 & 3 & -1 \\
1 & 4 & -12 & 1 \\
2 & 3 & -3 & -10
\end{bmatrix}
\textbf{b} = \begin{bmatrix}
-8 \\
-12 \\
4 \\
11 \\
\end{bmatrix}
\]
So:
\[
\textbf{L} = \begin{bmatrix}
0 & 0 & 0 & 0 \\
2 & 0 & 0 & 0 \\
1 & 4 & 0 & 0 \\
2 & 3 & -3 & 0
\end{bmatrix}
\textbf{D} = \begin{bmatrix}
10 & 0 & 0 & 0 \\
0 & -6 & 0 & 0 \\
0 & 0 & -12 & 0 \\
0 & 0 & 0 & -10
\end{bmatrix}
\textbf{U} = \begin{bmatrix}
0 & -4 & 1 & 2 \\
0 & 0 & 3 & -1 \\
0 & 0 & 0 & 1 \\
0 & 0 & 0 & 0
\end{bmatrix}
\]
\[
\textbf{D}^{-1} = \begin{bmatrix}
\frac{1}{10} & 0 & 0 & 0 \\
0 & - \frac{1}{6} & 0 & 0 \\
0 & 0 & - \frac{1}{12} & 0 \\
0 & 0 & 0 & - \frac{1}{10}
\end{bmatrix}
\]
Since we are using iterative method we don't have the guarantee of how many iteratiosn will be neeeded before we reach the solution,
we also need to resolve the issue of convergence, the method we use may converge or it may not. We need to find what condition the method converges. We know that there is a sufficient condition which is faster but not 100 \% correct, the sufficient and necessary condition is slower but 100 \% correct. We should also answer the question what happens if the sufficient condition is not fullfiled.
We also need to desin stop tests, when are we going to stop the process
\section{Solution}
\section{Discussion of the result}
@ -505,7 +653,7 @@ end % end function
\end{lstlisting}
\end{simplechar}
\newpage
\subsection{swapRowMatrix}
\begin{simplechar}
\begin{lstlisting}

View File

@ -22,24 +22,32 @@
\contentsline {chapter}{\numberline {3}Problem 3 - Solving a system of n linear equations - iterative algorithm}{11}{chapter.3}%
\contentsline {section}{\numberline {3.1}Problem}{11}{section.3.1}%
\contentsline {section}{\numberline {3.2}Theoretical introduction}{11}{section.3.2}%
\contentsline {section}{\numberline {3.3}Solution}{12}{section.3.3}%
\contentsline {section}{\numberline {3.4}Discussion of the result}{12}{section.3.4}%
\contentsline {chapter}{\numberline {4}Problem 4 - QR method of finding eigenvalues}{13}{chapter.4}%
\contentsline {section}{\numberline {4.1}Problem}{13}{section.4.1}%
\contentsline {section}{\numberline {4.2}Theoretical introduction}{13}{section.4.2}%
\contentsline {section}{\numberline {4.3}Solution}{13}{section.4.3}%
\contentsline {section}{\numberline {4.4}Discussion of the result}{13}{section.4.4}%
\contentsline {chapter}{\numberline {5}Code appendix}{14}{chapter.5}%
\contentsline {section}{\numberline {5.1}Task 2 Code}{14}{section.5.1}%
\contentsline {subsection}{\numberline {5.1.1}Main function}{14}{subsection.5.1.1}%
\contentsline {subsection}{\numberline {5.1.2}checkIfMatrixIsSquareMatrix}{14}{subsection.5.1.2}%
\contentsline {subsection}{\numberline {5.1.3}gaussianEliminationWithPartialPivoting}{16}{subsection.5.1.3}%
\contentsline {subsection}{\numberline {5.1.4}partialPivoting}{16}{subsection.5.1.4}%
\contentsline {subsection}{\numberline {5.1.5}partialPivotingSwapOneRow}{16}{subsection.5.1.5}%
\contentsline {subsection}{\numberline {5.1.6}swapRowMatrix}{17}{subsection.5.1.6}%
\contentsline {subsection}{\numberline {5.1.7}swapValueVector}{17}{subsection.5.1.7}%
\contentsline {subsection}{\numberline {5.1.8}gaussianElimination}{17}{subsection.5.1.8}%
\contentsline {subsection}{\numberline {5.1.9}substractRows}{17}{subsection.5.1.9}%
\contentsline {subsection}{\numberline {5.1.10}backSubstitutionPhase}{18}{subsection.5.1.10}%
\contentsline {subsection}{\numberline {5.1.11}iterativeResidualCorrection}{18}{subsection.5.1.11}%
\contentsline {subsection}{\numberline {5.1.12}improveSolution}{18}{subsection.5.1.12}%
\contentsline {subsection}{\numberline {3.2.1}Procedure}{12}{subsection.3.2.1}%
\contentsline {subsubsection}{Decomposing matrix}{12}{section*.6}%
\contentsline {subsubsection}{Jacobi's method}{13}{section*.7}%
\contentsline {paragraph}{Converging}{13}{section*.8}%
\contentsline {subsubsection}{Gauss-Seidel method}{13}{section*.9}%
\contentsline {paragraph}{Converging}{15}{section*.10}%
\contentsline {subsubsection}{Stop tests}{15}{section*.11}%
\contentsline {subsubsection}{\textbf {A} and \textbf {b}}{15}{section*.12}%
\contentsline {section}{\numberline {3.3}Solution}{16}{section.3.3}%
\contentsline {section}{\numberline {3.4}Discussion of the result}{16}{section.3.4}%
\contentsline {chapter}{\numberline {4}Problem 4 - QR method of finding eigenvalues}{17}{chapter.4}%
\contentsline {section}{\numberline {4.1}Problem}{17}{section.4.1}%
\contentsline {section}{\numberline {4.2}Theoretical introduction}{17}{section.4.2}%
\contentsline {section}{\numberline {4.3}Solution}{17}{section.4.3}%
\contentsline {section}{\numberline {4.4}Discussion of the result}{17}{section.4.4}%
\contentsline {chapter}{\numberline {5}Code appendix}{18}{chapter.5}%
\contentsline {section}{\numberline {5.1}Task 2 Code}{18}{section.5.1}%
\contentsline {subsection}{\numberline {5.1.1}Main function}{18}{subsection.5.1.1}%
\contentsline {subsection}{\numberline {5.1.2}checkIfMatrixIsSquareMatrix}{18}{subsection.5.1.2}%
\contentsline {subsection}{\numberline {5.1.3}gaussianEliminationWithPartialPivoting}{20}{subsection.5.1.3}%
\contentsline {subsection}{\numberline {5.1.4}partialPivoting}{20}{subsection.5.1.4}%
\contentsline {subsection}{\numberline {5.1.5}partialPivotingSwapOneRow}{20}{subsection.5.1.5}%
\contentsline {subsection}{\numberline {5.1.6}swapRowMatrix}{20}{subsection.5.1.6}%
\contentsline {subsection}{\numberline {5.1.7}swapValueVector}{21}{subsection.5.1.7}%
\contentsline {subsection}{\numberline {5.1.8}gaussianElimination}{21}{subsection.5.1.8}%
\contentsline {subsection}{\numberline {5.1.9}substractRows}{21}{subsection.5.1.9}%
\contentsline {subsection}{\numberline {5.1.10}backSubstitutionPhase}{22}{subsection.5.1.10}%
\contentsline {subsection}{\numberline {5.1.11}iterativeResidualCorrection}{22}{subsection.5.1.11}%
\contentsline {subsection}{\numberline {5.1.12}improveSolution}{22}{subsection.5.1.12}%

View File

@ -0,0 +1,2 @@
function Matrix = task2Matrix
Matrix = [10 -4 1 2; 2 -6 3 -1; 1 4 -12 1; 2 3 -3 -10];

View File

@ -0,0 +1,4 @@
function Matrix = task2Matrix
Matrix = [10 -4 1 2; 2 -6 3 -1; 1 4 -12 1; 2 3 -3 -10];
function Vector = task2Vector
Vector = [-8 -12 4 1];

View File

@ -0,0 +1,6 @@
function Vector = task2Vector
Vector = zeros(4, 1);
Vector(1, 1) = -8;
Vector(2, 1) = -12;
Vector(3, 1) = 4;
Vector(4, 1) = 1;

View File

@ -3,6 +3,13 @@ Useful links:
Problem 1:
https://stackoverflow.com/questions/27511349/how-to-calculate-machine-epsilon-in-matlab - How to calculate machine epsilion
Problem 3:
https://www.mathworks.com/help/matlab/learn_matlab/matrices-and-arrays.html - Matrices and arrays MATLAB
https://www.mathworks.com/help/matlab/ref/break.html - Get out of while loop
mathworks.com/help/matlab/ref/triu.html - upper triangular matrix in matlab
LaTeX related:
https://latex-tutorial.com/symbols/text-formatting/ - Italics
@ -30,7 +37,7 @@ https://stackoverflow.com/questions/48240982/how-do-you-align-a-system-of-equati
https://tex.stackexchange.com/questions/526025/problem-with-vdotswithin - vdots alligned to equal sign
https://www.overleaf.com/learn/latex/Brackets_and_Parentheses - Curly brackets latex
https://www.overleaf.com/learn/latex/Brackets_and_Parentheses - Curly brackets, double 'pipes'
https://tex.stackexchange.com/questions/130516/how-to-write-something-vertically-below-another-math-symbol - Symbol vertically below another
@ -47,3 +54,5 @@ https://tex.stackexchange.com/questions/508341/writing-a-system-of-linear-equati
https://www.overleaf.com/learn/latex/Matrices - matrixes latex
https://tex.stackexchange.com/questions/294561/using-textbf-vs-mathbf-in-math-mode - mathbf vs textbf
https://www.math-linux.com/latex-26/faq/latex-faq/article/how-to-get-dots-in-latex-ldots-cdots-vdots-and-ddots - Dots LaTeX