Skip to content

Instantly share code, notes, and snippets.

@dimpase
Created March 20, 2018 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dimpase/9f1c68cbc1d64d447f62efdca9b3ce7b to your computer and use it in GitHub Desktop.
Save dimpase/9f1c68cbc1d64d447f62efdca9b3ce7b to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"def Kra(n,q,l,i): # K^{n,q}_l(i)\n",
" return sum([((-1)**j)*((q-1)**(l-j))*binomial(i,j)*binomial(n-i,l-j) \n",
" for j in range(l+1)])\n",
"\n",
"def Pmat(n,q):\n",
" def f(i,j): return Kra(n,q,i,j)\n",
" return matrix(n+1,n+1,f).T\n"
]
},
{
"cell_type": "code",
"execution_count": 39,
"metadata": {},
"outputs": [],
"source": [
"ep=[]\n",
"for d in [1..18]:\n",
" n=2*d\n",
" P=Pmat(n,2)\n",
" 2^n*P^-1==P; P\n",
" v=vector(([0]*d)+([1]*(d+1)))\n",
" eigdata=zip(P*v,P[0])\n",
" eplus=sum(map(lambda (_,m): m, filter(lambda (t,_): t>0, eigdata)))\n",
" eminus=sum(map(lambda (_,m): m, filter(lambda (t,_): t<0, eigdata)))\n",
" assert(eplus+eminus==2^n)\n",
" ep.append(eplus)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[1,\n",
" 6,\n",
" 36,\n",
" 136,\n",
" 496,\n",
" 2016,\n",
" 8256,\n",
" 32896,\n",
" 130816,\n",
" 523776,\n",
" 2098176,\n",
" 8390656,\n",
" 33550336,\n",
" 134209536,\n",
" 536887296,\n",
" 2147516416,\n",
" 8589869056,\n",
" 34359607296]"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"ep"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "SageMath 8.2.beta8",
"language": "",
"name": "sagemath"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment