{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# SageMath para físicos\n",
"***\n",
"Rogério T. C."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Aula III"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Vetores e matrizes"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"%display latex\n",
"reset()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Vetores e estrutura"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Vetores são constrídos pelo comando `vector`, com sintaxe `vector([x1,x2,x3,...,xn])`"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"v = vector([x,x^8,5])"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vector space of dimension 3 over Symbolic Ring\n"
]
}
],
"source": [
"print(parent(v))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Soma, multiplicação escalar e produto vetorial"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"w=vector([5,2,1])"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(x^{8} - 10,\\,-x + 25,\\,-5 \\, x^{8} + 2 \\, x\\right)\n",
"\\end{math}"
],
"text/plain": [
"(x^8 - 10, -x + 25, -5*x^8 + 2*x)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.cross_product(w)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Produto interno"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}2 \\, x^{8} + 5 \\, x + 5\n",
"\\end{math}"
],
"text/plain": [
"2*x^8 + 5*x + 5"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v*w"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}2 \\, x^{8} + 5 \\, x + 5\n",
"\\end{math}"
],
"text/plain": [
"2*x^8 + 5*x + 5"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"v.dot_product(w)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Hermitiano"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}y\n",
"\\end{math}"
],
"text/plain": [
"y"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var('y', domain='real')"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"z = vector([I*2,x,y]);"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}2 \\, x + y + 10 i\n",
"\\end{math}"
],
"text/plain": [
"2*x + y + 10*I"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"z*w"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}y + 2 \\, \\overline{x} - 10 i\n",
"\\end{math}"
],
"text/plain": [
"y + 2*conjugate(x) - 10*I"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"z.hermitian_inner_product(w)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Norma"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\sqrt{30}\n",
"\\end{math}"
],
"text/plain": [
"sqrt(30)"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w.norm()"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\sqrt{y^{2} + {\\left| x \\right|}^{2} + 4}\n",
"\\end{math}"
],
"text/plain": [
"sqrt(y^2 + abs(x)^2 + 4)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"z.norm()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Matrizes"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrr}\n",
"1 & 2 & 3 \\\\\n",
"5 & 23 & 8 \\\\\n",
"8 & 5 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1 2 3]\n",
"[ 5 23 8]\n",
"[ 8 5 1]"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a = matrix(SR,[[1,2,3],[5,23,8],[8,5,1]]);a"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(5 \\, x + 8 \\, y + 2 i,\\,23 \\, x + 5 \\, y + 4 i,\\,8 \\, x + y + 6 i\\right)\n",
"\\end{math}"
],
"text/plain": [
"(5*x + 8*y + 2*I, 23*x + 5*y + 4*I, 8*x + y + 6*I)"
]
},
"execution_count": 15,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(a).transpose()*z"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(5 \\, x + 8 \\, y + 2 i,\\,23 \\, x + 5 \\, y + 4 i,\\,8 \\, x + y + 6 i\\right)\n",
"\\end{math}"
],
"text/plain": [
"(5*x + 8*y + 2*I, 23*x + 5*y + 4*I, 8*x + y + 6*I)"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"z*a"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Matrizes especiais"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrrrrrrrrrrrrr}\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]\n",
"[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"matrix.zero(10,15)"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[1 0 0 0]\n",
"[0 1 0 0]\n",
"[0 0 1 0]\n",
"[0 0 0 1]"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"matrix.identity(4)"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrr}\n",
"1 & 1 & 1 \\\\\n",
"1 & 1 & 1 \\\\\n",
"1 & 1 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[1 1 1]\n",
"[1 1 1]\n",
"[1 1 1]"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"matrix.ones(3)"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [],
"source": [
"d = matrix.diagonal([y,y,y^2])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Determinante, traço, transposta, inversa, conjugada"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}y^{4}\n",
"\\end{math}"
],
"text/plain": [
"y^4"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.det()"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}y^{2} + 2 \\, y\n",
"\\end{math}"
],
"text/plain": [
"y^2 + 2*y"
]
},
"execution_count": 22,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.trace()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrr}\n",
"y & 0 & 0 \\\\\n",
"0 & y & 0 \\\\\n",
"0 & 0 & y^{2}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ y 0 0]\n",
"[ 0 y 0]\n",
"[ 0 0 y^2]"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.transpose()"
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrr}\n",
"y & 0 & 0 \\\\\n",
"0 & y & 0 \\\\\n",
"0 & 0 & y^{2}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ y 0 0]\n",
"[ 0 y 0]\n",
"[ 0 0 y^2]"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.conjugate()"
]
},
{
"cell_type": "code",
"execution_count": 25,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrr}\n",
"\\frac{1}{y} & 0 & 0 \\\\\n",
"0 & \\frac{1}{y} & 0 \\\\\n",
"0 & 0 & \\frac{1}{y^{2}}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1/y 0 0]\n",
"[ 0 1/y 0]\n",
"[ 0 0 y^(-2)]"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.inverse()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Pausa - transformação linear"
]
},
{
"cell_type": "code",
"execution_count": 26,
"metadata": {},
"outputs": [],
"source": [
"T = linear_transformation(a)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\text{vector space morphism from }\n",
"\\text{SR}^{3}\\text{ to }\n",
"\\text{SR}^{3}\\text{ represented by the matrix }\n",
"\\left(\\begin{array}{rrr}\n",
"1 & 2 & 3 \\\\\n",
"5 & 23 & 8 \\\\\n",
"8 & 5 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"Vector space morphism represented by the matrix:\n",
"[ 1 2 3]\n",
"[ 5 23 8]\n",
"[ 8 5 1]\n",
"Domain: Vector space of dimension 3 over Symbolic Ring\n",
"Codomain: Vector space of dimension 3 over Symbolic Ring"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"T"
]
},
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Vector space morphism represented by the matrix:\n",
"[ 1 2 3]\n",
"[ 5 23 8]\n",
"[ 8 5 1]\n",
"Domain: Vector space of dimension 3 over Symbolic Ring\n",
"Codomain: Vector space of dimension 3 over Symbolic Ring\n"
]
}
],
"source": [
"print(T)"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\mathrm{True}\n",
"\\end{math}"
],
"text/plain": [
"True"
]
},
"execution_count": 29,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"T.is_bijective()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Autovalores, auto vetores e diagonalização"
]
},
{
"cell_type": "code",
"execution_count": 30,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}x^{3} + \\left(-y^{2} - 2 \\, y\\right) x^{2} + \\left(2 \\, y^{3} + y^{2}\\right) x - y^{4}\n",
"\\end{math}"
],
"text/plain": [
"x^3 + (-y^2 - 2*y)*x^2 + (2*y^3 + y^2)*x - y^4"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"d.charpoly()"
]
},
{
"cell_type": "code",
"execution_count": 31,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left[-\\frac{1}{2} \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} {\\left(i \\, \\sqrt{3} + 1\\right)} - \\frac{353 \\, {\\left(-i \\, \\sqrt{3} + 1\\right)}}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}, -\\frac{1}{2} \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} {\\left(-i \\, \\sqrt{3} + 1\\right)} - \\frac{353 \\, {\\left(i \\, \\sqrt{3} + 1\\right)}}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} + \\frac{706}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}\\right]\n",
"\\end{math}"
],
"text/plain": [
"[-1/2*(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3)*(I*sqrt(3) + 1) - 353/9*(-I*sqrt(3) + 1)/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3,\n",
" -1/2*(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3)*(-I*sqrt(3) + 1) - 353/9*(I*sqrt(3) + 1)/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3,\n",
" (1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 706/9/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.eigenvalues()"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left[\\left(-\\frac{1}{2} \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} {\\left(i \\, \\sqrt{3} + 1\\right)} - \\frac{353 \\, {\\left(-i \\, \\sqrt{3} + 1\\right)}}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}, \\left[\\right], 1\\right), \\left(-\\frac{1}{2} \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} {\\left(-i \\, \\sqrt{3} + 1\\right)} - \\frac{353 \\, {\\left(i \\, \\sqrt{3} + 1\\right)}}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}, \\left[\\right], 1\\right), \\left({\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}} + \\frac{706}{9 \\, {\\left(\\frac{1}{18} i \\, \\sqrt{24785605} \\sqrt{3} + \\frac{27173}{54}\\right)}^{\\frac{1}{3}}} + \\frac{25}{3}, \\left[\\right], 1\\right)\\right]\n",
"\\end{math}"
],
"text/plain": [
"[(-1/2*(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3)*(I*sqrt(3) + 1) - 353/9*(-I*sqrt(3) + 1)/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3,\n",
" [],\n",
" 1),\n",
" (-1/2*(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3)*(-I*sqrt(3) + 1) - 353/9*(I*sqrt(3) + 1)/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3,\n",
" [],\n",
" 1),\n",
" ((1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 706/9/(1/18*I*sqrt(24785605)*sqrt(3) + 27173/54)^(1/3) + 25/3,\n",
" [],\n",
" 1)]"
]
},
"execution_count": 32,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"a.eigenvectors_right()"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {},
"outputs": [],
"source": [
"k = matrix([[1,1,-3],[0,4,0],[-3,3,1]])"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left[\\left(-2, \\left[\\left(1,\\,0,\\,1\\right)\\right], 1\\right), \\left(4, \\left[\\left(1,\\,0,\\,-1\\right)\\right], 2\\right)\\right]\n",
"\\end{math}"
],
"text/plain": [
"[(-2,\n",
" [\n",
" (1, 0, 1)\n",
" ],\n",
" 1),\n",
" (4,\n",
" [\n",
" (1, 0, -1)\n",
" ],\n",
" 2)]"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"k.eigenvectors_right()"
]
},
{
"cell_type": "code",
"execution_count": 35,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\left(\\begin{array}{rrr}\n",
"-2 & 0 & 0 \\\\\n",
"0 & 4 & 0 \\\\\n",
"0 & 0 & 4\n",
"\\end{array}\\right), \\left(\\begin{array}{rrr}\n",
"1 & 1 & 0 \\\\\n",
"0 & 0 & 0 \\\\\n",
"1 & -1 & 0\n",
"\\end{array}\\right)\\right)\n",
"\\end{math}"
],
"text/plain": [
"(\n",
"[-2 0 0] [ 1 1 0]\n",
"[ 0 4 0] [ 0 0 0]\n",
"[ 0 0 4], [ 1 -1 0]\n",
")"
]
},
"execution_count": 35,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"k.eigenmatrix_right()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Exponencial de matrizes"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$e^A \\equiv I+\\sum_{n=1}^{\\infty}\\frac{A^n}{n!},$$\n",
"onde ${\\displaystyle I\\,}$ é a matriz identidade"
]
},
{
"cell_type": "code",
"execution_count": 36,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rr}\n",
"1 & 2 \\\\\n",
"2 & 2\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[1 2]\n",
"[2 2]"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m1 = matrix([[1,2],[2,2]]);m1"
]
},
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rr}\n",
"-\\frac{1}{34} \\, {\\left({\\left(\\sqrt{17} - 17\\right)} e^{\\sqrt{17}} - \\sqrt{17} - 17\\right)} e^{\\left(-\\frac{1}{2} \\, \\sqrt{17} + \\frac{3}{2}\\right)} & \\frac{2}{17} \\, {\\left(\\sqrt{17} e^{\\sqrt{17}} - \\sqrt{17}\\right)} e^{\\left(-\\frac{1}{2} \\, \\sqrt{17} + \\frac{3}{2}\\right)} \\\\\n",
"\\frac{2}{17} \\, {\\left(\\sqrt{17} e^{\\sqrt{17}} - \\sqrt{17}\\right)} e^{\\left(-\\frac{1}{2} \\, \\sqrt{17} + \\frac{3}{2}\\right)} & \\frac{1}{34} \\, {\\left({\\left(\\sqrt{17} + 17\\right)} e^{\\sqrt{17}} - \\sqrt{17} + 17\\right)} e^{\\left(-\\frac{1}{2} \\, \\sqrt{17} + \\frac{3}{2}\\right)}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[-1/34*((sqrt(17) - 17)*e^sqrt(17) - sqrt(17) - 17)*e^(-1/2*sqrt(17) + 3/2) 2/17*(sqrt(17)*e^sqrt(17) - sqrt(17))*e^(-1/2*sqrt(17) + 3/2)]\n",
"[ 2/17*(sqrt(17)*e^sqrt(17) - sqrt(17))*e^(-1/2*sqrt(17) + 3/2) 1/34*((sqrt(17) + 17)*e^sqrt(17) - sqrt(17) + 17)*e^(-1/2*sqrt(17) + 3/2)]"
]
},
"execution_count": 37,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exp(m1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Exercício\n",
"\n",
"Dada a matriz de Pauli\n",
"$${\\displaystyle \\sigma _{2}={\\begin{pmatrix}0&i\\\\-i&0\\end{pmatrix}}.}$$\n",
"\n",
"Calcule $e^{i\\frac{\\theta}{2}\\sigma_2}$"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\theta\n",
"\\end{math}"
],
"text/plain": [
"theta"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"var('theta')"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rr}\n",
"\\frac{1}{2} \\, {\\left(e^{\\left(i \\, \\theta\\right)} + 1\\right)} e^{\\left(-\\frac{1}{2} i \\, \\theta\\right)} & \\frac{1}{2} \\, {\\left(i \\, e^{\\left(i \\, \\theta\\right)} - i\\right)} e^{\\left(-\\frac{1}{2} i \\, \\theta\\right)} \\\\\n",
"-\\frac{1}{2} \\, {\\left(i \\, e^{\\left(i \\, \\theta\\right)} - i\\right)} e^{\\left(-\\frac{1}{2} i \\, \\theta\\right)} & \\frac{1}{2} \\, {\\left(e^{\\left(i \\, \\theta\\right)} + 1\\right)} e^{\\left(-\\frac{1}{2} i \\, \\theta\\right)}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1/2*(e^(I*theta) + 1)*e^(-1/2*I*theta) 1/2*(I*e^(I*theta) - I)*e^(-1/2*I*theta)]\n",
"[-1/2*(I*e^(I*theta) - I)*e^(-1/2*I*theta) 1/2*(e^(I*theta) + 1)*e^(-1/2*I*theta)]"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"exp((i/2)*theta*matrix([[0,i],[-i,0]]))"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}x\n",
"\\end{math}"
],
"text/plain": [
"x"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"x.simplify_rectform()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Geradores do grupo de Lorentz (Representação de spin 1 da algébra de Lie $\\mathfrak{so}(1,3)$)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Rotações"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
"J1 = I*matrix([[0,0,0,0],[0,0,0,0],[0,0,0,-1],[0,0,1,0]])\n",
"J2 = I*matrix([[0,0,0,0],[0,0,0,1],[0,0,0,0],[0,-1,0,0]])\n",
"J3 = I*matrix([[0,0,0,0],[0,0,-1,0],[0,1,0,0],[0,0,0,0]])"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & -i \\\\\n",
"0 & 0 & i & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & i \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & -i & 0 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & -i & 0 \\\\\n",
"0 & i & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 0 0 0 0]\n",
"[ 0 0 0 0]\n",
"[ 0 0 0 -I]\n",
"[ 0 0 I 0] [ 0 0 0 0]\n",
"[ 0 0 0 I]\n",
"[ 0 0 0 0]\n",
"[ 0 -I 0 0] [ 0 0 0 0]\n",
"[ 0 0 -I 0]\n",
"[ 0 I 0 0]\n",
"[ 0 0 0 0]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(J1,J2,J3)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\theta_{0}, \\theta_{1}, \\theta_{2}, \\theta_{3}\\right)\n",
"\\end{math}"
],
"text/plain": [
"(theta0, theta1, theta2, theta3)"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"th = var('theta',n=4);th"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"R1 = exp(I*th[1]*J1)"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"R2 = exp(I*th[2]*J2)"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"R3 = exp(I*th[3]*J3)"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{1}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{1}\\right)} & -\\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{1}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{1}\\right)} \\\\\n",
"0 & 0 & \\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{1}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{1}\\right)} & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{1}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{1}\\right)}\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{2}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{2}\\right)} & 0 & \\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{2}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{2}\\right)} \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & -\\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{2}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{2}\\right)} & 0 & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{2}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{2}\\right)}\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{3}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{3}\\right)} & -\\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{3}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{3}\\right)} & 0 \\\\\n",
"0 & \\frac{1}{2} \\, {\\left(i \\, e^{\\left(2 i \\, \\theta_{3}\\right)} - i\\right)} e^{\\left(-i \\, \\theta_{3}\\right)} & \\frac{1}{2} \\, {\\left(e^{\\left(2 i \\, \\theta_{3}\\right)} + 1\\right)} e^{\\left(-i \\, \\theta_{3}\\right)} & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1/2*(e^(2*I*theta1) + 1)*e^(-I*theta1) -1/2*(I*e^(2*I*theta1) - I)*e^(-I*theta1)]\n",
"[ 0 0 1/2*(I*e^(2*I*theta1) - I)*e^(-I*theta1) 1/2*(e^(2*I*theta1) + 1)*e^(-I*theta1)] [ 1 0 0 0]\n",
"[ 0 1/2*(e^(2*I*theta2) + 1)*e^(-I*theta2) 0 1/2*(I*e^(2*I*theta2) - I)*e^(-I*theta2)]\n",
"[ 0 0 1 0]\n",
"[ 0 -1/2*(I*e^(2*I*theta2) - I)*e^(-I*theta2) 0 1/2*(e^(2*I*theta2) + 1)*e^(-I*theta2)] [ 1 0 0 0]\n",
"[ 0 1/2*(e^(2*I*theta3) + 1)*e^(-I*theta3) -1/2*(I*e^(2*I*theta3) - I)*e^(-I*theta3) 0]\n",
"[ 0 1/2*(I*e^(2*I*theta3) - I)*e^(-I*theta3) 1/2*(e^(2*I*theta3) + 1)*e^(-I*theta3) 0]\n",
"[ 0 0 0 1]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(R1,R2,R3)"
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\cos\\left(\\theta_{1}\\right)\n",
"\\end{math}"
],
"text/plain": [
"cos(theta1)"
]
},
"execution_count": 48,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R1[2,2].expand().simplify_rectform()"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & \\frac{1}{2} \\, e^{\\left(i \\, \\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\left(-i \\, \\theta_{1}\\right)} & -\\frac{1}{2} i \\, e^{\\left(i \\, \\theta_{1}\\right)} + \\frac{1}{2} i \\, e^{\\left(-i \\, \\theta_{1}\\right)} \\\\\n",
"0 & 0 & \\frac{1}{2} i \\, e^{\\left(i \\, \\theta_{1}\\right)} - \\frac{1}{2} i \\, e^{\\left(-i \\, \\theta_{1}\\right)} & \\frac{1}{2} \\, e^{\\left(i \\, \\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\left(-i \\, \\theta_{1}\\right)}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1/2*e^(I*theta1) + 1/2*e^(-I*theta1) -1/2*I*e^(I*theta1) + 1/2*I*e^(-I*theta1)]\n",
"[ 0 0 1/2*I*e^(I*theta1) - 1/2*I*e^(-I*theta1) 1/2*e^(I*theta1) + 1/2*e^(-I*theta1)]"
]
},
"execution_count": 49,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"R1.expand()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Funçãozinha em Python"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
"def resolve(M):\n",
" for lin in range(4):\n",
" for col in range(4):\n",
" M[lin,col] = M[lin,col].expand().simplify_rectform()\n",
" return M"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & \\cos\\left(\\theta_{3}\\right) & \\sin\\left(\\theta_{3}\\right) & 0 \\\\\n",
"0 & -\\sin\\left(\\theta_{3}\\right) & \\cos\\left(\\theta_{3}\\right) & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1 0 0 0]\n",
"[ 0 cos(theta3) sin(theta3) 0]\n",
"[ 0 -sin(theta3) cos(theta3) 0]\n",
"[ 0 0 0 1]"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"resolve(R1);resolve(R2);resolve(R3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & \\cos\\left(\\theta_{1}\\right) & \\sin\\left(\\theta_{1}\\right) \\\\\n",
"0 & 0 & -\\sin\\left(\\theta_{1}\\right) & \\cos\\left(\\theta_{1}\\right)\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & \\cos\\left(\\theta_{2}\\right) & 0 & -\\sin\\left(\\theta_{2}\\right) \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & \\sin\\left(\\theta_{2}\\right) & 0 & \\cos\\left(\\theta_{2}\\right)\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"1 & 0 & 0 & 0 \\\\\n",
"0 & \\cos\\left(\\theta_{3}\\right) & \\sin\\left(\\theta_{3}\\right) & 0 \\\\\n",
"0 & -\\sin\\left(\\theta_{3}\\right) & \\cos\\left(\\theta_{3}\\right) & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 cos(theta1) sin(theta1)]\n",
"[ 0 0 -sin(theta1) cos(theta1)] [ 1 0 0 0]\n",
"[ 0 cos(theta2) 0 -sin(theta2)]\n",
"[ 0 0 1 0]\n",
"[ 0 sin(theta2) 0 cos(theta2)] [ 1 0 0 0]\n",
"[ 0 cos(theta3) sin(theta3) 0]\n",
"[ 0 -sin(theta3) cos(theta3) 0]\n",
"[ 0 0 0 1]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(R1,R2,R3)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Boosts"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [],
"source": [
"K1 = -I*matrix([[0,1,0,0],[1,0,0,0],[0,0,0,0],[0,0,0,0]])\n",
"K2 = -I*matrix([[0,0,1,0],[0,0,0,0],[1,0,0,0],[0,0,0,0]])\n",
"K3 = -I*matrix([[0,0,0,1],[0,0,0,0],[0,0,0,0],[1,0,0,0]])"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"0 & -i & 0 & 0 \\\\\n",
"-i & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"0 & 0 & -i & 0 \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"-i & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"0 & 0 & 0 & -i \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"0 & 0 & 0 & 0 \\\\\n",
"-i & 0 & 0 & 0\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 0 -I 0 0]\n",
"[-I 0 0 0]\n",
"[ 0 0 0 0]\n",
"[ 0 0 0 0] [ 0 0 -I 0]\n",
"[ 0 0 0 0]\n",
"[-I 0 0 0]\n",
"[ 0 0 0 0] [ 0 0 0 -I]\n",
"[ 0 0 0 0]\n",
"[ 0 0 0 0]\n",
"[-I 0 0 0]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(K1,K2,K3)"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {},
"outputs": [],
"source": [
"B1 = exp(I*th[1]*K1).expand()\n",
"B2 = exp(I*th[1]*K2).expand()\n",
"B3 = exp(I*th[1]*K3).expand()"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & -\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & 0 \\\\\n",
"-\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & \\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & -\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"-\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & \\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right) \\left(\\begin{array}{rrrr}\n",
"\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & 0 & -\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"-\\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}} & 0 & 0 & \\frac{1}{2} \\, e^{\\left(-\\theta_{1}\\right)} + \\frac{1}{2} \\, e^{\\theta_{1}}\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[ 1/2*e^(-theta1) + 1/2*e^theta1 -1/2*e^(-theta1) + 1/2*e^theta1 0 0]\n",
"[-1/2*e^(-theta1) + 1/2*e^theta1 1/2*e^(-theta1) + 1/2*e^theta1 0 0]\n",
"[ 0 0 1 0]\n",
"[ 0 0 0 1] [ 1/2*e^(-theta1) + 1/2*e^theta1 0 -1/2*e^(-theta1) + 1/2*e^theta1 0]\n",
"[ 0 1 0 0]\n",
"[-1/2*e^(-theta1) + 1/2*e^theta1 0 1/2*e^(-theta1) + 1/2*e^theta1 0]\n",
"[ 0 0 0 1] [ 1/2*e^(-theta1) + 1/2*e^theta1 0 0 -1/2*e^(-theta1) + 1/2*e^theta1]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1 0]\n",
"[-1/2*e^(-theta1) + 1/2*e^theta1 0 0 1/2*e^(-theta1) + 1/2*e^theta1]"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"show(B1,B2,B3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Verificando que $R_i$ e $B_i$ são transformações de Lorentz\n",
"$$\\Lambda^T\\eta\\Lambda = \\eta$$"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"-1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[-1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1 0]\n",
"[ 0 0 0 1]"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"eta = diagonal_matrix([-1,1,1,1]);eta"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"-1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[-1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1 0]\n",
"[ 0 0 0 1]"
]
},
"execution_count": 58,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(R1.transpose()*eta*R1).simplify_trig()"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(\\begin{array}{rrrr}\n",
"-1 & 0 & 0 & 0 \\\\\n",
"0 & 1 & 0 & 0 \\\\\n",
"0 & 0 & 1 & 0 \\\\\n",
"0 & 0 & 0 & 1\n",
"\\end{array}\\right)\n",
"\\end{math}"
],
"text/plain": [
"[-1 0 0 0]\n",
"[ 0 1 0 0]\n",
"[ 0 0 1 0]\n",
"[ 0 0 0 1]"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(B3.transpose()*eta*B3).expand()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Espaço de Minkowski"
]
},
{
"cell_type": "code",
"execution_count": 60,
"metadata": {},
"outputs": [],
"source": [
"M = VectorSpace(SR,4, inner_product_matrix=eta)"
]
},
{
"cell_type": "code",
"execution_count": 61,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(3,\\,2,\\,1,\\,2\\right)\n",
"\\end{math}"
],
"text/plain": [
"(3, 2, 1, 2)"
]
},
"execution_count": 61,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w = M([3,2,1,2]);w"
]
},
{
"cell_type": "code",
"execution_count": 62,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\left(3,\\,0,\\,1,\\,2\\right)\n",
"\\end{math}"
],
"text/plain": [
"(3, 0, 1, 2)"
]
},
"execution_count": 62,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"u = M([3,0,1,2]);u"
]
},
{
"cell_type": "code",
"execution_count": 63,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}18\n",
"\\end{math}"
],
"text/plain": [
"18"
]
},
"execution_count": 63,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w.dot_product(w) #Euclidiano"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"$$w^\\mu u_\\mu = \\eta_{\\mu\\nu}w^\\mu u^\\nu = \\eta(w,u)$$"
]
},
{
"cell_type": "code",
"execution_count": 64,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}-4\n",
"\\end{math}"
],
"text/plain": [
"-4"
]
},
"execution_count": 64,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w.inner_product(u) #Minkowski"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}-4\n",
"\\end{math}"
],
"text/plain": [
"-4"
]
},
"execution_count": 65,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w*eta*u"
]
},
{
"cell_type": "code",
"execution_count": 66,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}0\n",
"\\end{math}"
],
"text/plain": [
"0"
]
},
"execution_count": 66,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(w).inner_product(w)"
]
},
{
"cell_type": "code",
"execution_count": 67,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}-4\n",
"\\end{math}"
],
"text/plain": [
"-4"
]
},
"execution_count": 67,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"(u).inner_product(u)"
]
},
{
"cell_type": "code",
"execution_count": 68,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}3 \\, \\sqrt{2}\n",
"\\end{math}"
],
"text/plain": [
"3*sqrt(2)"
]
},
"execution_count": 68,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"w.norm()"
]
},
{
"cell_type": "code",
"execution_count": 69,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
""
],
"text/latex": [
"\\begin{math}\n",
"\\newcommand{\\Bold}[1]{\\mathbf{#1}}2 i\n",
"\\end{math}"
],
"text/plain": [
"2*I"
]
},
"execution_count": 69,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sqrt(u*eta*u)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 9.2",
"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.8.5"
}
},
"nbformat": 4,
"nbformat_minor": 4
}