Table of Contents

				
					import numpy as np
				
			
Example 1
				
					# Define coefficient matrix A and constant vector b
A = np.array([[1, 3], [4, 5]])
				
			
				
					print(A)
				
			
				
					B = np.array([[2], [7]])
				
			
				
					# Augmented matrix
augmented_matrix = np.column_stack((A, B))
				
			
				
					print(augmented_matrix)
				
			
Example 2
				
					A = np.array([[2, 2, -1], [5, 9, 1], [-6, 1, -2]])
				
			
				
					B = np.array([[8], [11], [4]])
				
			
				
					augmented_matrix = np.column_stack((A, B))
				
			
				
					print(augmented_matrix)
				
			
row operations
				
					# Swapping two rows
augmented_matrix[[0, 1]] = augmented_matrix[[1, 0]]
				
			
				
					print(augmented_matrix)
				
			
Multiply the first row by 3
				
					augmented_matrix[0] = augmented_matrix[0] * 3
				
			
				
					print(augmented_matrix)
				
			
add: 2nd row to the first
				
					augmented_matrix[0] = augmented_matrix[0] +  augmented_matrix[1]
				
			
				
					print(augmented_matrix)
				
			
subtract 2nd row from the 3rd
				
					augmented_matrix[2] = augmented_matrix[2] -  augmented_matrix[1]
				
			
				
					print(augmented_matrix)
				
			
				
					df.loc[idx]
				
			

Free Community

Join 1,000+ AI Automation Builders

Weekly tutorials, live calls & direct access to Ryan & Matt.

Join Free →

Keep Learning

Python Reduced Row Echelon Form

https://youtu.be/12hpWB3cmzg From REF to RREF

Python Multiply Matrices

https://youtu.be/RzePfrH0XNM

Inverse Matrix

https://youtu.be/wfHaKrmMbFk 2x2 example 3x3 example properties A^-1 * A = A * A^-1 = I (AB)^−1=B^−1A^−1 (A^T)^−1=(A^−1)^T (kA)^−1=(1/k)(​A^−1) (A^−1)^−1=A

Python Identity Matrix

https://youtu.be/Jeu9Fkfh9Hw Example 1 Create a 3x3 identity matrix also can use np.eye Example 2 Matrix Multiplication Example 3 Determinant of the Identity...