138 lines
2.5 KiB
Plaintext
138 lines
2.5 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"id": "7fc797ce",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"import numpy as np\n",
|
|
"import matplotlib.pyplot as plt\n",
|
|
"\n",
|
|
"plt.rcParams[\"font.family\"] = \"D2Coding\""
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "a869c82a",
|
|
"metadata": {},
|
|
"source": [
|
|
"# Linear Equation\n",
|
|
"\n",
|
|
"$$A\\cdot x = b$$\n",
|
|
"\n",
|
|
"* $A$: [m, n]\n",
|
|
"* $b$: [m, 1]"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "3bed3d44",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "a5239ed9",
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "8bd218a8",
|
|
"metadata": {},
|
|
"source": [
|
|
"# SVD(Singular Value Decomposition)\n",
|
|
"\n",
|
|
"**why?**\n",
|
|
"\n",
|
|
"**what?**\n",
|
|
"\n",
|
|
"$$A = UWV^T$$\n",
|
|
"\n",
|
|
"* $U$: [m, n]\n",
|
|
"* $W$: [n, n] diagonal with positive or zero\n",
|
|
"* $V$: [n, n] orthogonal\n",
|
|
"\n",
|
|
"\n",
|
|
"**properties**\n",
|
|
"\n",
|
|
"* orthonormality\n",
|
|
"* uniqueness"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"id": "563d7aec",
|
|
"metadata": {},
|
|
"outputs": [
|
|
{
|
|
"name": "stdout",
|
|
"output_type": "stream",
|
|
"text": [
|
|
"(4, 3)\n"
|
|
]
|
|
},
|
|
{
|
|
"data": {
|
|
"text/plain": [
|
|
"array([[ 1., 0., -0.],\n",
|
|
" [ 1., 1., -1.],\n",
|
|
" [ 0., 1., -1.],\n",
|
|
" [-1., 1., 1.]])"
|
|
]
|
|
},
|
|
"execution_count": 26,
|
|
"metadata": {},
|
|
"output_type": "execute_result"
|
|
}
|
|
],
|
|
"source": [
|
|
"A = np.array([[1, 0, 0], [1, 1, -1], [0, 1, -1], [-1, 1, 1]])\n",
|
|
"print(A.shape)\n",
|
|
"U, S, Vh = np.linalg.svd(A, False)"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "markdown",
|
|
"id": "fb89ad74",
|
|
"metadata": {},
|
|
"source": [
|
|
"## Homogeneous\n",
|
|
"\n",
|
|
"\n",
|
|
"## Nonhomogeneous\n",
|
|
"\n",
|
|
"\n"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"kernelspec": {
|
|
"display_name": "2025-02-Numerical (3.12.11)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.12.11"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 5
|
|
}
|