{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "S = GF(8)\n", "T = S.multiplication_table()" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "* a b c d e f g h\n", " +----------------\n", "a| a a a a a a a a\n", "b| a b c d e f g h\n", "c| a c e g d b h f\n", "d| a d g f h e b c\n", "e| a e d h g c f b\n", "f| a f b e c h d g\n", "g| a g h b f d c e\n", "h| a h f c b g e d\n" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{\\setlength{\\arraycolsep}{2ex}\n", "\\begin{array}{r|*{8}{r}}\n", "\\multicolumn{1}{c|}{\\ast}&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}}" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "latex(T)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\begin{array}{r|*{8}{r}}\n", "\\hfil\\ast\\hfil&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}" ], "text/latex": [ "\\[ {\\setlength{\\arraycolsep}{2ex}\n", "\\begin{array}{r|*{8}{r}}\n", "\\multicolumn{1}{c|}{\\ast}&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}} \\]" ], "text/plain": [ "* a b c d e f g h\n", " +----------------\n", "a| a a a a a a a a\n", "b| a b c d e f g h\n", "c| a c e g d b h f\n", "d| a d g f h e b c\n", "e| a e d h g c f b\n", "f| a f b e c h d g\n", "g| a g h b f d c e\n", "h| a h f c b g e d\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "show(T)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\begin{array}{r|*{8}{r}}\n", "\\hfil\\ast\\hfil&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}" ], "text/latex": [ "\\[ {\\setlength{\\arraycolsep}{2ex}\n", "\\begin{array}{r|*{8}{r}}\n", "\\multicolumn{1}{c|}{\\ast}&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}} \\]" ], "text/plain": [ "* a b c d e f g h\n", " +----------------\n", "a| a a a a a a a a\n", "b| a b c d e f g h\n", "c| a c e g d b h f\n", "d| a d g f h e b c\n", "e| a e d h g c f b\n", "f| a f b e c h d g\n", "g| a g h b f d c e\n", "h| a h f c b g e d\n" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "pretty_print(T)" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "f = sqrt(x)/x+2" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1/sqrt(x) + 2" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "%display latex" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\[\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{1}{\\sqrt{x}} + 2\\]" ], "text/latex": [ "$$\\newcommand{\\Bold}[1]{\\mathbf{#1}}\\frac{1}{\\sqrt{x}} + 2$$" ], "text/plain": [ "1/sqrt(x) + 2" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "f" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "\\begin{array}{r|*{8}{r}}\n", "\\hfil\\ast\\hfil&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}" ], "text/latex": [ "\\[ {\\setlength{\\arraycolsep}{2ex}\n", "\\begin{array}{r|*{8}{r}}\n", "\\multicolumn{1}{c|}{\\ast}&a&b&c&d&e&f&g&h\\\\\\hline\n", "{}a&a&a&a&a&a&a&a&a\\\\\n", "{}b&a&b&c&d&e&f&g&h\\\\\n", "{}c&a&c&e&g&d&b&h&f\\\\\n", "{}d&a&d&g&f&h&e&b&c\\\\\n", "{}e&a&e&d&h&g&c&f&b\\\\\n", "{}f&a&f&b&e&c&h&d&g\\\\\n", "{}g&a&g&h&b&f&d&c&e\\\\\n", "{}h&a&h&f&c&b&g&e&d\\\\\n", "\\end{array}} \\]" ], "text/plain": [ "* a b c d e f g h\n", " +----------------\n", "a| a a a a a a a a\n", "b| a b c d e f g h\n", "c| a c e g d b h f\n", "d| a d g f h e b c\n", "e| a e d h g c f b\n", "f| a f b e c h d g\n", "g| a g h b f d c e\n", "h| a h f c b g e d\n" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "T" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "SageMath 9.4", "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.9.6" } }, "nbformat": 4, "nbformat_minor": 4 }