0% found this document useful (0 votes)
138 views

Session 4 5 - Linear Algebra in Python

The document provides an overview of topics to be covered in Sessions 4 and 5 on linear algebra and Python. It will cover more linear algebra concepts like matrices, matrix multiplication, inverses, and determinants. It will also cover how to perform linear algebra operations using Python and the NumPy library, including creating matrices with NumPy arrays, indexing and slicing matrices, matrix math operations, multiplication, and inversion. References are provided on linear algebra and a companion text on applying it with Python.

Uploaded by

KRIS LAM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

Session 4 5 - Linear Algebra in Python

The document provides an overview of topics to be covered in Sessions 4 and 5 on linear algebra and Python. It will cover more linear algebra concepts like matrices, matrix multiplication, inverses, and determinants. It will also cover how to perform linear algebra operations using Python and the NumPy library, including creating matrices with NumPy arrays, indexing and slicing matrices, matrix math operations, multiplication, and inversion. References are provided on linear algebra and a companion text on applying it with Python.

Uploaded by

KRIS LAM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Session 4 & 5 – Linear Algebra and More Python

A Brief Introduction to Python &


Mathematics for Machine Learning • Lecture plan – you would learn the following:
• Catch up on Session 3 on whatever left from that lecture (done last Sat)
• Python classes, functions, methods, modules (done last Sat)
Session 4 and 5 • More Linear Algebra (today)
Linear Algebra in Python • Matrices
(15 & 19 January 2022) • Matrix Multiplication
• Matrix Inverses
• Determinants
Pre-Course for ECOM6022 • Doing Linear Algebra using Python (Numpy)
By References:
Professor Paul Y S CHEUNG “Introduction to Applied Linear Algebra” by Boyd & Vandenberghe (Stanford University)
(and a Python companion of this book by Jessica Leung and Dmytro Matsypura)
“Essence of Linear Algebra” (Series of videos on Youtube), 3Blue1Brown

Matrices Matrices and its Shapes

3 4
Column and Row Vectors Columns and Rows of a Matrix

5 6

Block Matrices Column and Row Representation of Matrix

7 8
Examples: Use of Real Data in Matrices Examples: Graphs or Relations as Matrices

-> (i, j) = (head, tail)

9 10

Special Matrices Diagonal and Triangular Matrices

11 12
Transpose Addition, Subtract, and Scalar Multiplication

13 14

Matrix Norm Matrix-Vector Product

15 16
Row and Column Interpretations General Examples of Matrix (many slides)
ROW

COLUMN

17 18

Difference Matrix Return Matrix – Portfolio Vector

19 20
Feature Matrix – Weight Vector Input-Output Matrix

21 22

Geometric Transformations Selector Matrix

23 24
Incidence Matrix Flow Conservation (use of incidence matrix)

<- incident
<- away from
<- no connection

edge

node

25 26

Flow Conservation (use of incidence matrix) Matrix and Linear System of Equations

27 called “Identity matrix” 28


Invertible Matrices Example (for 2 x 2 matrix)

Note: Matrix A is invertible if its Determinant is non-zero

29 30

Matrix Multiplication, 3D Transformation and Determinant


Properties of Inverse Matrix (3Blue1Brown)

31 32
Python and Numpy for Linear Algebra

• Let us start our Colab session which will cover:


• Use of NumPy Arrays for Matrices
• Indexing and Slicing of Matrices
• Matrix Mathematics
• Matrix Multiplication
• Matrix Inversion

Go to Colab

33

You might also like