{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import sympy\n",
    "sympy.init_printing()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "a, b, c, d = sympy.symbols(\"a b c d\")\n",
    "i = sympy.I"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "X = sympy.Matrix([[0, 1], [1, 0]])\n",
    "Z = sympy.Matrix([[1, 0], [0, -1]])\n",
    "\n",
    "M = sympy.Matrix([[a, b], [c, d]])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADUAAAAzCAYAAAA3v0BtAAAACXBIWXMAAA7EAAAOxAGVKw4bAAACsklEQVRoBe1ai03DQAxtEANUsEHZoIUJKBtQNgBGQEyAygbABAg2KBtU7QawAYgNynvtWQrX+yR3TbBQTnKTOHf2e2cnsawWvV6vD9kaq9Xqe0upTFEUhRM7Yb5DVpY8gFRPuwDzzMJNHrM9/HCcgUBRkuuNWvcv8P7CDbRr3EJKN/qa6ParzEfuTs28TxyPIFPs0keVtbuYA/9D2HmBjOA3+qxHScHgAsbuYOyVAM3DucCRoW+MmPHzBJdfkGPIAFJpBNMPhq9gpS+EaNHsFAk+8LqpQT+QCYTPyXMdP0FSMDSBLB0G59CNzW46bv+tKkZqDHgMvz0kr3lf3fCSqhiFA3WMAMhLCvcEsESljF+i5/2ilye3fR4iVQXLYZVJbc8JkZJouDBJFPndUje8pMyrm4BdKSa6xr5TOTvlJWWMvuE4cDiQSPG+uhEjxdKEX3N7jKBYlqJp3//T6yApgH4Eui+83s8FpXnVX+D6UnTajtHaD4AZlVuQkTQ8wfUpCLsqjZ3yg09mCp9fyRbWnPQ7h/97n7MoKZNiNz4DTerhm2Va7RFMv9rWlCzoSCkJRBRGF6noFimZ0EVKSSCiMLpIRbdIyYR/GalomSSbj5priPPKDUVZl3uE39qN1CApGGQxmdRQzCXD9fCf1EgNph+LWRaVkNoNxVxSIJTcSA2SygWWuT65kaqZ1Bib4mr+fJvN4n3nUEnKPMtOwCWl9ElKqs2pSlKAJoAlKmXgEj2+xJxDKyknWEvpbaRqJSXRsHisLyWK3kaqSlL8lBg2rhQTnbeRqpKUIZTcSNVMKrmRqpYUUjC5kRqs/ZgG+GYkNRRNCuUekhqpUVKs/XKRpa43L4zajVS16Ze6EVzXkcrZvTbXdpFqc7dzfMnbb2CX+6VSJcd+o2ttzHAmJdT/+xPjD2U+4S47RBrKAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}0 & 1\\\\1 & 0\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡0  1⎤\n",
       "⎢    ⎥\n",
       "⎣1  0⎦"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEYAAAAzCAYAAAAqwX72AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADFElEQVRoBe2bjW0UMRCFbxEFnKCDo4MEKuDogNABSQkRFaDQQaACFDo4qCBKOoAOiNLB5b3gkYaN/87WZM8bj+Ss1+v1zHw3Xq93lGGxWCxRHsh2u7190DjDhmEYvP7T1d8o21E5B5jFUyjwezPynSw2z/CH8g4QBlVO/jXP/y98/s93eHzvu4CZP4EdPXye2x9z8QB9L1AOQXlvnj+w68z58BfHVyhnsO+Pays+RMG4B9M3jH6D8hplVazJ4EbYd4VhPwPEDw7v7L3CkdOjCk50KjEyUI5QOO++U/m+CJw/hi1L2HYPhXbRXhx4fs7zGomCqRn4Ee49go5rj55LtK1d9Hgu5zW1DGYNFznFxyLPP14vlibBZEbDi2IquLFJMLBbnJbo0Awkipa6cdd6q2By/HyZ0ynUp1UwEhU+vySa+F5TLE2CccsynfZNF2mze48pxv04N/6EmpVHlUQMrxdLkxHjvOX2hG/jYzlEw7WKqvH1rPNmwcDxr/DwBkv3e/HULeMfcP5R2kqP0b0SB4Uy/jKct/LrcC/CN85LGPcFxymF0fEJ9siUeoPzt7CL9lVJEgyU8NV7LwW23cKwUwvjmp1KFjD0mB2MpqHqHYyCoasdjKah6h2MgqGrHYymoeodjIKhqx2MpqHqHYyCoasdjKah6sktAftiL2KS1FJ2mFZh/wEU7JQsTILBoGZJLUsasJsb3+JkYXQqYXDTpJYlGG4wuQFGKUoWRsHAcNOkliWY2rFTYNZQ4PvwzO0+hddnKUEwbo6mnJbvq6l+zV0PgoEn4rREh3ZOoogPuFlKDEyOw1VJrRwFU/WJLdcSFT7bJJqqklq+gaXNTeVfON8lKrkKVX/vpQ1BMFzuYBz7+AyTtqqkFgcPCfXjGj92TyKpqWSa1JrE40ylKTCmSa1MGyfpFgWDcDZNak3icabS4DNG3W+W1FI6TKp4RhYnC5Ng3EPQJKllQkMNCtuLk4XRqaR0PLlqBxP4yTuYDiZAINDcIyYARlal1fgzg1uNArfNp3nsNzyT7U7/Ry7AGP8j2+YO/hNP/mmwrOMAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}1 & 0\\\\0 & -1\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡1  0 ⎤\n",
       "⎢     ⎥\n",
       "⎣0  -1⎦"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAADYAAAAzCAYAAADciPtuAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADi0lEQVRoBe2ajVHcMBCFzxkKIEkHlw4gVADp4EgHCR1ACZmkA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Xsy8lFGsTcmlMwHLxlLVz8phdiVxKeyrOzdFa2T30UV4pembFt1vieFMqiXuMbxOXs/9HzH9G2QyI2L2+5AAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a & b\\\\c & d\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡a  b⎤\n",
       "⎢    ⎥\n",
       "⎣c  d⎦"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "term_X = M*M + i*X\n",
    "term_Z = M*M - i*Z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOQAAAAzCAYAAACHbKQaAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJVklEQVR4Ae2di5HUOBRFZygCGCCDJgNgI1jIYNgMFjKAIgKKzQCIgE8GMxkskAFksEAGs/e4pS75J8sfyXK3VKWxLcnSfffp82S335yfnZ1dKLbCzc3N71ZiSSgMFAYWYeD8/Lxz3J2r9u+Ku0Yr7zQgnzfSol8akK9MQxbT32VyiE59aSAxA+rrV2rycaPZ69sm4Yk6/XUjc43LN+5EINBvBeKr4v01wJQ2CwOxGFA/f+LWrb7+TNdPb7mJGZw/EzB31ngjTDulPcgAW4FQGIjOQG4DEjP5S3SpAxrQJHCheKX4SxGz/iRDTjzMwaJ7Hyh+VUSfWF7Jg9p9MdR2VgNSyzh7V/dhEgP0h9K+pWYPHIqYFT8UczDnU1NQtZcTD3Ow6N5vig8lFA9T2L+tEejPbv9uYchqQLroNJNgpl4qQuKkoDoeK2KbzwngWEuBc3Avfe8iPKypE9o2pIyaYBfCfKYJ4b7iS59ishyQImAn0OwfH0oA74ziE055zIbESWGqAic1lvFNC/Owpk4qi2dCn5qFeYxq7VPWMfdELWs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7G3txycqxR/9tkstq2ggjpMklb5eYmjMQxKNdcPKH3mw5DB//APbrGvNpCOLwCMDLk7kg6G533Kbd3QJrOzerIE8sqiHSWVa7t7/xcJ8e5OA324pgg1174uH8fUb2wBTnTjQsluHav02JTi1cXwS3NLJipzjul8vplNbPee93JzFK9T9SR1ZAZnLSak2NnZrfvIFVkmtNg1cV+YaqTY7vCdOIYKxdChISZmHkyTOx1phuCIVUZwyE8YxUlcSQ9k1+2X8F9ORWPth3JxmKXr6PkOeRbIVMft4g5NUdz2jtmfu2A7DVZ5xC30L2sxHZvulCV0avZIubopCzYwNHzO/QeckEux1Ulu39zvyfdIuZxWlm39Cnwm/MKua72S+uFgRUYKANyBdJLk4WBPgbKgOxjpqQXBlZgwO4hd3rKc+G2b97duEnlvDBQGFiIgeZ4U7XV+LPvIXeNdvAp0vWj7kaxclkYKAxMYUADknfOzV+wXf8PK23EqiUd/qMAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a^{2} + b c & a b + b d + i\\\\a c + c d + i & b c + d^{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡   2                        ⎤\n",
       "⎢  a  + b⋅c     a⋅b + b⋅d + ⅈ⎥\n",
       "⎢                            ⎥\n",
       "⎢                        2   ⎥\n",
       "⎣a⋅c + c⋅d + ⅈ    b⋅c + d    ⎦"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "term_X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAOEAAAAzCAYAAABhRW9eAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAJfElEQVR4Ae2djZHUOBCFdykCWLgMhgyAi+Agg93L4CADKCKguAyACPjJYPciOCADyOCADPbeZ6RBI//JtiTLg1SltS3L0uunbqltj3tPT05OzpRb6fr6+nursBZUBioDsxk4PT3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HMDoJLu8qjgYPpQwk3AiyLA/HShvKswMGhWNR+sGxLOIx9rXCjINkCI6uvpWMRxLP6KSn4dFBAZ2HGUIeD/6rC7GRmA2K7jAYONp3wkGC1QLyeoINYRmQ7iHfqtVvCIUpNKjowMgCn8KzJqojg08LMYkLoFxJBsEZd4ZtN1TR/cCuZdUcDBwv45EC8QDbXWaWiyKbb7Og8j4f9hJHY8If+OdsmRB64lAyyUzlYNueaUna5XzqYKMQT40TC/Q/lgKr7lGIs1HhynhPg/ipdIbgUiZUuKKBzEndUneMeHPxPBx1bV+jA/e2qK0GWuMGzXaAQLF11+mRbIkeKa4WTeKwv3bZ1zESGi9rcCmjbGju3/pR92lSedWvQhUNlnTo0BVNI3SW4ad9cz85ZX386l84dNTMrZPkPVFqBYgfq6vK8KQTLQJ2WbHnRB/fGg6PiAyMfAc/BAZ1vBA/dvIrWN7ZXtwLFapb4bk6yIreSBqPL3WzVi1EwEcuobDEwJWpjf59ilL3IwMhG9s3xbDhlsnuDDDrGre5NSYzQKDOrIPdWTRIQll6O7e/73MDBpQTiBesglhmy0WZJaTAYrgE6yEEOYTbO8304kgxBAZ2TxR01s8FrYWEma973acuqx6xA2UHgYGe2sO8IVWVeIF61xX3IrMDBdDqGZapstFlKMtgZAzyP5IGRl4zFmjwvwc1Y63qesJN7AzqrDgtTucF/BW52Wkrg7I7rhS0GtjoWOXBbI0zijrZGIn8BK66918zfe+3RZWCrY5ENd8r3hO5AZN2XL176bzez8rFmZ1sdi5y4j3UlXFPvat+VgUkMVCOcRFetXBmIz0A1wvic1hYrA5MYsPeEOz2pOXOvlE9cH2y4hNT9ysBCBnwbU3ONzdn3hDuvfeJ1dP342atWDysDlYFQBmSEvDf0fwF29T/nBZzMu7uvEQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}a^{2} + b c - i & a b + b d\\\\a c + c d & b c + d^{2} + i\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡ 2                        ⎤\n",
       "⎢a  + b⋅c - ⅈ   a⋅b + b⋅d  ⎥\n",
       "⎢                          ⎥\n",
       "⎢                     2    ⎥\n",
       "⎣ a⋅c + c⋅d    b⋅c + d  + ⅈ⎦"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "term_Z"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 12316 characters]\n",
      "text/latex": [
       "$\\displaystyle \\left[ \\left\\{ a : - \\frac{\\sqrt{2}}{2}, \\  b : \\frac{\\sqrt{2} i}{2}, \\  c : \\frac{\\sqrt{2} i}{2}, \\  d : - \\frac{\\sqrt{2}}{2}\\right\\}, \\  \\left\\{ a : \\frac{\\sqrt{2}}{2}, \\  b : - \\frac{\\sqrt{2} i}{2}, \\  c : - \\frac{\\sqrt{2} i}{2}, \\  d : \\frac{\\sqrt{2}}{2}\\right\\}, \\  \\left\\{ a : - \\frac{\\sqrt{2} i}{2}, \\  b : \\frac{\\sqrt{2}}{2}, \\  c : \\frac{\\sqrt{2}}{2}, \\  d : - \\frac{\\sqrt{2} i}{2}\\right\\}, \\  \\left\\{ a : \\frac{\\sqrt{2} i}{2}, \\  b : - \\frac{\\sqrt{2}}{2}, \\  c : - \\frac{\\sqrt{2}}{2}, \\  d : \\frac{\\sqrt{2} i}{2}\\right\\}\\right]$"
      ],
      "text/plain": [
       "⎡⎧   -√2      √2⋅ⅈ     √2⋅ⅈ     -√2 ⎫  ⎧   √2     -√2⋅ⅈ      -√2⋅ⅈ      √2⎫  ⎧\n",
       "⎢⎨a: ────, b: ────, c: ────, d: ────⎬, ⎨a: ──, b: ──────, c: ──────, d: ──⎬, ⎨\n",
       "⎣⎩    2        2        2        2  ⎭  ⎩   2        2          2        2 ⎭  ⎩\n",
       "\n",
       "   -√2⋅ⅈ      √2     √2     -√2⋅ⅈ ⎫  ⎧   √2⋅ⅈ     -√2      -√2      √2⋅ⅈ⎫⎤\n",
       "a: ──────, b: ──, c: ──, d: ──────⎬, ⎨a: ────, b: ────, c: ────, d: ────⎬⎥\n",
       "     2        2      2        2   ⎭  ⎩    2        2        2        2  ⎭⎦"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(term_X)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 7712 characters]\n",
      "text/latex": [
       "$\\displaystyle \\left[ \\left\\{ a : - \\sqrt{i}, \\  b : 0, \\  c : 0, \\  d : - \\sqrt{- i}\\right\\}, \\  \\left\\{ a : - \\sqrt{i}, \\  b : 0, \\  c : 0, \\  d : \\sqrt{- i}\\right\\}, \\  \\left\\{ a : \\sqrt{i}, \\  b : 0, \\  c : 0, \\  d : - \\sqrt{- i}\\right\\}, \\  \\left\\{ a : \\sqrt{i}, \\  b : 0, \\  c : 0, \\  d : \\sqrt{- i}\\right\\}\\right]$"
      ],
      "text/plain": [
       "⎡⎧                          ____⎫  ⎧                         ____⎫  ⎧         \n",
       "⎢⎨a: -√ⅈ, b: 0, c: 0, d: -╲╱ -ⅈ ⎬, ⎨a: -√ⅈ, b: 0, c: 0, d: ╲╱ -ⅈ ⎬, ⎨a: √ⅈ, b:\n",
       "⎣⎩                              ⎭  ⎩                             ⎭  ⎩         \n",
       "\n",
       "                ____⎫  ⎧                        ____⎫⎤\n",
       " 0, c: 0, d: -╲╱ -ⅈ ⎬, ⎨a: √ⅈ, b: 0, c: 0, d: ╲╱ -ⅈ ⎬⎥\n",
       "                    ⎭  ⎩                            ⎭⎦"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(term_Z)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAHkAA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RU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}- \\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2} i}{2}\\\\\\frac{\\sqrt{2} i}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡-√2   √2⋅ⅈ⎤\n",
       "⎢────  ────⎥\n",
       "⎢ 2     2  ⎥\n",
       "⎢          ⎥\n",
       "⎢√2⋅ⅈ  -√2 ⎥\n",
       "⎢────  ────⎥\n",
       "⎣ 2     2  ⎦"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt_miX = sympy.Matrix([[-sympy.sqrt(2)/2, i*sympy.sqrt(2)/2], [i*sympy.sqrt(2)/2, -sympy.sqrt(2)/2]])\n",
    "sqrt_miX"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAIIAAAAzCAYAAABbldAtAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFn0lEQVR4Ae1ci1EbMRC1MymASTpwOgBSQUwHkFQQ6IAMFTCkA+iAgQ5CKkigA+ggxB047120Hvm8ts/2rVayTzPCd5JO2s/b1edu6fd6vT3kmTQej0czhV1B8RLo9/uqvt+As0fkv7V85c0xCN5HHi/K3jQWOv5dTdfU/R2BwHQED9CP8tn/Yte/BONBRFNMX3XtSl2hg0OeU7oGG5WuBQhZsUVvQIJA9FNWhG0xMVkCAfK+QHafnrZY7zOsvZ0pcS6ANxiAhAG8wUOdFNSdo+wD6nKYuurkNb4HHwLyP+QH+Qo8vTTuwKBhdkAAj99C1tglAO61ilLKAAIuzi+h+IoP3HMV/4hfzt1uYMgKCEEoh/MsHuW0nmIT+DsF8XsCAjKC6xHKCYpr5COWeaTc1gh0mZcegkg05gnG0RbAv1A+DIaQiJTpYbIBQhDCMLaWaVK34m4ILl4VTu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RnsozuqsiZUM6Vo4QMwECtitZR/WI0rVf0o5y1Yq19vUyPF99hwlFcicgnmHqI13UzY3ukv42oSM8u1KEmNUagfxkG9Ujwrb8DcrYJLqrDfI4PS0MIJJBLIGQbVSPMJ/gV47XJ6eG8AYMbmmknE3oC1MLX2vfsh/cCy1qt2ZAgEVkG9WjSsKgEDLgNLFOdFcb1KwUIWayRoi4yDKqJ6IvxSUtcYjcOLqrDaIAwpUixEyBEObJiVtsg8HS+ggK4VG7bCenFo6W/GDsxhFiZlODJYMF9p19dFcHhASogmVmH91lOjUkkHExQwAMWUd3CRAGYbsxESwI194TTOq7izIlUNczuKje+fCzZv7jiUGNrRsAgV+1dGnLJAAg/ABL3MXE6eEf3zdR3upFKMEAAAAASUVORK5CYII=\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}- \\sqrt{i} & 0\\\\0 & - \\sqrt{- i}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡-√ⅈ     0   ⎤\n",
       "⎢            ⎥\n",
       "⎢        ____⎥\n",
       "⎣ 0   -╲╱ -ⅈ ⎦"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt_iZ = sympy.Matrix([[-sympy.sqrt(i), 0], [0, -sympy.sqrt(-i)]])\n",
    "sqrt_iZ"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAE8AAAAzCAYAAADW1FU8AAAACXBIWXMAAA7EAAAOxAGVKw4bAAADhUlEQVRoBe2ai3HTQBCGLYYCMtCB6YBHBTgdkHQAdADjCpjQQeiAiTtIqCCTdBA6wLgD8//m1nNSzjrtPRTJupu5WF7p9nY/7Z5O3lSz2ewE/VHbbrebR8KJCqqqcjJ6Bh536H8b/WKinA65fdXgQ15XhMd2ikirrP75v7j8JQFwqfGBaMdH4BVKAQSeB4zZD8FaIOn9B8JX6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\- i & 0\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡0   -ⅈ⎤\n",
       "⎢      ⎥\n",
       "⎣-ⅈ  0 ⎦"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt_miX**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAEIAAAAzCAYAAAAjKt6MAAAACXBIWXMAAA7EAAAOxAGVKw4bAAADZElEQVRoBe1bi5HTMBC1GQq4gQ5CB3wqINcBRwdABzCpgDk6ODpgSAc5KmDuOjg6IJMOwntm90ZyZEtrK87EI80osWVpd9/TriJrJ3VVVReoB2W/3+8OGmfQUNd1EC+hPaDuW/UGRFRzrMC5aWEl9s0TfLBcAnTt1E//m+f3CYweViBssCoR80NsRPTU2L9CjH3GmBdg9uReA1uuxf6/tAn1Gnb9kTbTl5kISCcBa5OWI3QGCXcQ+xXAG1tkEbzDN13fTIaZCCgh8yctAPsRBlwoCTQG1zu0k5Qb1Eu2Wcq5rhFXAHkfAPobbUvxjsDj7qZzJWIJSNsALN378LmpJIWGMEx3ZFg8wA2/mbRk7Jw428+sKlM9YiXgf0LByqokc38FqbPvilcv6dw9up3d6ygRmIEFBjD2WBib5hW5GTntx3OruigRELh1VmeGxw+rksz9ddZDYtVbuK8wlSgR/FmiRHjGO5H83aQhc2e1B2JD7q9tZq+NEuHg4NqwdgxxHk1+eQuNDNl2UY/gc1NJIkJW6peQ3IQF7nVra1KWsTMX7dcBea/Qdj9kspKIUKVQsJbFk6/uJyuwg+G5dcKVocuweI/6YYhhSfsIKL6FIla+cO3EkCH6co7h7K9gk4bIG9y/hW2hHWdUbxIRlAIF5v17VPuIDrCHi/iXESK8oamh4Q2a400hQma1EFGI8AO8eETxiOIRPgPFI3w+yhpRPML3iKQtNvbz+rY5OpHiq5/mTt6RepNSUSIgJGsiZRroB1qiSaleIkBC9kTKgYkTNOAFLZqUii2W2RMpE+AepCJGxBJSQ4elfAVm4fNZlM7QQFjoQWgfUD0j7Otzkmdif3JSqs8jFKTOvgtIvSSFLHfclNempFQfESlGmxMpKULH9oE3LCDDlJTqDA0I0lkP2aXeYk6khISF2sS1f+GZxeuu5MyynZSKHul1EsEzQRhDG0OGaJs5kRICHWqTM0ke0JqLjDUlpWKhkT2RYkY1bkByUipGRPZEyjhc6aMltJKTUr1EwMWyJ1LSoYzu2WTCgCEpKdW5RjhmZE2kOHKPegkCTEmpKBGy8ERX3aOiGigcticnpXpDY6D+sxxWiJBpK0QUIvwILh4hfOivxkI2II80ya/F4/1cLto4gUtfF8ofV0DG5h8Y3m3ea2xiTwAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}i & 0\\\\0 & - i\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡ⅈ  0 ⎤\n",
       "⎢     ⎥\n",
       "⎣0  -ⅈ⎦"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt_iZ**2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAP4AAAA/CAYAAADAInVAAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKjUlEQVR4Ae1di5HVNhTdZbaADSVABxA6WDpgJxXs0gGZVMCQDqAF0gHQAdABdBCyHWzOEZaR9XRt/SxLlj3jZ0uWdO8519f6WM86Pzs7u8L+Abu9fb+/v39sRx7hg4GDgTYYOD8//wJNnzi0vb4wIp8b5zz9YYWP4MHAwUBbDNxA3YeWyqqSHx0ftftHK0G1QTzJ7nMpB9znucpauxzgfg8ZL1xyWsLh0j8mTroPWuNCwhHDiYkd51/tMiDrjnEP7Au1h6H4LXR8SYA59trxav0G3B8kzDpdL8e5+6AlDuZwSLaei/fFPtb4vhlypAPY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v7fxP/LEdDBwMNMoA/PmL5dPqY7aEw2Yzm9O/M2BtP/B0OvnWnZXmCB4MHAxUygCcnoPh+i/nppaf/wfk7BIal8UrlgAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}- \\frac{i \\sqrt{- i}}{2} - \\frac{\\sqrt{i} i}{2} & - \\frac{\\sqrt{i}}{2} + \\frac{\\sqrt{- i}}{2}\\\\- \\frac{\\sqrt{i}}{2} + \\frac{\\sqrt{- i}}{2} & \\frac{\\sqrt{i} i}{2} + \\frac{i \\sqrt{- i}}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡      ____                   ____ ⎤\n",
       "⎢  ⅈ⋅╲╱ -ⅈ    √ⅈ⋅ⅈ     √ⅈ   ╲╱ -ⅈ  ⎥\n",
       "⎢- ──────── - ────   - ── + ────── ⎥\n",
       "⎢     2        2       2      2    ⎥\n",
       "⎢                                  ⎥\n",
       "⎢           ____               ____⎥\n",
       "⎢    √ⅈ   ╲╱ -ⅈ     √ⅈ⋅ⅈ   ⅈ⋅╲╱ -ⅈ ⎥\n",
       "⎢  - ── + ──────    ──── + ────────⎥\n",
       "⎣    2      2        2        2    ⎦"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "H_ = sqrt_miX * sqrt_iZ**3 * sqrt_miX\n",
    "H_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 5992 characters]\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\frac{i \\left(- \\sqrt{i} + \\left(- i\\right)^{\\frac{5}{2}}\\right)}{2} & - \\frac{\\sqrt{i}}{2} + \\frac{\\sqrt{- i}}{2}\\\\- \\frac{\\sqrt{i}}{2} + \\frac{\\sqrt{- i}}{2} & \\frac{i \\left(\\sqrt{- i} + \\sqrt{i}\\right)}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡  ⎛          5/2⎞            ____ ⎤\n",
       "⎢ⅈ⋅⎝-√ⅈ + (-ⅈ)   ⎠     √ⅈ   ╲╱ -ⅈ  ⎥\n",
       "⎢─────────────────   - ── + ────── ⎥\n",
       "⎢        2             2      2    ⎥\n",
       "⎢                                  ⎥\n",
       "⎢           ____      ⎛  ____     ⎞⎥\n",
       "⎢    √ⅈ   ╲╱ -ⅈ     ⅈ⋅⎝╲╱ -ⅈ  + √ⅈ⎠⎥\n",
       "⎢  - ── + ──────    ───────────────⎥\n",
       "⎣    2      2              2       ⎦"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "H_.simplify()\n",
    "H_"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAGkAAAA/CAYAAADjVebQAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAF6UlEQVR4Ae2ci5EUNxCGb68IAF8IOANwCEsGEMJBBnYRgYsQcAoXAnYG4AwgBHwZrL9/kFQa3bzVmodqp0o3kkZq9d+/WjOrx51ubm7OhM+E9Pp+uVx+TTOv6TIWOJ1OX5H8skP622dR5usoruiPJH1NlrXAPeLvkiYa5wkk4TV/JwWyk/SOy5gQ2j2Nldnjc7A9oNebMd2m4qPcv6ks2nhU3m36wCpNA++Q9V5KDgWr9taU47B9HsLln1noFTzJQlgi4y2KpkNoUuSwyVWxFSGJnvY75v8kCog/5/ZBca4XP2839xDYuLJLH+YWY5PSa+E70xY2u+iPSUCehoJGFvFPPq670oRvcd6R4ugesHk8sf6W+JD1H6F575mShFB50RuvOHExc47S8iblvfR5R7mjcwub9HZYiuBDdkOS6XDnXP81ysfvovc09kVojnz1YBOkVfDN8iSUkie86+r95H8khF41UGaXw10uNudZsoEJPuTMH+5EAEFKyM+fxyQoTWiN1/FzB0C/qL+lddNyW6TRKQtbCXzoNJ8k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thn/xjFlblsp0XzzTjvejC7YsuDKKb5s7+ITxZlBxQWBOkYafT1tgnk1TamAMGy3qE3o8IyNq5tDX22ywLXCuvYoHJnjSkjRtSPrgy+uTWddh/8vRT/el/S+M3IQk4m29on27SIiWL4z+jNsPu8vUk1SesvqE9R2fLuqXwI7f5nWT1TjKZjkepo15F8ZsMd/TKqjfsj/Wc0vitPCng4CVa9Yb9ALQnUgK/KUkoqC+7ajfs9/ASskvhNxnupKVXENevcsN+YKInUhK/iSc5BavdsN/DS8gujT9rFtxriZL6VHwyN4ZXFZ2X8+1vfS+F38nNngVv7AMZVW/YH+sEpfGH4Q7W0s31Wiu6XitZAPt/TTmg6WZ00nCkyG8duvygh4Tp+o7n1yxDC0CQfrrcdYj88j/xBryWF0SjzAAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\frac{\\sqrt{2}}{2} & \\frac{\\sqrt{2}}{2}\\\\\\frac{\\sqrt{2}}{2} & - \\frac{\\sqrt{2}}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡√2   √2 ⎤\n",
       "⎢──   ── ⎥\n",
       "⎢2    2  ⎥\n",
       "⎢        ⎥\n",
       "⎢√2  -√2 ⎥\n",
       "⎢──  ────⎥\n",
       "⎣2    2  ⎦"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "H = sympy.Matrix([[1, 1], [1, -1]]) / sympy.sqrt(2)\n",
    "H"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "phi = sympy.symbols(\"phi\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAgAAAAVCAYAAAB7R6/OAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAARUlEQVQoFWNgYGAoA+K7UGyEhc/QCRR0+f//PwMyBoqBxZmADLxgVAEkeEbDgchwYIEmp5mMjIwgZigQuwBxOhALAfFuAP68FOR8/BSoAAAAAElFTkSuQmCC\n",
      "text/latex": [
       "$\\displaystyle \\left[ \\right]$"
      ],
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.solve(sympy.exp(i*phi)*H_ - H)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "[encoded data, 7144 characters]\n",
      "text/latex": [
       "$\\displaystyle \\left[\\begin{matrix}\\frac{i \\left(\\left(- i\\right)^{\\frac{9}{2}} + \\sqrt{i}\\right)}{2} & \\frac{\\left(- i\\right)^{\\frac{5}{2}}}{2} + \\frac{\\sqrt{i}}{2}\\\\\\frac{\\left(- i\\right)^{\\frac{5}{2}}}{2} + \\frac{\\sqrt{i}}{2} & \\frac{i \\left(- \\sqrt{i} + \\left(- i\\right)^{\\frac{5}{2}}\\right)}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡  ⎛    9/2     ⎞        5/2        ⎤\n",
       "⎢ⅈ⋅⎝(-ⅈ)    + √ⅈ⎠    (-ⅈ)      √ⅈ   ⎥\n",
       "⎢────────────────    ─────── + ──   ⎥\n",
       "⎢       2               2      2    ⎥\n",
       "⎢                                   ⎥\n",
       "⎢      5/2           ⎛          5/2⎞⎥\n",
       "⎢  (-ⅈ)      √ⅈ    ⅈ⋅⎝-√ⅈ + (-ⅈ)   ⎠⎥\n",
       "⎢  ─────── + ──    ─────────────────⎥\n",
       "⎣     2      2             2        ⎦"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "H__ = H_ * sympy.exp(i * sympy.pi )\n",
    "H__.simplify()\n",
    "H__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Some other calculatuions:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAAcAAAAOCAYAAADjXQYbAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAo0lEQVQYGX2QARGCQBBF9xgDkAErGMEIWEEb0AEaaAVtYATHCFhBGpzv3+ydDCPuzGd3///HfbAYo81hZh04i6sYlnWCmEQGOdbq18ni/StuZAsh1LQj2IKRqwa6paS03u/eM781CxWnGogHUB3AK03+qLOTXdG7spfBrHXxa56JT8Rr3tVzIKXVK9tEesD8nTsEGW8ecNRefh/knV2YMF0kfgByKG0w9dMLeQAAAABJRU5ErkJggg==\n",
      "text/latex": [
       "$\\displaystyle i$"
      ],
      "text/plain": [
       "ⅈ"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sympy.exp(i * sympy.pi/2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPIAAAA/CAYAAADaHpXOAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAKoklEQVR4Ae1djZXWKBSd8VjArCVoB7p2MNuBnq1gtAP3bAV73A7cFtwOdDtQO9AO1p0OZu+NwBACCRAIPyHn5Au8AO/dCy9Aki9cXlxcXGP/gN3cvt3d3T0xhSM+GBgMlGHg8vLyMzQ/tWh/+VAT/qKFGfxuxEd0MDAYKMvADdQ/MkyYOmHlyOh9PxoJikdxBbqzGQFbL23yWmUuHDH2toAdeN8D2wsbvhbst9ntI8tdz+Dui2kHdN5S9sA8UUscBr6CLa9Z8eZei40+dqzhMHH5xH10lkwj8H5wYSlpW07dpetZ9cg5QUaW/RKNQQ33QdQVynkE2bfI8kplm+GIMaIx7Au8Lvtd8hiOUuTZac8Cd6hNe/RX2SMD0BuQ8M4g4nfErcM1I101UQeOGPuawL6C12W/Sx7DUYo8Ufas4A61KUo/lX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\left[\\begin{matrix}- \\frac{\\sqrt{i}}{2} + \\frac{\\sqrt{- i}}{2} & \\frac{\\sqrt{i} i}{2} + \\frac{i \\sqrt{- i}}{2}\\\\\\frac{\\sqrt{i} i}{2} + \\frac{i \\sqrt{- i}}{2} & - \\frac{\\sqrt{- i}}{2} + \\frac{\\sqrt{i}}{2}\\end{matrix}\\right]$"
      ],
      "text/plain": [
       "⎡          ____              ____⎤\n",
       "⎢   √ⅈ   ╲╱ -ⅈ    √ⅈ⋅ⅈ   ⅈ⋅╲╱ -ⅈ ⎥\n",
       "⎢ - ── + ──────   ──── + ────────⎥\n",
       "⎢   2      2       2        2    ⎥\n",
       "⎢                                ⎥\n",
       "⎢           ____       ____      ⎥\n",
       "⎢√ⅈ⋅ⅈ   ⅈ⋅╲╱ -ⅈ      ╲╱ -ⅈ    √ⅈ ⎥\n",
       "⎢──── + ────────   - ────── + ── ⎥\n",
       "⎣ 2        2           2      2  ⎦"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sqrt_miX * sqrt_iZ * sqrt_miX"
   ]
  }
 ],
 "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
}
