From 412adc9abd1e0d2e56195fe6e37afb586d7629d1 Mon Sep 17 00:00:00 2001 From: Maria Marchwicka Date: Mon, 9 Nov 2020 09:34:33 +0100 Subject: [PATCH] add jupyter notebook --- main.ipynb | 361 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 361 insertions(+) create mode 100644 main.ipynb diff --git a/main.ipynb b/main.ipynb new file mode 100644 index 0000000..1abbbf5 --- /dev/null +++ b/main.ipynb @@ -0,0 +1,361 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "%matplotlib inline\n", + "%load_ext pycodestyle_magic\n", + "\n", + "\n", + "# display full output, not only last result, except ended with semicolon\n", + "from IPython.core.interactiveshell import InteractiveShell\n", + "InteractiveShell.ast_node_interactivity = 'all';\n", + "from IPython.display import Image, SVG\n", + "\n", + "\n", + "# magic functions that do not work in current ipython --version\n", + "# \n", + "# auto check each cell, E703 - \"statement ends with a semicolon\"\n", + "# %flake8_on --ignore E703\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "import importlib\n", + "\n", + "def import_sage(module_name):\n", + " \n", + " importlib.invalidate_caches() \n", + " sage_name = module_name + \".sage\"\n", + " python_name = module_name + \".sage.py\"\n", + "\n", + " if os.path.isfile(sage_name):\n", + " os.system('sage --preparse {}'.format(sage_name));\n", + " os.system('mv {} {}.py'.format(python_name, module_name))\n", + " if module_name in sys.modules:\n", + " return importlib.reload(sys.modules[module_name]) \n", + " return importlib.import_module(module_name, package=None)\n", + "\n", + "cs = import_sage('cable_signature')\n", + "# sig = import_sage('signature')" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Cables with 8 direct summands " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "formula_1 = \"[[k[0], k[5], k[3]], \" + \\\n", + " \"[-k[1], -k[3]], \" + \\\n", + " \"[k[2], k[3]], \" + \\\n", + " \"[-k[0], -k[2], -k[3]]]\"\n", + "formula_2 = \"[[k[4], k[1], k[7]], \" + \\\n", + " \"[-k[5], -k[7]], \" + \\\n", + " \"[k[6], k[7]], \" + \\\n", + " \"[-k[4], -k[6], -k[7]]]\"\n", + "\n", + "\n", + "\n", + "cable_template_1 = cs.CableTemplate(knot_formula=formula_1)\n", + "cable_template_2 = cs.CableTemplate(knot_formula=formula_2)\n", + "cable_template = cable_template_1 + cable_template_2" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Relatively small cables " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "q_vector = (5, 13, 19, 41,\\\n", + " 7, 17, 23, 43)\n", + "cable_template.fill_q_vector(q_vector=q_vector)\n", + "cable = cable_template.cable\n", + "print(cable.knot_description)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "# cable.is_signature_big_for_all_metabolizers()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "q_vector_small = (3, 7, 13, 19,\\\n", + " 5, 11, 17, 23)\n", + "cable_template.fill_q_vector(q_vector=q_vector)\n", + "cable = cable_template.cable\n", + "print(cable.knot_description)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# cable.is_signature_big_for_all_metabolizers()" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Slice candidate" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "cable_template.fill_q_vector()\n", + "# print(cable_template.q_vector)\n", + "# print(cable_template.knot_formula)\n", + "\n", + "slice_canidate = cable_template.cable\n", + "print(slice_canidate.knot_description)\n", + "sf = slice_canidate(4,4,4,4,0,0,0,0)\n", + "sf = slice_canidate(4,1,1,4,0,0,0,0)\n", + "\n", + "\n", + "# cable.is_signature_big_for_all_metabolizers()\n" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Other cables" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "# knot_formula = \"[[k[0], k[1], k[4]], [-k[1], -k[3]],\\\n", + "# [k[2], k[3]], [-k[0], -k[2], -k[4]]]\"\n", + "\n", + "# knot_formula = \"[[k[3]], [-k[3]],\\\n", + "# [k[3]], [-k[3]] ]\"\n", + "\n", + "# knot_formula = \"[[k[3], k[2], k[0]], [-k[2], -k[0]],\\\n", + "# [k[1], k[0]], [-k[3], -k[1], -k[0]]]\"\n", + "\n", + "# knot_formula = \"[[k[0], k[1], k[2]], [k[3], k[4]],\\\n", + "# [-k[0], -k[3], -k[4]], [-k[1], -k[2]]]\"\n", + "\n", + "# knot_formula = \"[[k[0], k[1], k[2]], [k[3]],\\\n", + "# [-k[0], -k[1], -k[3]], [-k[2]]]\"" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": true + }, + "outputs": [], + "source": [ + "knot_formula = \"[[k[0], k[1], k[3]],\" + \\\n", + " \" [-k[1], -k[3]],\" + \\\n", + " \" [k[2], k[3]],\" + \\\n", + " \" [-k[0], -k[2], -k[3]]]\"\n", + "# q_vector = (3, 5, 7, 13)\n", + "q_vector = (3, 5, 7, 11)\n", + "\n", + "template = cs.CableTemplate(knot_formula, q_vector=q_vector)\n", + "cable = template.cable\n", + "cable.plot_all_summands()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "cable.plot_sum_for_theta_vector([0,4,0,4], save_to_dir=True)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "formula_1 = \"[[k[0], k[5], k[3]], \" + \\\n", + " \"[-k[1], -k[3]], \" + \\\n", + " \"[k[2], k[3]], \" + \\\n", + " \"[-k[0], -k[2], -k[3]]]\"\n", + "formula_2 = \"[[k[4], k[1], k[7]], \" + \\\n", + " \"[-k[5], -k[7]], \" + \\\n", + " \"[k[6], k[7]], \" + \\\n", + " \"[-k[4], -k[6], -k[7]]]\"\n", + "\n", + "\n", + "\n", + "cable_template_1 = cs.CableTemplate(knot_formula=formula_1)\n", + "cable_template_2 = cs.CableTemplate(knot_formula=formula_2)\n", + "cable_template = cable_template_1 + cable_template_2\n", + "\n", + "cable_template.fill_q_vector()\n", + "# print(cable_template.q_vector)\n", + "# print(cable_template.knot_formula)\n", + "\n", + "slice_canidate = cable_template.cable\n", + "print(slice_canidate.knot_description)\n", + "sf = slice_canidate(4,4,4,4,0,0,0,0)\n", + "sf = slice_canidate(4,1,1,4,0,0,0,0)\n", + "\n", + "\n", + "slice_canidate.q_order\n", + "# slice_canidate.is_signature_big_for_all_metabolizers()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "formula_1 = \"[[k[0], k[5], k[3]], \" + \\\n", + " \"[-k[5], -k[3]], \" + \\\n", + " \"[k[2], k[3]], \" + \\\n", + " \"[-k[4], -k[2], -k[3]]]\"\n", + "formula_2 = \"[[k[4], k[1], k[7]], \" + \\\n", + " \"[-k[1], -k[7]], \" + \\\n", + " \"[k[6], k[7]], \" + \\\n", + " \"[-k[0], -k[6], -k[7]]]\"\n", + "\n", + "\n", + "\n", + "\n", + "cable_template_1 = cs.CableTemplate(knot_formula=formula_1)\n", + "cable_template_2 = cs.CableTemplate(knot_formula=formula_2)\n", + "cable_template = cable_template_1 + cable_template_2\n", + "cable_template.fill_q_vector()\n", + "\n", + "slice_canidate = cable_template.cable\n", + "print(slice_canidate.knot_description)\n", + "\n", + "slice_canidate.q_order\n", + "slice_canidate.is_signature_big_for_all_metabolizers()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "\n", + "\n", + "\n", + "\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "scrolled": false + }, + "outputs": [], + "source": [ + "formula_1 = \"[[k[0], k[5], k[3]], \" + \\\n", + " \"[-k[5], -k[3]], \" + \\\n", + " \"[k[2], k[3]], \" + \\\n", + " \"[-k[4], -k[6], -k[3]]]\"\n", + "formula_2 = \"[[k[4], k[1], k[7]], \" + \\\n", + " \"[-k[1], -k[7]], \" + \\\n", + " \"[k[6], k[7]], \" + \\\n", + " \"[-k[0], -k[2], -k[7]]]\"\n", + "\n", + "\n", + "\n", + "\n", + "cable_template_1 = cs.CableTemplate(knot_formula=formula_1)\n", + "cable_template_2 = cs.CableTemplate(knot_formula=formula_2)\n", + "cable_template = cable_template_1 + cable_template_2\n", + "\n", + "cable_template.fill_q_vector()\n", + "# print(cable_template.q_vector)\n", + "# print(cable_template.knot_formula)\n", + "\n", + "slice_canidate = cable_template.cable\n", + "print(slice_canidate.knot_description)\n", + "sf = slice_canidate(4,4,4,4,0,0,0,0)\n", + "sf = slice_canidate(4,1,1,4,0,0,0,0)\n", + "slice_canidate.q_order\n", + "# slice_canidate.is_signature_big_for_all_metabolizers()" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "SageMath 9.0", + "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.7.3" + } + }, + "nbformat": 4, + "nbformat_minor": 4 +}