{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is how I compute the NC Grobner basis using the free algebra.\n",
"It is limited because it cannot compute beyond n=4 or 5, but the\n",
"advantage is that you stay within Sage and you don't need the clunky GAP connection."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# this method seems to choke at n=6.\n",
"def free_algebra_gens(n):\n",
" \"\"\"\n",
" a pair consisting of the variables of the free algebra\n",
" \"\"\"\n",
" FA = FreeAlgebra(QQ,implementation='letterplace', names=\\\n",
" flatten([['x'+str(i),'y'+str(i)] for i in range(n)])\\\n",
" , order='lex')\n",
" x = [FA('x'+str(i)) for i in range(n)]\n",
" y = [FA('y'+str(i)) for i in range(n)]\n",
" return (x,y)\n",
"\n",
"def module_ideal(n):\n",
" \"\"\"\n",
" EXAMPLES:\n",
" sage: module_ideal(1)\n",
" Twosided Ideal (x0*y0 - y0*x0, y0*y0, x0, y0) of Free Associative Unital\n",
" Algebra on 2 generators (x0, y0) over Rational Field\n",
" sage: module_ideal(1).groebner_basis(Infinity)\n",
" Twosided Ideal (y0, x0) of Free Associative Unital Algebra on 2 generators (x0, y0) over Rational Field\n",
"\n",
" # the infinity indicates that it needs to build the full GB\n",
" # replace Infinity by a level number to partially compute it\n",
" \"\"\"\n",
" (x,y) = free_algebra_gens(n)\n",
" FA = x[0].parent()\n",
" A = [x[i]*x[j]-x[j]*x[i] for i in range(n) for j in range(n) if i