Created
December 11, 2022 19:44
-
-
Save bjodah/581ca5d5c18dd34ff945134f5c6cecd7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"id": "675aaad8", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Collecting graphviz\n", | |
" Downloading graphviz-0.20.1-py3-none-any.whl (47 kB)\n", | |
"\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m47.0/47.0 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", | |
"\u001b[?25hInstalling collected packages: graphviz\n", | |
"Successfully installed graphviz-0.20.1\n", | |
"\u001b[33mWARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv\u001b[0m\u001b[33m\n", | |
"\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m22.3.1\u001b[0m\n", | |
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpython3 -m pip install --upgrade pip\u001b[0m\n" | |
] | |
} | |
], | |
"source": [ | |
"import sympy\n", | |
"try:\n", | |
" from graphviz import Digraph\n", | |
"except ImportError:\n", | |
" !python3 -m pip install graphviz\n", | |
" from graphviz import Digraph" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 41, | |
"id": "b643581e", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"#%%js\n", | |
"#IPython.notebook.kernel.execute(\"print('foo')\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"id": "78af9495", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/latex": [ | |
"$\\displaystyle \\sqrt{y z + 1} + \\frac{\\left(x + 1\\right)^{2} {A}_{24 i + 6 j + k}}{1 + e^{- x^{2}}}$" | |
], | |
"text/plain": [ | |
"sqrt(y*z + 1) + (x + 1)**2*A[24*i + 6*j + k]/(1 + exp(-x**2))" | |
] | |
}, | |
"execution_count": 4, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"x, y, z = sympy.symbols('x y z', real=True)\n", | |
"i, j, k = sympy.symbols('i j k', integer=True, positive=True)\n", | |
"A = sympy.IndexedBase('A')\n", | |
"expr = A[24*i + 6*j + k]*(x+1)**2/(1+sympy.exp(-x**2)) + sympy.sqrt(y*z + 1)\n", | |
"expr" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 5, | |
"id": "dc0fef08", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/plain": [ | |
"'$\\\\displaystyle \\\\sqrt{y z + 1} + \\\\frac{\\\\left(x + 1\\\\right)^{2} {A}_{24 i + 6 j + k}}{1 + e^{- x^{2}}}$'" | |
] | |
}, | |
"execution_count": 5, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"expr._repr_latex_()" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 75, | |
"id": "ced7b38a", | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"def _id(node):\n", | |
" return str(id(node))\n", | |
"\n", | |
"from sympy.printing.latex import LatexPrinter\n", | |
"\n", | |
"class _TexPrinter(LatexPrinter):\n", | |
" def _print_Indexed(self, symb):\n", | |
" return r'\\color{%s}{%s}' % (\"red\", super()._print_Indexed(symb))\n", | |
" def _print_Symbol(self, symb):\n", | |
" return super()._print_Symbol(symb)\n", | |
" #return r'\\texttip{%s}{%s}' % (\n", | |
" # super()._print_Symbol(symb), \n", | |
" # \"foobar\"#str(symb._assumptions).replace('\\n', ', ').replace('{', '').replace('}', '')\n", | |
" #)\n", | |
"\n", | |
"def _escape(node):\n", | |
" return str(node).replace('<', '\\<').replace('>', '\\>')\n", | |
" \n", | |
"class MultiPrint:\n", | |
" with_named_args = {\n", | |
" sympy.Pow: ('base', 'exp')\n", | |
" }\n", | |
" def __init__(self, expr, allow_repeat=lambda atom: False):\n", | |
" self.expr = expr\n", | |
" self.allow_repeat = allow_repeat\n", | |
" self._texp = _TexPrinter()\n", | |
" self.counter = 0\n", | |
" \n", | |
" def _unique_id(self):\n", | |
" self.counter -= 1\n", | |
" return str(self.counter)\n", | |
"\n", | |
" @staticmethod\n", | |
" def _tooltip(e):\n", | |
" if isinstance(e, sympy.Symbol):\n", | |
" return str(e._assumptions).replace('\\n', '\\\\n')\n", | |
" else:\n", | |
" return None\n", | |
" \n", | |
" def _tex(self):\n", | |
" return \"$%(tex)s$\" % dict(\n", | |
" tex=self._texp.doprint(self.expr)\n", | |
" )\n", | |
" \n", | |
" def _dot(self):\n", | |
" g = Digraph(node_attr={'shape': 'box' # plaintext\n", | |
" , 'height': '.1'})\n", | |
" seen = set()\n", | |
" def walk(node):\n", | |
" if node.is_Atom:\n", | |
" if self.allow_repeat(node):\n", | |
" id_ = self._unique_id()\n", | |
" else:\n", | |
" id_ = _id(node)\n", | |
" g.node(id_, _escape(node), tooltip=self._tooltip(node))\n", | |
" return id_\n", | |
" \n", | |
" cls = type(node)\n", | |
" if cls in self.with_named_args:\n", | |
" argnames = self.with_named_args[cls]\n", | |
" argcells = ''\n", | |
" for i, argn in enumerate(argnames):\n", | |
" argcells += f'<TD PORT=\"{i+1:d}\">{argn}</TD>\\n'\n", | |
" label = f\"\"\"<\n", | |
"<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">\n", | |
"<TR>\n", | |
"<TD COLSPAN=\"{len(argnames):d}\" PORT=\"0\">{node.__class__.__name__}</TD>\n", | |
"</TR>\n", | |
"<TR>\n", | |
" {argcells}\n", | |
"</TR>\n", | |
"</TABLE> >\"\"\"\n", | |
" else:\n", | |
" label = cls.__name__\n", | |
" #label = f\"\"\"<\n", | |
" #<TABLE BORDER=\"0\" CELLBORDER=\"1\" CELLSPACING=\"0\" CELLPADDING=\"4\">\n", | |
" #<TR><TD PORT=\"0\">\n", | |
" #{cls.__name__}\n", | |
" #</TD></TR>\n", | |
" #</TABLE>>\"\"\"\n", | |
" \n", | |
" g.node(_id(node), label)\n", | |
" for i, arg in enumerate(node.args):\n", | |
" arg_id = walk(arg)\n", | |
" if cls in self.with_named_args:\n", | |
" src = _id(node) + f':{i+1:d}'\n", | |
" else:\n", | |
" src = _id(node)\n", | |
" from_to = src, arg_id #+ \":0\" # :n\n", | |
" if from_to not in seen:\n", | |
" g.edge(*from_to)\n", | |
" seen.add(from_to)\n", | |
" return _id(node)\n", | |
"\n", | |
" walk(self.expr) \n", | |
" xmldoc = g._repr_image_svg_xml()\n", | |
" _before, rest = xmldoc.split('<svg')\n", | |
" body, _after = rest.split('</svg>'); del rest\n", | |
" return \"<svg style='width:45% !important;'\" + body + \"</svg>\"\n", | |
" \n", | |
" def _repr_html_(self):\n", | |
" js = \"\"\"\n", | |
"<script type=\"text/javascript\">\n", | |
" var uncolor;\n", | |
" function UNCOLOR() {\n", | |
" if (uncolor) {\n", | |
" uncolor();\n", | |
" uncolor = null;\n", | |
" }\n", | |
" }\n", | |
" \n", | |
"function doColor(event) {\n", | |
" var target = (event || window.event).target;\n", | |
" console.log(\"foo\");\n", | |
" while (target && target.isMathJax) {\n", | |
" console.log(target.classList);\n", | |
" if (target.classList.contains('hover42')) {\n", | |
" UNCOLOR();\n", | |
" if (target.style) {\n", | |
" target.style.color = target.style.fill = \"red\";\n", | |
" uncolor = function () {target.style.color = target.style.fill = ''};\n", | |
" } else {\n", | |
" target.setAttribute('mathcolor','red');\n", | |
" uncolor = function () {target.removeAttribute('mathcolor')};\n", | |
" }\n", | |
" return;\n", | |
" }\n", | |
" target = target.parentNode;\n", | |
" }\n", | |
" UNCOLOR();\n", | |
"}\n", | |
"</script>\n", | |
" \"\"\"\n", | |
" styl = \"<style>.hover42 { mathcolor: red !important; }</style>\"\n", | |
" return js + styl + f'''\n", | |
" <div style=\"width: 100%; overflow: hidden;\" onmouseover=\"doColor();\" onmouseout=\"UNCOLOR();\">\n", | |
" <div style=\"float: left; text-align: center; \">{self._tex()}</div>\n", | |
" <div style=\"float: right; text-align: center; \">{self._dot()}</div>\n", | |
" </div>\n", | |
" '''\n", | |
" \n", | |
"m = MultiPrint(expr)\n", | |
"#print(m._repr_html_())" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 76, | |
"id": "3372d0fd", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"\n", | |
"<script type=\"text/javascript\">\n", | |
" var uncolor;\n", | |
" function UNCOLOR() {\n", | |
" if (uncolor) {\n", | |
" uncolor();\n", | |
" uncolor = null;\n", | |
" }\n", | |
" }\n", | |
" \n", | |
"function doColor(event) {\n", | |
" var target = (event || window.event).target;\n", | |
" console.log(\"foo\");\n", | |
" while (target && target.isMathJax) {\n", | |
" console.log(target.classList);\n", | |
" if (target.classList.contains('hover42')) {\n", | |
" UNCOLOR();\n", | |
" if (target.style) {\n", | |
" target.style.color = target.style.fill = \"red\";\n", | |
" uncolor = function () {target.style.color = target.style.fill = ''};\n", | |
" } else {\n", | |
" target.setAttribute('mathcolor','red');\n", | |
" uncolor = function () {target.removeAttribute('mathcolor')};\n", | |
" }\n", | |
" return;\n", | |
" }\n", | |
" target = target.parentNode;\n", | |
" }\n", | |
" UNCOLOR();\n", | |
"}\n", | |
"</script>\n", | |
" <style>.hover42 { mathcolor: red !important; }</style>\n", | |
" <div style=\"width: 100%; overflow: hidden;\" onmouseover=\"doColor();\" onmouseout=\"UNCOLOR();\">\n", | |
" <div style=\"float: left; text-align: center; \">$\\sqrt{y z + 1} + \\frac{\\left(x + 1\\right)^{2} \\color{red}{{A}_{24 i + 6 j + k}}}{1 + e^{- x^{2}}}$</div>\n", | |
" <div style=\"float: right; text-align: center; \"><svg style='width:45% !important;' width=\"584pt\" height=\"549pt\"\n", | |
" viewBox=\"0.00 0.00 583.50 549.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", | |
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 545)\">\n", | |
"<title>%3</title>\n", | |
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-545 579.5,-545 579.5,4 -4,4\"/>\n", | |
"<!-- 140589791671488 -->\n", | |
"<g id=\"node1\" class=\"node\">\n", | |
"<title>140589791671488</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"227,-541 173,-541 173,-518 227,-518 227,-541\"/>\n", | |
"<text text-anchor=\"middle\" x=\"200\" y=\"-525.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288 -->\n", | |
"<g id=\"node2\" class=\"node\">\n", | |
"<title>140590125324288</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"191,-482 95,-482 95,-424 191,-424 191,-482\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"103,-453 103,-478 183,-478 183,-453 103,-453\"/>\n", | |
"<text text-anchor=\"start\" x=\"128\" y=\"-461.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"103,-428 103,-453 147,-453 147,-428 103,-428\"/>\n", | |
"<text text-anchor=\"start\" x=\"108\" y=\"-436.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"147,-428 147,-453 183,-453 183,-428 147,-428\"/>\n", | |
"<text text-anchor=\"start\" x=\"152\" y=\"-436.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589791671488->140590125324288 -->\n", | |
"<g id=\"edge7\" class=\"edge\">\n", | |
"<title>140589791671488->140590125324288</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M191.83,-517.83C186.2,-510.46 178.35,-500.2 170.59,-490.06\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"173.29,-487.83 164.43,-482.01 167.73,-492.08 173.29,-487.83\"/>\n", | |
"</g>\n", | |
"<!-- 140590109116672 -->\n", | |
"<g id=\"node9\" class=\"node\">\n", | |
"<title>140590109116672</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"342,-464.5 288,-464.5 288,-441.5 342,-441.5 342,-464.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"315\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589791671488->140590109116672 -->\n", | |
"<g id=\"edge24\" class=\"edge\">\n", | |
"<title>140589791671488->140590109116672</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M216.48,-517.83C235.69,-505.38 267.66,-484.67 289.95,-470.23\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"292.06,-473.03 298.55,-464.65 288.26,-467.15 292.06,-473.03\"/>\n", | |
"</g>\n", | |
"<!-- 140589445951872 -->\n", | |
"<g id=\"node3\" class=\"node\">\n", | |
"<title>140589445951872</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"120,-370.5 66,-370.5 66,-347.5 120,-347.5 120,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"93\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288->140589445951872 -->\n", | |
"<g id=\"edge5\" class=\"edge\">\n", | |
"<title>140590125324288:1->140589445951872</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M125,-427C125,-409.57 116.08,-391.87 107.65,-379.04\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"110.36,-376.8 101.74,-370.63 104.63,-380.82 110.36,-376.8\"/>\n", | |
"</g>\n", | |
"<!-- 140590125303664 -->\n", | |
"<g id=\"node8\" class=\"node\">\n", | |
"<title>140590125303664</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"192,-370.5 138,-370.5 138,-347.5 192,-347.5 192,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"165\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">1/2</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288->140590125303664 -->\n", | |
"<g id=\"edge6\" class=\"edge\">\n", | |
"<title>140590125324288:2->140590125303664</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M165,-427C165,-411.71 165,-394.45 165,-381.28\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"168.5,-380.91 165,-370.91 161.5,-380.91 168.5,-380.91\"/>\n", | |
"</g>\n", | |
"<!-- -1 -->\n", | |
"<g id=\"node4\" class=\"node\">\n", | |
"<title>-1</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"54,-294 0,-294 0,-271 54,-271 54,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"27\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", | |
"</g>\n", | |
"<!-- 140589445951872->-1 -->\n", | |
"<g id=\"edge1\" class=\"edge\">\n", | |
"<title>140589445951872->-1</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M83.54,-347.33C73.06,-335.49 55.95,-316.17 43.29,-301.89\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"45.69,-299.32 36.44,-294.15 40.45,-303.96 45.69,-299.32\"/>\n", | |
"</g>\n", | |
"<!-- 140589445951680 -->\n", | |
"<g id=\"node5\" class=\"node\">\n", | |
"<title>140589445951680</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"126,-294 72,-294 72,-271 126,-271 126,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"99\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589445951872->140589445951680 -->\n", | |
"<g id=\"edge4\" class=\"edge\">\n", | |
"<title>140589445951872->140589445951680</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M93.86,-347.33C94.76,-336.15 96.2,-318.32 97.32,-304.34\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"100.83,-304.4 98.14,-294.15 93.85,-303.84 100.83,-304.4\"/>\n", | |
"</g>\n", | |
"<!-- 140589782758976 -->\n", | |
"<g id=\"node6\" class=\"node\">\n", | |
"<title>140589782758976</title>\n", | |
"<g id=\"a_node6\"><a xlink:title=\"{ \tcommutative: True, \tcomplex: True, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \tinteger: None, \trational: None, \treal: True, \tzero: None}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"59,-235 5,-235 5,-212 59,-212 59,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"32\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589445951680->140589782758976 -->\n", | |
"<g id=\"edge2\" class=\"edge\">\n", | |
"<title>140589445951680->140589782758976</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M86.4,-270.78C76.85,-262.66 63.54,-251.33 52.47,-241.92\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"54.43,-238.99 44.55,-235.17 49.89,-244.32 54.43,-238.99\"/>\n", | |
"</g>\n", | |
"<!-- 140589782759296 -->\n", | |
"<g id=\"node7\" class=\"node\">\n", | |
"<title>140589782759296</title>\n", | |
"<g id=\"a_node7\"><a xlink:title=\"{ \tcommutative: True, \tcomplex: True, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \treal: True}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"131,-235 77,-235 77,-212 131,-212 131,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"104\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">z</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589445951680->140589782759296 -->\n", | |
"<g id=\"edge3\" class=\"edge\">\n", | |
"<title>140589445951680->140589782759296</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M99.94,-270.78C100.57,-263.61 101.42,-253.95 102.17,-245.31\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"105.68,-245.44 103.06,-235.17 98.7,-244.83 105.68,-245.44\"/>\n", | |
"</g>\n", | |
"<!-- 140589787063744 -->\n", | |
"<g id=\"node10\" class=\"node\">\n", | |
"<title>140589787063744</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"306,-388 210,-388 210,-330 306,-330 306,-388\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"218,-359 218,-384 298,-384 298,-359 218,-359\"/>\n", | |
"<text text-anchor=\"start\" x=\"243\" y=\"-367.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"218,-334 218,-359 262,-359 262,-334 218,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"223\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"262,-334 262,-359 298,-359 298,-334 262,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"267\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589787063744 -->\n", | |
"<g id=\"edge12\" class=\"edge\">\n", | |
"<title>140590109116672->140589787063744</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M308.46,-441.45C301.7,-430.53 290.76,-412.87 280.79,-396.78\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"283.62,-394.71 275.38,-388.05 277.67,-398.4 283.62,-394.71\"/>\n", | |
"</g>\n", | |
"<!-- 140589445881024 -->\n", | |
"<g id=\"node15\" class=\"node\">\n", | |
"<title>140589445881024</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"420,-388 324,-388 324,-330 420,-330 420,-388\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"332,-359 332,-384 412,-384 412,-359 332,-359\"/>\n", | |
"<text text-anchor=\"start\" x=\"357\" y=\"-367.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"332,-334 332,-359 376,-359 376,-334 332,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"337\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"376,-334 376,-359 412,-359 412,-334 376,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"381\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589445881024 -->\n", | |
"<g id=\"edge22\" class=\"edge\">\n", | |
"<title>140590109116672->140589445881024</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M321.54,-441.45C328.3,-430.53 339.24,-412.87 349.21,-396.78\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"352.33,-398.4 354.62,-388.05 346.38,-394.71 352.33,-398.4\"/>\n", | |
"</g>\n", | |
"<!-- 140589445904032 -->\n", | |
"<g id=\"node24\" class=\"node\">\n", | |
"<title>140589445904032</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"575.5,-370.5 438.5,-370.5 438.5,-347.5 575.5,-347.5 575.5,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"507\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">A[24*i + 6*j + k]</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589445904032 -->\n", | |
"<g id=\"edge23\" class=\"edge\">\n", | |
"<title>140590109116672->140589445904032</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M337.02,-441.45C371.08,-425.13 436.64,-393.72 475.63,-375.03\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"477.43,-378.05 484.94,-370.57 474.41,-371.74 477.43,-378.05\"/>\n", | |
"</g>\n", | |
"<!-- 140589782760512 -->\n", | |
"<g id=\"node11\" class=\"node\">\n", | |
"<title>140589782760512</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"236,-294 182,-294 182,-271 236,-271 236,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"209\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140589787063744->140589782760512 -->\n", | |
"<g id=\"edge10\" class=\"edge\">\n", | |
"<title>140589787063744:1->140589782760512</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M240,-333C240,-321.47 233.89,-310.42 227.09,-301.7\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"229.73,-299.39 220.54,-294.11 224.42,-303.97 229.73,-299.39\"/>\n", | |
"</g>\n", | |
"<!-- -3 -->\n", | |
"<g id=\"node14\" class=\"node\">\n", | |
"<title>-3</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"308,-294 254,-294 254,-271 308,-271 308,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"281\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", | |
"</g>\n", | |
"<!-- 140589787063744->-3 -->\n", | |
"<g id=\"edge11\" class=\"edge\">\n", | |
"<title>140589787063744:2->-3</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M280,-333C280,-323.57 280.18,-313.14 280.39,-304.29\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"283.9,-304.21 280.66,-294.12 276.9,-304.02 283.9,-304.21\"/>\n", | |
"</g>\n", | |
"<!-- -2 -->\n", | |
"<g id=\"node12\" class=\"node\">\n", | |
"<title>-2</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"225,-235 171,-235 171,-212 225,-212 225,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"198\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", | |
"</g>\n", | |
"<!-- 140589782760512->-2 -->\n", | |
"<g id=\"edge8\" class=\"edge\">\n", | |
"<title>140589782760512->-2</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M206.93,-270.78C205.53,-263.53 203.64,-253.74 201.96,-245.02\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"205.39,-244.33 200.06,-235.17 198.52,-245.66 205.39,-244.33\"/>\n", | |
"</g>\n", | |
"<!-- 140589782758592 -->\n", | |
"<g id=\"node13\" class=\"node\">\n", | |
"<title>140589782758592</title>\n", | |
"<g id=\"a_node13\"><a xlink:title=\"{ \talgebraic: None, \tcommutative: True, \tcomplex: True, \tcomposite: None, \teven: None, \textended_negative: None, \textended_nonnegative: None, \textended_nonpositive: None, \textended_nonzero: None, \textended_positive: None, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \tinteger: None, \tirrational: None, \todd: None, \tpositive: None, \tprime: None, \trational: None, \treal: True, \tzero: None}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"329,-23 275,-23 275,0 329,0 329,-23\"/>\n", | |
"<text text-anchor=\"middle\" x=\"302\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\">x</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589782760512->140589782758592 -->\n", | |
"<g id=\"edge9\" class=\"edge\">\n", | |
"<title>140589782760512->140589782758592</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M215.86,-270.82C221.48,-261.65 229.25,-247.9 234,-235 261.66,-159.91 241.37,-132.93 272,-59 275.95,-49.46 281.88,-39.73 287.42,-31.65\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"290.41,-33.5 293.39,-23.33 284.72,-29.41 290.41,-33.5\"/>\n", | |
"</g>\n", | |
"<!-- 140589790732672 -->\n", | |
"<g id=\"node16\" class=\"node\">\n", | |
"<title>140589790732672</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"381,-294 327,-294 327,-271 381,-271 381,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"354\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140589445881024->140589790732672 -->\n", | |
"<g id=\"edge20\" class=\"edge\">\n", | |
"<title>140589445881024:1->140589790732672</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M354,-333C354,-323.57 354,-313.14 354,-304.29\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"357.5,-304.12 354,-294.12 350.5,-304.12 357.5,-304.12\"/>\n", | |
"</g>\n", | |
"<!-- -7 -->\n", | |
"<g id=\"node23\" class=\"node\">\n", | |
"<title>-7</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"453,-294 399,-294 399,-271 453,-271 453,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"426\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">-1</text>\n", | |
"</g>\n", | |
"<!-- 140589445881024->-7 -->\n", | |
"<g id=\"edge21\" class=\"edge\">\n", | |
"<title>140589445881024:2->-7</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M394,-333C394,-321.37 400.31,-310.31 407.32,-301.6\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"410.03,-303.83 414.08,-294.04 404.81,-299.16 410.03,-303.83\"/>\n", | |
"</g>\n", | |
"<!-- -4 -->\n", | |
"<g id=\"node17\" class=\"node\">\n", | |
"<title>-4</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"345,-235 291,-235 291,-212 345,-212 345,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"318\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", | |
"</g>\n", | |
"<!-- 140589790732672->-4 -->\n", | |
"<g id=\"edge13\" class=\"edge\">\n", | |
"<title>140589790732672->-4</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M347.23,-270.78C342.45,-263.22 335.92,-252.87 330.24,-243.88\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"333.04,-241.76 324.74,-235.17 327.12,-245.5 333.04,-241.76\"/>\n", | |
"</g>\n", | |
"<!-- 140589445474848 -->\n", | |
"<g id=\"node18\" class=\"node\">\n", | |
"<title>140589445474848</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"417,-235 363,-235 363,-212 417,-212 417,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"390\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589790732672->140589445474848 -->\n", | |
"<g id=\"edge19\" class=\"edge\">\n", | |
"<title>140589790732672->140589445474848</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M360.77,-270.78C365.55,-263.22 372.08,-252.87 377.76,-243.88\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"380.88,-245.5 383.26,-235.17 374.96,-241.76 380.88,-245.5\"/>\n", | |
"</g>\n", | |
"<!-- 140589445945984 -->\n", | |
"<g id=\"node19\" class=\"node\">\n", | |
"<title>140589445945984</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"417,-176 363,-176 363,-153 417,-153 417,-176\"/>\n", | |
"<text text-anchor=\"middle\" x=\"390\" y=\"-160.8\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589445474848->140589445945984 -->\n", | |
"<g id=\"edge18\" class=\"edge\">\n", | |
"<title>140589445474848->140589445945984</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M390,-211.78C390,-204.61 390,-194.95 390,-186.31\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"393.5,-186.17 390,-176.17 386.5,-186.17 393.5,-186.17\"/>\n", | |
"</g>\n", | |
"<!-- -5 -->\n", | |
"<g id=\"node20\" class=\"node\">\n", | |
"<title>-5</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"335,-99.5 281,-99.5 281,-76.5 335,-76.5 335,-99.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"308\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">-1</text>\n", | |
"</g>\n", | |
"<!-- 140589445945984->-5 -->\n", | |
"<g id=\"edge14\" class=\"edge\">\n", | |
"<title>140589445945984->-5</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M378.25,-152.83C364.98,-140.77 343.17,-120.95 327.37,-106.59\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"329.48,-103.79 319.73,-99.65 324.77,-108.97 329.48,-103.79\"/>\n", | |
"</g>\n", | |
"<!-- 140589792090880 -->\n", | |
"<g id=\"node21\" class=\"node\">\n", | |
"<title>140589792090880</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"449,-117 353,-117 353,-59 449,-59 449,-117\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"361,-88 361,-113 441,-113 441,-88 361,-88\"/>\n", | |
"<text text-anchor=\"start\" x=\"386\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"361,-63 361,-88 405,-88 405,-63 361,-63\"/>\n", | |
"<text text-anchor=\"start\" x=\"366\" y=\"-71.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"405,-63 405,-88 441,-88 441,-63 405,-63\"/>\n", | |
"<text text-anchor=\"start\" x=\"410\" y=\"-71.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589445945984->140589792090880 -->\n", | |
"<g id=\"edge17\" class=\"edge\">\n", | |
"<title>140589445945984->140589792090880</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M391.58,-152.83C392.59,-145.97 393.97,-136.61 395.36,-127.17\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"398.87,-127.42 396.86,-117.01 391.94,-126.39 398.87,-127.42\"/>\n", | |
"</g>\n", | |
"<!-- 140589792090880->140589782758592 -->\n", | |
"<g id=\"edge15\" class=\"edge\">\n", | |
"<title>140589792090880:1->140589782758592</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M360,-75C358.48,-75 335.14,-49.38 318.53,-30.95\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"320.77,-28.2 311.48,-23.1 315.56,-32.88 320.77,-28.2\"/>\n", | |
"</g>\n", | |
"<!-- -6 -->\n", | |
"<g id=\"node22\" class=\"node\">\n", | |
"<title>-6</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"450,-23 396,-23 396,0 450,0 450,-23\"/>\n", | |
"<text text-anchor=\"middle\" x=\"423\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", | |
"</g>\n", | |
"<!-- 140589792090880->-6 -->\n", | |
"<g id=\"edge16\" class=\"edge\">\n", | |
"<title>140589792090880:2->-6</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M423,-62C423,-52.57 423,-42.14 423,-33.29\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"426.5,-33.12 423,-23.12 419.5,-33.12 426.5,-33.12\"/>\n", | |
"</g>\n", | |
"</g>\n", | |
"</svg></div>\n", | |
" </div>\n", | |
" " | |
], | |
"text/plain": [ | |
"<__main__.MultiPrint at 0x7fdd87a7dab0>" | |
] | |
}, | |
"execution_count": 76, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"MultiPrint(expr, lambda atom: atom.is_Integer)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 77, | |
"id": "44effa48", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"data": { | |
"text/html": [ | |
"\n", | |
"<script type=\"text/javascript\">\n", | |
" var uncolor;\n", | |
" function UNCOLOR() {\n", | |
" if (uncolor) {\n", | |
" uncolor();\n", | |
" uncolor = null;\n", | |
" }\n", | |
" }\n", | |
" \n", | |
"function doColor(event) {\n", | |
" var target = (event || window.event).target;\n", | |
" console.log(\"foo\");\n", | |
" while (target && target.isMathJax) {\n", | |
" console.log(target.classList);\n", | |
" if (target.classList.contains('hover42')) {\n", | |
" UNCOLOR();\n", | |
" if (target.style) {\n", | |
" target.style.color = target.style.fill = \"red\";\n", | |
" uncolor = function () {target.style.color = target.style.fill = ''};\n", | |
" } else {\n", | |
" target.setAttribute('mathcolor','red');\n", | |
" uncolor = function () {target.removeAttribute('mathcolor')};\n", | |
" }\n", | |
" return;\n", | |
" }\n", | |
" target = target.parentNode;\n", | |
" }\n", | |
" UNCOLOR();\n", | |
"}\n", | |
"</script>\n", | |
" <style>.hover42 { mathcolor: red !important; }</style>\n", | |
" <div style=\"width: 100%; overflow: hidden;\" onmouseover=\"doColor();\" onmouseout=\"UNCOLOR();\">\n", | |
" <div style=\"float: left; text-align: center; \">$\\sqrt{y z + 1} + \\frac{\\left(x + 1\\right)^{2} \\color{red}{{A}_{24 i + 6 j + k}}}{1 + e^{- x^{2}}}$</div>\n", | |
" <div style=\"float: right; text-align: center; \"><svg style='width:45% !important;' width=\"579pt\" height=\"549pt\"\n", | |
" viewBox=\"0.00 0.00 578.50 549.00\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n", | |
"<g id=\"graph0\" class=\"graph\" transform=\"scale(1 1) rotate(0) translate(4 545)\">\n", | |
"<title>%3</title>\n", | |
"<polygon fill=\"white\" stroke=\"transparent\" points=\"-4,4 -4,-545 574.5,-545 574.5,4 -4,4\"/>\n", | |
"<!-- 140589791671488 -->\n", | |
"<g id=\"node1\" class=\"node\">\n", | |
"<title>140589791671488</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"222,-541 168,-541 168,-518 222,-518 222,-541\"/>\n", | |
"<text text-anchor=\"middle\" x=\"195\" y=\"-525.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288 -->\n", | |
"<g id=\"node2\" class=\"node\">\n", | |
"<title>140590125324288</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"186,-482 90,-482 90,-424 186,-424 186,-482\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"98,-453 98,-478 178,-478 178,-453 98,-453\"/>\n", | |
"<text text-anchor=\"start\" x=\"123\" y=\"-461.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"98,-428 98,-453 142,-453 142,-428 98,-428\"/>\n", | |
"<text text-anchor=\"start\" x=\"103\" y=\"-436.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"142,-428 142,-453 178,-453 178,-428 142,-428\"/>\n", | |
"<text text-anchor=\"start\" x=\"147\" y=\"-436.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589791671488->140590125324288 -->\n", | |
"<g id=\"edge7\" class=\"edge\">\n", | |
"<title>140589791671488->140590125324288</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M186.83,-517.83C181.2,-510.46 173.35,-500.2 165.59,-490.06\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"168.29,-487.83 159.43,-482.01 162.73,-492.08 168.29,-487.83\"/>\n", | |
"</g>\n", | |
"<!-- 140590109116672 -->\n", | |
"<g id=\"node9\" class=\"node\">\n", | |
"<title>140590109116672</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"337,-464.5 283,-464.5 283,-441.5 337,-441.5 337,-464.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"310\" y=\"-449.3\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589791671488->140590109116672 -->\n", | |
"<g id=\"edge24\" class=\"edge\">\n", | |
"<title>140589791671488->140590109116672</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M211.48,-517.83C230.69,-505.38 262.66,-484.67 284.95,-470.23\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"287.06,-473.03 293.55,-464.65 283.26,-467.15 287.06,-473.03\"/>\n", | |
"</g>\n", | |
"<!-- 140589445951872 -->\n", | |
"<g id=\"node3\" class=\"node\">\n", | |
"<title>140589445951872</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"115,-370.5 61,-370.5 61,-347.5 115,-347.5 115,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"88\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288->140589445951872 -->\n", | |
"<g id=\"edge5\" class=\"edge\">\n", | |
"<title>140590125324288:1->140589445951872</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M120,-427C120,-409.57 111.08,-391.87 102.65,-379.04\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"105.36,-376.8 96.74,-370.63 99.63,-380.82 105.36,-376.8\"/>\n", | |
"</g>\n", | |
"<!-- 140590125303664 -->\n", | |
"<g id=\"node8\" class=\"node\">\n", | |
"<title>140590125303664</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"187,-370.5 133,-370.5 133,-347.5 187,-347.5 187,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"160\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">1/2</text>\n", | |
"</g>\n", | |
"<!-- 140590125324288->140590125303664 -->\n", | |
"<g id=\"edge6\" class=\"edge\">\n", | |
"<title>140590125324288:2->140590125303664</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M160,-427C160,-411.71 160,-394.45 160,-381.28\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"163.5,-380.91 160,-370.91 156.5,-380.91 163.5,-380.91\"/>\n", | |
"</g>\n", | |
"<!-- 140590124677328 -->\n", | |
"<g id=\"node4\" class=\"node\">\n", | |
"<title>140590124677328</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"208,-235 154,-235 154,-212 208,-212 208,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"181\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">1</text>\n", | |
"</g>\n", | |
"<!-- 140589445951872->140590124677328 -->\n", | |
"<g id=\"edge1\" class=\"edge\">\n", | |
"<title>140589445951872->140590124677328</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M95.61,-347.08C111.43,-324.37 148.01,-271.86 167.77,-243.5\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"170.7,-245.41 173.54,-235.2 164.96,-241.41 170.7,-245.41\"/>\n", | |
"</g>\n", | |
"<!-- 140589445951680 -->\n", | |
"<g id=\"node5\" class=\"node\">\n", | |
"<title>140589445951680</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"115,-294 61,-294 61,-271 115,-271 115,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"88\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589445951872->140589445951680 -->\n", | |
"<g id=\"edge4\" class=\"edge\">\n", | |
"<title>140589445951872->140589445951680</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M88,-347.33C88,-336.15 88,-318.32 88,-304.34\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"91.5,-304.15 88,-294.15 84.5,-304.15 91.5,-304.15\"/>\n", | |
"</g>\n", | |
"<!-- 140589782758976 -->\n", | |
"<g id=\"node6\" class=\"node\">\n", | |
"<title>140589782758976</title>\n", | |
"<g id=\"a_node6\"><a xlink:title=\"{ \tcommutative: True, \tcomplex: True, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \tinteger: None, \trational: None, \treal: True, \tzero: None}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"54,-235 0,-235 0,-212 54,-212 54,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"27\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">y</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589445951680->140589782758976 -->\n", | |
"<g id=\"edge2\" class=\"edge\">\n", | |
"<title>140589445951680->140589782758976</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M76.53,-270.78C67.92,-262.74 55.95,-251.55 45.93,-242.19\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"48.12,-239.44 38.42,-235.17 43.34,-244.56 48.12,-239.44\"/>\n", | |
"</g>\n", | |
"<!-- 140589782759296 -->\n", | |
"<g id=\"node7\" class=\"node\">\n", | |
"<title>140589782759296</title>\n", | |
"<g id=\"a_node7\"><a xlink:title=\"{ \tcommutative: True, \tcomplex: True, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \treal: True}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"126,-235 72,-235 72,-212 126,-212 126,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"99\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">z</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589445951680->140589782759296 -->\n", | |
"<g id=\"edge3\" class=\"edge\">\n", | |
"<title>140589445951680->140589782759296</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M90.07,-270.78C91.47,-263.53 93.36,-253.74 95.04,-245.02\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"98.48,-245.66 96.94,-235.17 91.61,-244.33 98.48,-245.66\"/>\n", | |
"</g>\n", | |
"<!-- 140589787063744 -->\n", | |
"<g id=\"node10\" class=\"node\">\n", | |
"<title>140589787063744</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"301,-388 205,-388 205,-330 301,-330 301,-388\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"213,-359 213,-384 293,-384 293,-359 213,-359\"/>\n", | |
"<text text-anchor=\"start\" x=\"238\" y=\"-367.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"213,-334 213,-359 257,-359 257,-334 213,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"218\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"257,-334 257,-359 293,-359 293,-334 257,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"262\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589787063744 -->\n", | |
"<g id=\"edge12\" class=\"edge\">\n", | |
"<title>140590109116672->140589787063744</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M303.46,-441.45C296.7,-430.53 285.76,-412.87 275.79,-396.78\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"278.62,-394.71 270.38,-388.05 272.67,-398.4 278.62,-394.71\"/>\n", | |
"</g>\n", | |
"<!-- 140589445881024 -->\n", | |
"<g id=\"node14\" class=\"node\">\n", | |
"<title>140589445881024</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"415,-388 319,-388 319,-330 415,-330 415,-388\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"327,-359 327,-384 407,-384 407,-359 327,-359\"/>\n", | |
"<text text-anchor=\"start\" x=\"352\" y=\"-367.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"327,-334 327,-359 371,-359 371,-334 327,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"332\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"371,-334 371,-359 407,-359 407,-334 371,-334\"/>\n", | |
"<text text-anchor=\"start\" x=\"376\" y=\"-342.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589445881024 -->\n", | |
"<g id=\"edge22\" class=\"edge\">\n", | |
"<title>140590109116672->140589445881024</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M316.54,-441.45C323.3,-430.53 334.24,-412.87 344.21,-396.78\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"347.33,-398.4 349.62,-388.05 341.38,-394.71 347.33,-398.4\"/>\n", | |
"</g>\n", | |
"<!-- 140589445904032 -->\n", | |
"<g id=\"node20\" class=\"node\">\n", | |
"<title>140589445904032</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"570.5,-370.5 433.5,-370.5 433.5,-347.5 570.5,-347.5 570.5,-370.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"502\" y=\"-355.3\" font-family=\"Times,serif\" font-size=\"14.00\">A[24*i + 6*j + k]</text>\n", | |
"</g>\n", | |
"<!-- 140590109116672->140589445904032 -->\n", | |
"<g id=\"edge23\" class=\"edge\">\n", | |
"<title>140590109116672->140589445904032</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M332.02,-441.45C366.08,-425.13 431.64,-393.72 470.63,-375.03\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"472.43,-378.05 479.94,-370.57 469.41,-371.74 472.43,-378.05\"/>\n", | |
"</g>\n", | |
"<!-- 140589782760512 -->\n", | |
"<g id=\"node11\" class=\"node\">\n", | |
"<title>140589782760512</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"246,-294 192,-294 192,-271 246,-271 246,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"219\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140589787063744->140589782760512 -->\n", | |
"<g id=\"edge10\" class=\"edge\">\n", | |
"<title>140589787063744:1->140589782760512</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M235,-333C235,-323 232.01,-312.4 228.61,-303.58\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"231.75,-302.01 224.6,-294.19 225.31,-304.76 231.75,-302.01\"/>\n", | |
"</g>\n", | |
"<!-- 140589792773760 -->\n", | |
"<g id=\"node13\" class=\"node\">\n", | |
"<title>140589792773760</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"383,-23 329,-23 329,0 383,0 383,-23\"/>\n", | |
"<text text-anchor=\"middle\" x=\"356\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\">2</text>\n", | |
"</g>\n", | |
"<!-- 140589787063744->140589792773760 -->\n", | |
"<g id=\"edge11\" class=\"edge\">\n", | |
"<title>140589787063744:2->140589792773760</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M275,-333C275,-284.78 274,-272.72 274,-224.5 274,-224.5 274,-224.5 274,-163.5 274,-116.29 268.03,-99.06 293,-59 300.85,-46.41 313.46,-36.1 325.35,-28.41\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"327.46,-31.23 334.2,-23.06 323.84,-25.24 327.46,-31.23\"/>\n", | |
"</g>\n", | |
"<!-- 140589782760512->140590124677328 -->\n", | |
"<g id=\"edge8\" class=\"edge\">\n", | |
"<title>140589782760512->140590124677328</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M211.85,-270.78C206.76,-263.14 199.77,-252.65 193.73,-243.6\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"196.57,-241.55 188.12,-235.17 190.75,-245.44 196.57,-241.55\"/>\n", | |
"</g>\n", | |
"<!-- 140589782758592 -->\n", | |
"<g id=\"node12\" class=\"node\">\n", | |
"<title>140589782758592</title>\n", | |
"<g id=\"a_node12\"><a xlink:title=\"{ \talgebraic: None, \tcommutative: True, \tcomplex: True, \tcomposite: None, \teven: None, \textended_negative: None, \textended_nonnegative: None, \textended_nonpositive: None, \textended_nonzero: None, \textended_positive: None, \textended_real: True, \tfinite: True, \thermitian: True, \timaginary: False, \tinfinite: False, \tinteger: None, \tirrational: None, \todd: None, \tpositive: None, \tprime: None, \trational: None, \treal: True, \tzero: None}\">\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"295,-23 241,-23 241,0 295,0 295,-23\"/>\n", | |
"<text text-anchor=\"middle\" x=\"268\" y=\"-7.8\" font-family=\"Times,serif\" font-size=\"14.00\">x</text>\n", | |
"</a>\n", | |
"</g>\n", | |
"</g>\n", | |
"<!-- 140589782760512->140589782758592 -->\n", | |
"<g id=\"edge9\" class=\"edge\">\n", | |
"<title>140589782760512->140589782758592</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M220.92,-270.95C228.22,-230.87 254.34,-87.52 264.19,-33.39\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"267.69,-33.73 266.04,-23.26 260.8,-32.48 267.69,-33.73\"/>\n", | |
"</g>\n", | |
"<!-- 140589790732672 -->\n", | |
"<g id=\"node15\" class=\"node\">\n", | |
"<title>140589790732672</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"376,-294 322,-294 322,-271 376,-271 376,-294\"/>\n", | |
"<text text-anchor=\"middle\" x=\"349\" y=\"-278.8\" font-family=\"Times,serif\" font-size=\"14.00\">Add</text>\n", | |
"</g>\n", | |
"<!-- 140589445881024->140589790732672 -->\n", | |
"<g id=\"edge20\" class=\"edge\">\n", | |
"<title>140589445881024:1->140589790732672</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M349,-333C349,-323.57 349,-313.14 349,-304.29\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"352.5,-304.12 349,-294.12 345.5,-304.12 352.5,-304.12\"/>\n", | |
"</g>\n", | |
"<!-- 140590125235584 -->\n", | |
"<g id=\"node18\" class=\"node\">\n", | |
"<title>140590125235584</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"470,-99.5 416,-99.5 416,-76.5 470,-76.5 470,-99.5\"/>\n", | |
"<text text-anchor=\"middle\" x=\"443\" y=\"-84.3\" font-family=\"Times,serif\" font-size=\"14.00\">-1</text>\n", | |
"</g>\n", | |
"<!-- 140589445881024->140590125235584 -->\n", | |
"<g id=\"edge21\" class=\"edge\">\n", | |
"<title>140589445881024:2->140590125235584</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M389,-333C389,-247.99 420.64,-150.17 435.48,-108.95\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"438.78,-110.11 438.94,-99.52 432.21,-107.7 438.78,-110.11\"/>\n", | |
"</g>\n", | |
"<!-- 140589790732672->140590124677328 -->\n", | |
"<g id=\"edge13\" class=\"edge\">\n", | |
"<title>140589790732672->140590124677328</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M321.63,-272.22C293.36,-262.62 249.06,-247.59 217.75,-236.97\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"218.67,-233.59 208.08,-233.69 216.42,-240.21 218.67,-233.59\"/>\n", | |
"</g>\n", | |
"<!-- 140589445474848 -->\n", | |
"<g id=\"node16\" class=\"node\">\n", | |
"<title>140589445474848</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"377,-235 323,-235 323,-212 377,-212 377,-235\"/>\n", | |
"<text text-anchor=\"middle\" x=\"350\" y=\"-219.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589790732672->140589445474848 -->\n", | |
"<g id=\"edge19\" class=\"edge\">\n", | |
"<title>140589790732672->140589445474848</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M349.19,-270.78C349.31,-263.61 349.48,-253.95 349.63,-245.31\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"353.14,-245.23 349.81,-235.17 346.14,-245.11 353.14,-245.23\"/>\n", | |
"</g>\n", | |
"<!-- 140589445945984 -->\n", | |
"<g id=\"node17\" class=\"node\">\n", | |
"<title>140589445945984</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"377,-176 323,-176 323,-153 377,-153 377,-176\"/>\n", | |
"<text text-anchor=\"middle\" x=\"350\" y=\"-160.8\" font-family=\"Times,serif\" font-size=\"14.00\">Mul</text>\n", | |
"</g>\n", | |
"<!-- 140589445474848->140589445945984 -->\n", | |
"<g id=\"edge18\" class=\"edge\">\n", | |
"<title>140589445474848->140589445945984</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M350,-211.78C350,-204.61 350,-194.95 350,-186.31\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"353.5,-186.17 350,-176.17 346.5,-186.17 353.5,-186.17\"/>\n", | |
"</g>\n", | |
"<!-- 140589445945984->140590125235584 -->\n", | |
"<g id=\"edge14\" class=\"edge\">\n", | |
"<title>140589445945984->140590125235584</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M363.32,-152.83C378.52,-140.66 403.57,-120.59 421.53,-106.2\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"424.08,-108.64 429.7,-99.65 419.71,-103.17 424.08,-108.64\"/>\n", | |
"</g>\n", | |
"<!-- 140589792090880 -->\n", | |
"<g id=\"node19\" class=\"node\">\n", | |
"<title>140589792090880</title>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"398,-117 302,-117 302,-59 398,-59 398,-117\"/>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"310,-88 310,-113 390,-113 390,-88 310,-88\"/>\n", | |
"<text text-anchor=\"start\" x=\"335\" y=\"-96.8\" font-family=\"Times,serif\" font-size=\"14.00\">Pow</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"310,-63 310,-88 354,-88 354,-63 310,-63\"/>\n", | |
"<text text-anchor=\"start\" x=\"315\" y=\"-71.8\" font-family=\"Times,serif\" font-size=\"14.00\">base</text>\n", | |
"<polygon fill=\"none\" stroke=\"black\" points=\"354,-63 354,-88 390,-88 390,-63 354,-63\"/>\n", | |
"<text text-anchor=\"start\" x=\"359\" y=\"-71.8\" font-family=\"Times,serif\" font-size=\"14.00\">exp</text>\n", | |
"</g>\n", | |
"<!-- 140589445945984->140589792090880 -->\n", | |
"<g id=\"edge17\" class=\"edge\">\n", | |
"<title>140589445945984->140589792090880</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M350,-152.83C350,-145.97 350,-136.61 350,-127.17\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"353.5,-127.01 350,-117.01 346.5,-127.01 353.5,-127.01\"/>\n", | |
"</g>\n", | |
"<!-- 140589792090880->140589782758592 -->\n", | |
"<g id=\"edge15\" class=\"edge\">\n", | |
"<title>140589792090880:1->140589782758592</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M309,-75C288.5,-75 277.69,-51.19 272.41,-32.97\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"275.76,-31.94 269.92,-23.1 268.98,-33.66 275.76,-31.94\"/>\n", | |
"</g>\n", | |
"<!-- 140589792090880->140589792773760 -->\n", | |
"<g id=\"edge16\" class=\"edge\">\n", | |
"<title>140589792090880:2->140589792773760</title>\n", | |
"<path fill=\"none\" stroke=\"black\" d=\"M372,-62C372,-52 369.01,-41.4 365.61,-32.58\"/>\n", | |
"<polygon fill=\"black\" stroke=\"black\" points=\"368.75,-31.01 361.6,-23.19 362.31,-33.76 368.75,-31.01\"/>\n", | |
"</g>\n", | |
"</g>\n", | |
"</svg></div>\n", | |
" </div>\n", | |
" " | |
], | |
"text/plain": [ | |
"<__main__.MultiPrint at 0x7fdd87ded810>" | |
] | |
}, | |
"execution_count": 77, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"MultiPrint(expr, lambda atom: False)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "fd910c06", | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3 (ipykernel)", | |
"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.10.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment