Linear algebra

Least square method 2

最小平方法 2 給定一個矩陣 $A$ 以及一個向量 $b$, 我們想要找到一個向量 $x$ 使得 $\|Ax - b\|^2+\|x\|^2$ 最小. $$ A\in M_{m\times n}, \quad b \in M_{m\times 1}, \quad x\in M_{n\times 1}. $$ 1. Motivation 1.1 Non-uniqueness 最小平方法 $\|Ax-b\|^2$ 問題有時候解並

Gibbs_phenomenon - code

Click here to view this notebook in full screen

主成分分析 - 0

Principle component analysis - 0 1. 一維資料的統計學 假設我們有 $n$ 筆資料, 每筆資料都是一個數字 (例如 $n$ 個學生的成績). 這 $n$ 筆資料我們設為 $x_1, \cdots, x_n$, 並且定義一個矩陣 $$ \tag{1} A =

主成分分析 - code

Click here to view this notebook in full screen

Least square method 1

最小平方法 1 給定一個矩陣 $A$ 以及一個向量 $b$, 我們想要找到一個向量 $x$ 使得 $\|Ax - b\|^2$ 最小. $$ A\in M_{m\times n}, \quad b \in M_{m\times 1}, \quad x\in M_{m\times 1}. $$ 首先我們定義 $\hat{x}$ 為找到的那個解, 也就

Trace, determinant 與 eigenvalue 的關係

方陣 A 的行列式等於其特徵值相乘 Determinant of A equals to the product of its eigenvalues 給定一個 $n\times n$ 的方陣 $A$, 我們定義一個變數為 $\lambda$ 的函數 $P(\lambda)$ 如下: $$ \tag{1} P(\lambda) = det(\lambda I-A). $$ 根據行列式的算法我們馬

Power method with Rayleigh Quotient

Power 迭代法目錄: 基本概念 Power iteration; inverse power method; shifted inver power method 找第二大的 eigenvalue deflation Rayleigh Quotient 迭代及其收斂性 Power method with Rayleigh Quotient 假設 $A$ 是一個對稱矩陣 演算法: Power method with Rayleigh Quotient Iterate until convergence: $$ \tag{1} \begin{align} \hat{x}^{(k+1)} &= Ax^{(k)}\\ \lambda^{(k+1)}

Power method - deflation

Power 迭代法目錄: 基本概念 Power iteration; inverse power method; shifted inver power method 找第二大的 eigenvalue deflation Rayleigh Quotient 迭代及其收斂性 Power method with Rayleigh Quotient Deflation 對一方陣 $A$, 假設我們以 power iteration 找到了一組 eigenvalue/eigenvector, $\lambda$ and $v$, 使得 $Av = \lambda v$. 那

Conjugate gradient method - iterative method

共軛梯度法 (CG method, conjugate gradient method) 目錄: CG method - Direct mehtod 直接法 CG method - iterate mehtod 迭代法 For solving $Ax=b$, where $A$ is a square symmetric positive definite matrix. Assumptions: $A\in M_{n\times n}$ is a symmetric positive definite matrix. Definition: A-orthogonal (A-conjugate) 假設有兩個向量 $u_1$ 跟 $u_2$ 皆非 $0$ 且 $u_1 \neq

Power method

Power 迭代法目錄: 基本概念 Power iteration; inverse power method; shifted inver power method 找第二大的 eigenvalue deflation Rayleigh Quotient 迭代及其收斂性 Power method with Rayleigh Quotient 基本 Power method 求一個方陣最大(in magnitude) 的 eigenvalue. 給定 $A$ 為一個 $n\times n$ 方陣. 我