{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from sympy import *\n", "import numpy as np\n", "init_printing()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[-1, 1, 0],\n", " [-1, 0, 1],\n", " [ 0, -1, 1]])" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a = np.array([[-1, 1, 0], [-1,0,1], [0, -1, 1]], np.int64)\n", "a\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAL0AAAAWCAYAAACVDJ0dAAAABHNCSVQICAgIfAhkiAAAA/5JREFUeJzt21mIHFUUgOEvRgmaqFEfVNxCJG4ohiAuiDCJGIIiKOqDgqhPguKC+KCIZlQkIm5EBPFBghsiiAkouIARJBoCasAlmhAYH4wKKkxGSWTcHs5tpqfSVV013UlXOvVDc3vq3O2cPlX33HNraGhomMYN2Ihx/IPFg53OUHMP/sP1g55IDwxah1FM4mesxWlVOzgL/2ICL+FRHNeh3olJvgN/YQzP4qjqcy7kWjyHT7BTGPfVPo8xSF4XOlX+oTowKFsNWocRPI73Uv1NVQe9PTW8s6DOqfgl1VubBvwo/f0djqk6aAGbU78T2GL4nP5knIFZfehrULaqkw6fi4f2vCqDPpgGuqygzvupzh2Z60+n6y9UGbALS7FIGHTE8Dl9PxkGW/Wqw2upzUlZwUEFjWancjJHvhDLRTjzfEa2En/iRsytMNEi1mObUGTYWCr0eqJP/Q3CVnXToeW3s7OCIqfvxrJUfiCWkXYmsAGH4cIu/awRit3cw1z2d5ak8suCOmvU205ldKAGehQ5/fxU7sqRn57KrTnybansx6Zm2Gk5zBcDnUVv1E2H3ak8MivIc/pZuETckT/k1Gl1Np4jb12fnyNvcT/OxNtd6g0zS/CHqQdFJ+pupzI6sO/0GEvlSFaQdfoVeEqkepbgRZHznAmtHXy3mOwnkenJu3nqxpjQqeyn2+ZrrlgNN9szTGynznYqqwP7To9XxAP7SbyJx7AADs5UXIG70vevRZ40j9ak91g+Ekdk6g0L200tnWXY0UV+rnj41CUsmAl11OFHrMIzuC5d+xBjWae/Gw+JnfgbIiV5ijiNzfJ9KvNi9kWpzIv591cu7XN/ZTeAdaaOOlwhUuYbcKvww0k6x/Q7sQ5v4QQRf3VifSqXd+jncFwsNsEbe5j4gUDdNoAzoY46tLKLo/hGW+q9KHvT2sAenSPfLtKVC8TpbTsPizjvZZGvL+J4cYqXFyb1whr1TvMRDrMb33apV2c7ldWBvatHO63XYMaygmx4007rzii6MW7Dp1gtlv0tuECER1vxQInJrcJNuEUYP4+r0oepd4AuamvzK+7NtGnN/e8S8xgEc8Q7Tpt1n2NZO1HdVr3YqYoO7N3fu51cnYqcvsxJ2Hach0fEJvhysTtfLZ72v5fooyyLhbHaWZg+xMqUNcI54qDs3T7Oo5+cjUP0Pyyoaqte7FQXHfKodKJ7X2pwdZVGNWK+2ID361h8WBlWO60T/ntslUbXpEbviJd2enllYRBcKeLMTq9DN0wxbHaag/NFqnxcRb89FF+ZftDS/BNJQ50ZNd1fV3aqVBTT7xLx+jKRtpxn5qezDQ37go/FxvU3fCY21w0NDQ0NBxz/A6/UGwvipM87AAAAAElFTkSuQmCC\n", "text/latex": [ "$\\displaystyle \\left\\{ 0 : 1, \\ - i : 1, \\ i : 1\\right\\}$" ], "text/plain": [ "{0: 1, -ⅈ: 1, ⅈ: 1}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Matrix(a).eigenvals()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[ \\left( 0, \\ 1, \\ \\left[ \\left[\\begin{matrix}1\\\\1\\\\1\\end{matrix}\\right]\\right]\\right), \\ \\left( - i, \\ 1, \\ \\left[ \\left[\\begin{matrix}- \\frac{\\left(-1 - i\\right) \\left(1 - i\\right)}{2 \\left(1 + i \\left(-1 + i\\right)\\right)}\\\\- \\frac{-1 + i}{1 + i \\left(-1 + i\\right)}\\\\1\\end{matrix}\\right]\\right]\\right), \\ \\left( i, \\ 1, \\ \\left[ \\left[\\begin{matrix}- \\frac{\\left(-1 + i\\right) \\left(1 + i\\right)}{2 \\left(1 - i \\left(-1 - i\\right)\\right)}\\\\- \\frac{-1 - i}{1 - i \\left(-1 - i\\right)}\\\\1\\end{matrix}\\right]\\right]\\right)\\right]$" ], "text/plain": [ "⎡ ⎛ ⎡⎡-(-1 - ⅈ)⋅(1 - ⅈ) ⎤⎤⎞ ⎛ ⎡⎡-(-1 + ⅈ)⋅(1 + ⅈ) ⎤⎤\n", "⎢ ⎜ ⎢⎢──────────────────⎥⎥⎟ ⎜ ⎢⎢──────────────────⎥⎥\n", "⎢⎛ ⎡⎡1⎤⎤⎞ ⎜ ⎢⎢2⋅(1 + ⅈ⋅(-1 + ⅈ))⎥⎥⎟ ⎜ ⎢⎢2⋅(1 - ⅈ⋅(-1 - ⅈ))⎥⎥\n", "⎢⎜ ⎢⎢ ⎥⎥⎟ ⎜ ⎢⎢ ⎥⎥⎟ ⎜ ⎢⎢ ⎥⎥\n", "⎢⎜0, 1, ⎢⎢1⎥⎥⎟, ⎜-ⅈ, 1, ⎢⎢ -(-1 + ⅈ) ⎥⎥⎟, ⎜ⅈ, 1, ⎢⎢ -(-1 - ⅈ) ⎥⎥\n", "⎢⎜ ⎢⎢ ⎥⎥⎟ ⎜ ⎢⎢ ────────────── ⎥⎥⎟ ⎜ ⎢⎢ ────────────── ⎥⎥\n", "⎢⎝ ⎣⎣1⎦⎦⎠ ⎜ ⎢⎢ 1 + ⅈ⋅(-1 + ⅈ) ⎥⎥⎟ ⎜ ⎢⎢ 1 - ⅈ⋅(-1 - ⅈ) ⎥⎥\n", "⎢ ⎜ ⎢⎢ ⎥⎥⎟ ⎜ ⎢⎢ ⎥⎥\n", "⎣ ⎝ ⎣⎣ 1 ⎦⎦⎠ ⎝ ⎣⎣ 1 ⎦⎦\n", "\n", "⎞⎤\n", "⎟⎥\n", "⎟⎥\n", "⎟⎥\n", "⎟⎥\n", "⎟⎥\n", "⎟⎥\n", "⎟⎥\n", "⎠⎦" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "a1 = Matrix(a).eigenvects()\n", "a1" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}i\\\\1 + i\\\\1\\end{matrix}\\right]$" ], "text/plain": [ "⎡ ⅈ ⎤\n", "⎢ ⎥\n", "⎢1 + ⅈ⎥\n", "⎢ ⎥\n", "⎣ 1 ⎦" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "simplify(a1[1][2][0])" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/latex": [ "$\\displaystyle \\left[\\begin{matrix}- i\\\\1 - i\\\\1\\end{matrix}\\right]$" ], "text/plain": [ "⎡ -ⅈ ⎤\n", "⎢ ⎥\n", "⎢1 - ⅈ⎥\n", "⎢ ⎥\n", "⎣ 1 ⎦" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "simplify(a1[2][2][0])" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }