Skip to content

Commit

Permalink
add tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
sagebei committed Jul 12, 2023
1 parent 1327265 commit 1a7b231
Showing 1 changed file with 131 additions and 0 deletions.
131 changes: 131 additions & 0 deletions tutorials/Test forbidden permutation on k=5.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "a99e6d0c",
"metadata": {},
"outputs": [],
"source": [
"from cdl import *\n",
"# The test examples are from: https://arxiv.org/pdf/2109.13485.pdf"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "91a57697",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"119\n",
"694\n",
"4578\n",
"33184\n",
"258757\n",
"2136978\n"
]
}
],
"source": [
"# https://oeis.org/A256195 -> 1, 1, 2, 6, 24, 119, 694, 4578, 33184, 258757, 2136978\n",
"for n in range(5, 11):\n",
" fp = ForbiddenPermutation(n, 5)\n",
" tls = fp.init_tls()\n",
" for tl in tls:\n",
" tls = fp.assign_laws(tls, tl.tuple, [[2, 5, 3, 1, 4]])\n",
" print(fp.size(tls))"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "a38a05a6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"119\n",
"694\n",
"4581\n",
"33287\n",
"260967\n",
"2175379\n"
]
}
],
"source": [
"# https://oeis.org/A256206 -> 1, 1, 2, 6, 24, 119, 694, 4581, 33287, 260967, 2175379\n",
"for n in range(5, 11):\n",
" fp = ForbiddenPermutation(n, 5)\n",
" tls = fp.init_tls()\n",
" for tl in tls:\n",
" tls = fp.assign_laws(tls, tl.tuple, [[4, 2, 3, 1, 5]])\n",
" print(fp.size(tls))"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "4749e575",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"119\n",
"694\n",
"4580\n",
"33254\n",
"260285\n",
"2163930\n"
]
}
],
"source": [
"# https://oeis.org/A256201 -> 1, 1, 2, 6, 24, 119, 694, 4580, 33254, 260285, 2163930\n",
"for n in range(5, 11):\n",
" fp = ForbiddenPermutation(n, 5)\n",
" tls = fp.init_tls()\n",
" for tl in tls:\n",
" tls = fp.assign_laws(tls, tl.tuple, [[3, 5, 2, 4, 1]])\n",
" print(fp.size(tls))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e033eb68",
"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.9.5"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 1a7b231

Please sign in to comment.