{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"id": "20072b4a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"-2 & 0 & -10 & 18 \\\\\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"3 & 18 & -3 & 0\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[ -2 0 -10 18]\n",
"[ 6 12 -6 -12]\n",
"[ 0 6 6 15]\n",
"[ 3 18 -3 0]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"A = matrix([[-2,0,-10,18],[6,12,-6,-12],[0,6,6,15],[3,18,-3,0]])\n",
"show(A)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "7b8ea77a",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"0 & 1 & 0 & 0 \\\\\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"-\\frac{1}{3} & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"\\frac{1}{2} & 0 & 0 & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 4 & -12 & 14 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"0 & 12 & 0 & 6\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[0 1 0 0]\n",
"[1 0 0 0]\n",
"[0 0 1 0]\n",
"[0 0 0 1] [ 1 0 0 0]\n",
"[-1/3 1 0 0]\n",
"[ 0 0 1 0]\n",
"[ 1/2 0 0 1] [ 6 12 -6 -12]\n",
"[ 0 4 -12 14]\n",
"[ 0 6 6 15]\n",
"[ 0 12 0 6]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"P1 = matrix([[0,1,0,0],[1,0,0,0],[0,0,1,0],[0,0,0,1]])\n",
"L1 = matrix([[1,0,0,0],[-1/3,1,0,0],[0,0,1,0],[1/2,0,0,1]])\n",
"U1 = matrix([[6,12,-6,-12],[0,4,-12,14],[0,6,6,15],[0,12,0,6]])\n",
"show(P1,L1,U1)"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "5d7da547",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"-2 & 0 & -10 & 18 \\\\\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"3 & 18 & -3 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"-2 & 0 & -10 & 18 \\\\\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"3 & 18 & -3 & 0\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[ -2 0 -10 18]\n",
"[ 6 12 -6 -12]\n",
"[ 0 6 6 15]\n",
"[ 3 18 -3 0] [ -2 0 -10 18]\n",
"[ 6 12 -6 -12]\n",
"[ 0 6 6 15]\n",
"[ 3 18 -3 0]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(A,P1.transpose()*L1*U1)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "b06487c5",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"0 & 0 & 0 & 1 \\\\\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 1 & 0 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"\\frac{1}{2} & 1 & 0 & 0 \\\\\n",
"0 & \\frac{1}{2} & 1 & 0 \\\\\n",
"-\\frac{1}{3} & \\frac{1}{3} & 0 & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 12 & 0 & 6 \\\\\n",
"0 & 0 & 6 & 12 \\\\\n",
"0 & 0 & -12 & 12\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[0 0 0 1]\n",
"[1 0 0 0]\n",
"[0 0 1 0]\n",
"[0 1 0 0] [ 1 0 0 0]\n",
"[ 1/2 1 0 0]\n",
"[ 0 1/2 1 0]\n",
"[-1/3 1/3 0 1] [ 6 12 -6 -12]\n",
"[ 0 12 0 6]\n",
"[ 0 0 6 12]\n",
"[ 0 0 -12 12]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"P2 = matrix([[0,1,0,0],[0,0,0,1],[0,0,1,0],[1,0,0,0]])\n",
"L2 = matrix([[1,0,0,0],[1/2,1,0,0],[0,1/2,1,0],[-1/3,1/3,0,1]])\n",
"U2 = matrix([[6,12,-6,-12],[0,12,0,6],[0,0,6,12],[0,0,-12,12],])\n",
"show(P2.transpose(),L2,U2)"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "06580fbc",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"3 & 18 & -3 & 0 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"-2 & 0 & -10 & 18\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"3 & 18 & -3 & 0 \\\\\n",
"0 & 6 & 6 & 15 \\\\\n",
"-2 & 0 & -10 & 18\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[ 6 12 -6 -12]\n",
"[ 3 18 -3 0]\n",
"[ 0 6 6 15]\n",
"[ -2 0 -10 18] [ 6 12 -6 -12]\n",
"[ 3 18 -3 0]\n",
"[ 0 6 6 15]\n",
"[ -2 0 -10 18]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(P2*A,L2*U2)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "e1df74c2",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 1 \\\\\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"\\frac{1}{2} & 1 & 0 & 0 \\\\\n",
"-\\frac{1}{3} & \\frac{1}{3} & 1 & 0 \\\\\n",
"0 & \\frac{1}{2} & -\\frac{1}{2} & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"0 & 12 & 0 & 6 \\\\\n",
"0 & 0 & -12 & 12 \\\\\n",
"0 & 0 & 0 & 18\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[0 1 0 0]\n",
"[0 0 0 1]\n",
"[1 0 0 0]\n",
"[0 0 1 0] [ 1 0 0 0]\n",
"[ 1/2 1 0 0]\n",
"[-1/3 1/3 1 0]\n",
"[ 0 1/2 -1/2 1] [ 6 12 -6 -12]\n",
"[ 0 12 0 6]\n",
"[ 0 0 -12 12]\n",
"[ 0 0 0 18]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"P3 = matrix([[0,1,0,0],[0,0,0,1],[1,0,0,0],[0,0,1,0]])\n",
"L3 = matrix([[1,0,0,0],[1/2,1,0,0],[-1/3,1/3,1,0],[0,1/2,-1/2,1]])\n",
"U3 = matrix([[6,12,-6,-12],[0,12,0,6],[0,0,-12,12],[0,0,0,18],])\n",
"show(P3,L3,U3)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "cbd0f0d2",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"3 & 18 & -3 & 0 \\\\\n",
"-2 & 0 & -10 & 18 \\\\\n",
"0 & 6 & 6 & 15\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"6 & 12 & -6 & -12 \\\\\n",
"3 & 18 & -3 & 0 \\\\\n",
"-2 & 0 & -10 & 18 \\\\\n",
"0 & 6 & 6 & 15\n",
"\\end{array}\\right)$$"
],
"text/plain": [
"[ 6 12 -6 -12]\n",
"[ 3 18 -3 0]\n",
"[ -2 0 -10 18]\n",
"[ 0 6 6 15] [ 6 12 -6 -12]\n",
"[ 3 18 -3 0]\n",
"[ -2 0 -10 18]\n",
"[ 0 6 6 15]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(P3*A,L3*U3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "56a4db74",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 9.5",
"language": "sage",
"name": "sagemath"
},
"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.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}