# HW 1 laudari sudip

## 2303 days ago by bigdata2016

A = matrix(QQ, [[1, 2, 1, 2, 1, 2, 4],[0, 1, 1, 0, 0, 1, 0],[2, 0, 0, 1, 1, 2, 0],[1, 0, 1, 2, 4, 0, 0],[1, 1, 2, 0, 0, 1, 1],[1, 1, 6, 3, 0, 1, 0],[1, 1, 3, -1, 1, 1, 0]]) show(A)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrrrr} 1 & 2 & 1 & 2 & 1 & 2 & 4 \\ 0 & 1 & 1 & 0 & 0 & 1 & 0 \\ 2 & 0 & 0 & 1 & 1 & 2 & 0 \\ 1 & 0 & 1 & 2 & 4 & 0 & 0 \\ 1 & 1 & 2 & 0 & 0 & 1 & 1 \\ 1 & 1 & 6 & 3 & 0 & 1 & 0 \\ 1 & 1 & 3 & -1 & 1 & 1 & 0 \end{array}\right)
P, L, U = A.LU() show(P) show(L) show(U)
 \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrrrr} 0 & 1 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 & 0 & 0 & 0 \\ 0 & 0 & 0 & 1 & 0 & 0 & 0 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrrrr} 1 & 0 & 0 & 0 & 0 & 0 & 0 \\ \frac{1}{2} & 1 & 0 & 0 & 0 & 0 & 0 \\ \frac{1}{2} & \frac{1}{2} & 1 & 0 & 0 & 0 & 0 \\ \frac{1}{2} & \frac{1}{2} & \frac{5}{11} & 1 & 0 & 0 & 0 \\ \frac{1}{2} & 0 & \frac{2}{11} & -\frac{26}{67} & 1 & 0 & 0 \\ 0 & \frac{1}{2} & \frac{1}{11} & \frac{20}{67} & -\frac{24}{259} & 1 & 0 \\ \frac{1}{2} & \frac{1}{2} & \frac{3}{11} & \frac{38}{67} & -\frac{59}{259} & -\frac{19}{23} & 1 \end{array}\right) \newcommand{\Bold}[1]{\mathbf{#1}}\left(\begin{array}{rrrrrrr} 2 & 0 & 0 & 1 & 1 & 2 & 0 \\ 0 & 2 & 1 & \frac{3}{2} & \frac{1}{2} & 1 & 4 \\ 0 & 0 & \frac{11}{2} & \frac{7}{4} & -\frac{3}{4} & -\frac{1}{2} & -2 \\ 0 & 0 & 0 & -\frac{67}{22} & \frac{13}{22} & -\frac{3}{11} & -\frac{12}{11} \\ 0 & 0 & 0 & 0 & \frac{259}{67} & -\frac{68}{67} & -\frac{4}{67} \\ 0 & 0 & 0 & 0 & 0 & \frac{138}{259} & -\frac{388}{259} \\ 0 & 0 & 0 & 0 & 0 & 0 & -\frac{25}{23} \end{array}\right)
x=U^(-1)*L^(-1)*P^(-1)*b x
 [ 24/5] [ 77/15] [ 0] [ -4/15] [ -1/15] [-47/15] [ -9/5] [ 24/5] [ 77/15] [ 0] [ -4/15] [ -1/15] [-47/15] [ -9/5]
b=matrix(QQ, [[1,2,3,4,5,6,7]]) b=transpose(b)
A*x==b
 True True