Download (right-click, save target as ...) this page as a jupyterlab notebook from: Lab8-TH
LAST NAME, FIRST NAME
R00000000
ENGR 1330 ES 8 - Homework
# Preamble script block to identify host, user, and kernel
import sys
! hostname
! whoami
print(sys.executable)
print(sys.version)
print(sys.version_info)
Define the matrix A and the vector u in Python. Then perform all of the tasks below.
\begin{gather} \mathbf{A} = \begin{pmatrix} 1 & 3 & 5 & 7 \\ 2 & 4 & 6 & 8 \\ -3 & -2 & -1 & 0 \\ \end{pmatrix} ~ \mathbf{u} = \begin{pmatrix} 10 \\ 20 \\ 30 \\ \end{pmatrix} \end{gather}Use the code blocks below to craft your answer.
#%reset -f # only if necessary
# read/create matrix A
# read/create vector u
# print A
# print u
# determine and Print the shape of A
# determine andPrint the shape of u
# Print the first column of A
# Print the first two rows of A
# Print the first two entries of u
# Print the last two entries of u
# Print the bottom left 2×2 partition (submatrix) of A
# Print the middle two elements of the middle row of A
Use your script to multiply two matrices, just like in the Lab (in-Lab portion). Apply the script to find $\mathbf{A}\mathbf{B}$ where.
\begin{gather} \mathbf{A} = \begin{pmatrix} 1 & 2 \\ 3 & 4 \\ 5 & 6 \\ \end{pmatrix} ~~~~ \mathbf{B} = \begin{pmatrix} 7 & 8 & 9 \\ 10 & 11 & 12 \\ \end{pmatrix} \end{gather}The two matrices are located in files:
http://54.243.252.9/engr-1330-webroot/8-Labs/Lab08/Amat.txt
and:
http://54.243.252.9/engr-1330-webroot/8-Labs/Lab08/Bmat.txt
You should download these files before proceeding
# read file Amat.txt
# read file Bmat.txt
# create a destination matrix ABmatrix
# print Amat
# print Bmat
# perform the multiplication put the result into ABmatrix
# print ABmatrix
A linear algebra primer https://numericalmethodssullivan.github.io/ch-linearalgebra.html
Python file manipulations https://www.tutorialspoint.com/python/python_files_io.htm
A Complete Beginners Guide to Matrix Multiplication for Data Science with Python Numpy https://towardsdatascience.com/a-complete-beginners-guide-to-matrix-multiplication-for-data-science-with-python-numpy-9274ecfc1dc6