271 lines
9 KiB
TeX
271 lines
9 KiB
TeX
% vim: set ts=2 sw=2 et tw=80:
|
|
|
|
\documentclass[12pt,a4paper]{article}
|
|
|
|
\usepackage[utf8]{inputenc} \usepackage[margin=2cm]{geometry}
|
|
\usepackage{amstext} \usepackage{amsmath} \usepackage{array}
|
|
\newcommand{\lra}{\Leftrightarrow}
|
|
|
|
\title{Howework 3 -- Introduction to Computational Science}
|
|
|
|
\author{Claudio Maggioni}
|
|
|
|
\begin{document} \maketitle
|
|
\section*{Question 1}
|
|
\[i=1 \hspace{1cm} l_1 = \begin{bmatrix}1\\1\\5\\-3\\\end{bmatrix} \hspace{1cm} u_1 = \begin{bmatrix}
|
|
2 & 1 & 1 & -2 \\\end{bmatrix}\]
|
|
\[A_2 = \begin{bmatrix}
|
|
2 & 1 & 1 &-2 \\ 2 & 2 & -2 & -1 \\ 10 & 4 & 23 & -8 \\
|
|
-6 & -2 & 4 & 6 \\\end{bmatrix} - \begin{bmatrix}
|
|
2 & 1 & 1 & -2 \\ 2 &1& 1 &-2 \\ 10 & 5 & 5 & -10 \\ -6 & -3 & -3 & 6 \\\end{bmatrix} = \begin{bmatrix}\\& 1 & -3 & 1 \\ & -1 & 18 & 2 \\ & 1 & 7 & 0 \end{bmatrix}\]
|
|
|
|
\[i = 2 \hspace{1cm} l_2 = \begin{bmatrix}\\1 \\-1 \\1\\\end{bmatrix} \hspace{1cm} u_2 = \begin{bmatrix} & 1& -3& 1\\\end{bmatrix}\]
|
|
\[A_3 = \begin{bmatrix}\\& 1 & -3 & 1 \\ & -1 & 18 & 2 \\ & 1 & 7 & 0 \end{bmatrix} - \begin{bmatrix}\\&1 & -3 & 1 \\ & -1 & 3 & -1 \\ & 1 & -3 & 1 \\\end{bmatrix} = \begin{bmatrix}
|
|
\\
|
|
\\
|
|
&&15&3\\&&10&-1\\\end{bmatrix}\]
|
|
|
|
\[i = 3 \hspace{1cm} l_3 = \begin{bmatrix}\\\\1\\2/3\\\end{bmatrix} \hspace{1cm} u_3 = \begin{bmatrix}&& 15 & 3 \\ \end{bmatrix}\]
|
|
\[A_4 = \begin{bmatrix}
|
|
\\
|
|
\\
|
|
&&15&3\\&&10&-1\\\end{bmatrix} - \begin{bmatrix}\\\\&&15 & 3 \\&&10 & 2 \\\end{bmatrix} = \begin{bmatrix}\\\\\\&&&-3\\\end{bmatrix}\]
|
|
\[i = 4 \hspace{1cm} l_4 = \begin{bmatrix}\\\\\\1\\\end{bmatrix} \hspace{1cm} u_4 = \begin{bmatrix}&&& -3 \\ \end{bmatrix}\]
|
|
\[L = \begin{bmatrix}1\\1&1\\5&-1&1\\-3 &1 &2/3&1\\\end{bmatrix} \hspace{1cm} U = \begin{bmatrix}2 &1 &1&-2\\&1 &-3&1\\&&15&3\\&&&-3\\\end{bmatrix}\]
|
|
\[Ly = B \Rightarrow \begin{bmatrix}1\\1&1\\5&-1&1\\-3 &1 &2/3&1\\\end{bmatrix} \begin{bmatrix}y_1\\y_2\\y_3\\y_4\\\end{bmatrix} = \begin{bmatrix}-1\\-3\\36\\18\\\end{bmatrix}
|
|
\]
|
|
\[y_1 = -1\]
|
|
\[y_2 = -3 - (-1) \cdot 1 = -2\]
|
|
\[y_3 = 36 - 1 \cdot 2 - (-1) \cdot 5 = 39\]
|
|
\[y_4 = 18 - \frac{2}{3} \cdot 39 - (-2) - (-3) \cdot (-1) = -9\]
|
|
\[Ux = Y \Rightarrow \begin{bmatrix}2 &1 &1&-2\\&1 &-3&1\\&&15&3\\&&&-3\\\end{bmatrix} \begin{bmatrix}x_1\\x_2\\x_3\\x_4\\\end{bmatrix} = \begin{bmatrix}-1\\-2\\39\\-9\\\end{bmatrix}
|
|
\]
|
|
\[x_4 = 3\]
|
|
\[x_3 = \frac{39 - 3 - 3}{15} = 2\]
|
|
\[x_2 = \frac{-2 -3 - (-3) \cdot 2}{1} = 1\]
|
|
\[x_1 = \frac{ -1 - (-2) \cdot 3 - 1 \cdot 2 - 1 \cdot 1}{2} = 1\]
|
|
\[x = \begin{bmatrix}1\\1\\2\\3\\\end{bmatrix}\]
|
|
|
|
\section*{Question 2}
|
|
|
|
\[i = 1 \hspace{1cm} k = 4 \hspace{1cm} \begin{bmatrix}4&2&3&1\\\end{bmatrix}\]
|
|
\[
|
|
l_1 =
|
|
\begin{bmatrix}
|
|
1/8 \\
|
|
1/4 \\
|
|
1/2 \\
|
|
1 \\
|
|
\end{bmatrix}
|
|
\hspace{1cm}
|
|
u_1 = \begin{bmatrix} 32 & 24 & 10 & 11\end{bmatrix}
|
|
\hspace{1cm}
|
|
\]\[
|
|
A_2 = \begin{bmatrix}4 &3 &2& 1\\ 8& 8& 5& 2\\ 16& 12& 10& 5\\ 32& 24& 20 &11 \\\end{bmatrix} - \begin{bmatrix}
|
|
4 & 3 & 5/2 & 11/8 \\
|
|
8 & 6 & 5 & 11/4 \\
|
|
16 & 12 & 10 & 11/2 \\
|
|
32 & 24 & 20 & 11 \\
|
|
\end{bmatrix} =
|
|
\begin{bmatrix}
|
|
0 & 0 & -1/2 & -3/8 \\
|
|
0 & 2 & 0 & -3/4 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix}
|
|
\]
|
|
|
|
\[i = 2 \hspace{1cm} k = 2 \hspace{1cm} p = \begin{bmatrix}4&2&3&1\\\end{bmatrix}\]
|
|
\[
|
|
l_2 =\begin{bmatrix}
|
|
0\\1\\0\\0\\
|
|
\end{bmatrix}
|
|
\hspace{1cm}
|
|
u_2 =\begin{bmatrix} 0 & 2 & 0 & -3/4 \end{bmatrix}\]
|
|
\[
|
|
A_3 = \begin{bmatrix}
|
|
0 & 0 & -1/2 & -3/8 \\
|
|
0 & 2 & 0 & -3/4 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix} -
|
|
\begin{bmatrix}
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 2 & 0 & -3/4 \\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix}
|
|
=
|
|
\begin{bmatrix}
|
|
0 & 0 & -1/2 & -3/8 \\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix}
|
|
\]
|
|
|
|
\[ i = 3 \hspace{1cm} k = 4 \hspace{1cm} p = \begin{bmatrix}
|
|
4&2&1&3\\
|
|
\end{bmatrix}
|
|
\]
|
|
\[
|
|
l_3 = \begin{bmatrix}
|
|
1 \\0\\0\\0\\
|
|
\end{bmatrix}
|
|
\hspace{1cm}
|
|
u_3 = \begin{bmatrix} 0 & 0& -1/2 & -3/8\\\end{bmatrix}
|
|
\]\[
|
|
A_4 = \begin{bmatrix}
|
|
0 & 0 & -1/2 & -3/8 \\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix} -
|
|
\begin{bmatrix}
|
|
0 & 0 & -1/2& -3/8\\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix} =
|
|
\begin{bmatrix}
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & 0 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
0 & 0 & 0 & 0 \\
|
|
\end{bmatrix}
|
|
\]
|
|
|
|
\[ i =4 \hspace{1cm} k = 4 \hspace{1cm} p = \begin{bmatrix}
|
|
4&2&1&3\\
|
|
\end{bmatrix}\]
|
|
\[l_4 = \begin{bmatrix} 0 \\0\\1\\0\\\end{bmatrix}
|
|
u_4 = \begin{bmatrix}0&0&0&-1/2\end{bmatrix}
|
|
\]
|
|
|
|
\[
|
|
P =
|
|
\begin{bmatrix}
|
|
0 & 0 & 0 & 1 \\
|
|
0 & 1 & 0 & 0 \\
|
|
1 & 0 & 0 & 0 \\
|
|
0 & 0 & 1 & 0 \\
|
|
\end{bmatrix}
|
|
\]
|
|
\[
|
|
L = P *
|
|
\begin{bmatrix}
|
|
1/8 & 0 & 1 & 0 \\
|
|
1/4 & 1 & 0 & 0 \\
|
|
1/2 & 0 & 0 & 1 \\
|
|
1 & 0 & 0 & 0 \\
|
|
\end{bmatrix}
|
|
=
|
|
\begin{bmatrix}
|
|
1 & 0 & 0 & 0 \\
|
|
1/4 & 1 & 0 & 0 \\
|
|
1/8 & 0 & 1 & 0 \\
|
|
1/2 & 0 & 0 & 1 \\
|
|
\end{bmatrix}
|
|
\]
|
|
|
|
\[
|
|
U =
|
|
\begin{bmatrix}
|
|
32 & 24 & 20 & 11 \\
|
|
0 & 2 & 0 & -3/4 \\
|
|
0 & 0 & -1/2 & -3/8 \\
|
|
0 & 0 & 0 & -1/2 \\
|
|
\end{bmatrix}
|
|
\]
|
|
|
|
\section*{Question 4}
|
|
A =
|
|
|
|
1 4 8 3
|
|
4 20 40 28
|
|
8 40 89 71
|
|
3 28 71 114
|
|
|
|
|
|
ans =
|
|
|
|
1
|
|
4
|
|
8
|
|
3
|
|
|
|
|
|
S =
|
|
|
|
1 4 8 3
|
|
4 16 32 12
|
|
8 32 64 24
|
|
3 12 24 9
|
|
|
|
|
|
A =
|
|
|
|
0 0 0 0
|
|
0 4 8 16
|
|
0 8 25 47
|
|
0 16 47 105
|
|
|
|
|
|
ans =
|
|
|
|
0
|
|
2
|
|
4
|
|
8
|
|
|
|
|
|
S =
|
|
|
|
0 0 0 0
|
|
0 4 8 16
|
|
0 8 16 32
|
|
0 16 32 64
|
|
|
|
|
|
A =
|
|
|
|
0 0 0 0
|
|
0 0 0 0
|
|
0 0 9 15
|
|
0 0 15 41
|
|
|
|
|
|
ans =
|
|
|
|
0
|
|
0
|
|
3
|
|
5
|
|
|
|
|
|
S =
|
|
|
|
0 0 0 0
|
|
0 0 0 0
|
|
0 0 9 15
|
|
0 0 15 25
|
|
|
|
|
|
A =
|
|
|
|
0 0 0 0
|
|
0 0 0 0
|
|
0 0 0 0
|
|
0 0 0 16
|
|
|
|
|
|
ans =
|
|
|
|
0
|
|
0
|
|
0
|
|
4
|
|
|
|
|
|
|
|
\end{document}
|