Home > Python > Introduction to Scipy

Ch. 10.3 Linear Algebra

Chapters Index
Program 1

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Scipy linalg directory

Program 2

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Inverse of Matrix

Program 3

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Linear Equations using MathJax

System of Linear Equations

The system of equations can be written as:

\[ \begin{bmatrix} 1 & 2 & 3 \\ 0 & 1 & 4 \\ 5 & 6 & 0 \end{bmatrix} \begin{bmatrix} x_1 \\ x_2 \\ x_3 \end{bmatrix} = \begin{bmatrix} 7 \\ 8 \\ 9 \end{bmatrix} \]

Expanding into individual equations:

\[ 1x_1 + 2x_2 + 3x_3 = 7 \]

\[ 0x_1 + 1x_2 + 4x_3 = 8 \]

\[ 5x_1 + 6x_2 + 0x_3 = 9 \]

Program 4

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Determinant of MAtrix

Program 5

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Eigenvalues and eigenvectors

Program 6

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

QR Decomposition

Program 7

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

Norm of Matrix

Program 8

Linear Algebra

Python 3.11 Ready

                                
Click "Run Code" to execute script and render figures.

Mathematical Problem Formulation

LU decomposition

Theoretical Principles & Computational Physics Guide

Linear Algebra: Matrix Formulation & Linear Algebraic Methods

Dr. Alorika Chatterjee & Dr. Anirban Shaw Science & Physics Learners Python 3 / NumPy / SciPy

1. Core Principles & Theoretical Framework

Linear Transformation: Matrices represent multi-variable coupled physical equations, rotation operators, and quantum observables.
Coordinate Transformations: Maps physical state vectors $\mathbf{x} \mapsto \mathbf{A}\mathbf{x}$ preserving or scaling metric spaces.
Numerical Stability: Employs pivoting and condition number monitoring to avoid numerical singularity during inversion.

2. Mathematical Formulation & Algorithmic Pipeline

Linear algebraic operator transformation:

$$ \mathbf{A}\mathbf{x} = \mathbf{b} \iff \sum_{j=1}^n A_{ij} x_j = b_i, \quad \det(\mathbf{A}) \neq 0 $$
1. Construct Matrix/Vector → 2. Linear Operator Execution → 3. Verify Norm / Residual $\|\mathbf{A}\mathbf{x} - \mathbf{b}\|$

3. Numerical Mechanics & Implementation Logic

  • Memory Layout: Structure row and column arrays ensuring dimensional conformability.
  • Algorithmic Execution: Apply row operations or inner product contractions iteratively.
  • Condition Checking: Verify determinant or diagonal dominance to guarantee reliable numerical convergence.

4. Relevant Computational Practice Exercises

Exercise 1
Implement Linear Algebra for a $3 \times 3$ system and verify the result against analytical solutions.
Exercise 2
Measure the computational scaling of the algorithm as matrix dimension $N$ increases from $10$ to $100$.
Exercise 3
Test edge cases involving singular or ill-conditioned matrices and handle potential division-by-zero errors.
Standard Literature & References:
  • Gilbert Strang, "Linear Algebra and Its Applications", Cengage Learning (2006).
  • William H. Press et al., "Numerical Recipes", Cambridge University Press (2007).