ChEn-3170: Computational Methods in Chemical Engineering Spring 2020 UMass Lowell; Prof. V. F. de Almeida 24Feb20
$ \newcommand{\Amtrx}{\boldsymbol{\mathsf{A}}} \newcommand{\Bmtrx}{\boldsymbol{\mathsf{B}}} \newcommand{\Cmtrx}{\boldsymbol{\mathsf{C}}} \newcommand{\Mmtrx}{\boldsymbol{\mathsf{M}}} \newcommand{\Imtrx}{\boldsymbol{\mathsf{I}}} \newcommand{\Pmtrx}{\boldsymbol{\mathsf{P}}} \newcommand{\Qmtrx}{\boldsymbol{\mathsf{Q}}} \newcommand{\Lmtrx}{\boldsymbol{\mathsf{L}}} \newcommand{\Umtrx}{\boldsymbol{\mathsf{U}}} \newcommand{\xvec}{\boldsymbol{\mathsf{x}}} \newcommand{\yvec}{\boldsymbol{\mathsf{y}}} \newcommand{\zvec}{\boldsymbol{\mathsf{z}}} \newcommand{\avec}{\boldsymbol{\mathsf{a}}} \newcommand{\bvec}{\boldsymbol{\mathsf{b}}} \newcommand{\cvec}{\boldsymbol{\mathsf{c}}} \newcommand{\rvec}{\boldsymbol{\mathsf{r}}} \newcommand{\norm}[1]{\bigl\lVert{#1}\bigr\rVert} \DeclareMathOperator{\rank}{rank} \DeclareMathOperator{\abs}{abs} $
your name
¶Context | Points |
---|---|
Precision of the answer | 80% |
Answer Markdown readability | 10% |
Code readability | 10% |
Python
function.NumPy
.Python
function.NumPy
.Python
function.NumPy
.where the multipliers $m_{i,k}$ are given by $m_{i,k} = \frac{A^{(k)}_{i,k}}{A^{(k)}_{k,k}}$. When $k = m-1$, $A^{(m)}_{i,j}$, is upper triangular, that is, $U_{i,j} = A^{(m)}_{i,j}$ . The lower triangular matrix is obtained using the multipliers $m_{i,k}$, that is $L_{i,j} = m_{i,j} \ \forall \ i>j$, $L_{i,i}=1$, and $L_{i,j}=0 \ \forall \ i<j$.
'''1.1) LU factorization function'''
def lu_factorization( mtrx, pivoting_option=None ):
'''1.2) Import matrix'''
'''1.3) Perform LU factorization and verify'''
max(abs((A - LU)) = 8.52651e-14
'''1.4) U diagonal entry w/ smallest magnitude, rank(A), and det(A)'''
min(abs(diag(U)) = 1.25385e-03 my rank(A) = 113 linalg rank(A) = 113 my det(A) = 2.72809e-142 linalg det(A) = 2.72809e-142
'''2.1) LU factorization function'''
'''hint: extend 1.1) and avoid generating additional code here'''
'hint: extend 1.1) and avoid generating additional code here'
'''2.2) Perform LU factorization and verify'''
max(abs((PA - LU)) = 8.88178e-16
2.2 Comments on comparison of results:
'''2.3) U diagonal entry w/ smallest magnitude, rank(A), and det(A)'''
min(abs(diag(U)) = 2.29442e-02 my rank(A) = 113 linalg rank(A) = 113 my det(A) = 2.72809e-142 linalg det(A) = 2.72809e-142
2.3 Comment on the diagonal of the U entry with smallest absolute value:
'''3.1) LU factorization function'''
'''hint: extend 1.1) and avoid generating additional code here'''
'hint: extend 1.1) and avoid generating additional code here'
'''3.2 Perform LU factorization and verify'''
max(abs((PAQ - LU)) = 9.99201e-16
3.2 Comments on comparison of results:
'''3.3 U diagonal entry w/ smallest magnitude, rank(A), and det(A)'''
min(abs(diag(U)) = 7.26158e-03 my rank(A) = 113 linalg rank(A) = 113 my det(A) = 2.72809e-142 linalg det(A) = 2.72809e-142
3.3 Comment on the diagonal of the U entry with smallest absolute value: