teichmuller dziala

This commit is contained in:
jgarnek 2022-05-05 09:22:14 +00:00
parent 43c28ea23c
commit 549609e2e0

View File

@ -1,5 +1,134 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 28,
"metadata": {
"collapsed": false
},
"outputs": [
],
"source": [
"N = 2\n",
"p = 3\n",
"RQ = PolynomialRing(QQ, 'X', 2*N)\n",
"X = RQ.gens()[:N]\n",
"Y = RQ.gens()[N:]\n",
"Rpx.<x> = PolynomialRing(GF(p), 1)\n",
"#RQx.<x> = PolynomialRing(QQ, 1)\n",
"\n",
"def witt_pol(lista):\n",
" n = len(lista)\n",
" return sum(p^i*lista[i]^(p^(n-i-1)) for i in range(0, n))\n",
"\n",
"def witt_sum(n):\n",
" if n == 0:\n",
" return X[0] + Y[0]\n",
" return 1/p^n*(witt_pol(X[:n+1]) + witt_pol(Y[:n+1]) - sum(p^k*witt_sum(k)^(p^(n-k)) for k in range(0, n)))\n",
"\n",
"class witt:\n",
" def __init__(self, coordinates):\n",
" self.coordinates = coordinates\n",
" def __repr__(self):\n",
" lista = [Rpx(a) for a in self.coordinates]\n",
" return str(lista)\n",
" def __add__(self, other):\n",
" lista = []\n",
" for i in range(0, N):\n",
" lista+= [witt_sum(i)(self.coordinates + other.coordinates)]\n",
" return witt(lista)\n",
" def __rmul__(self, constant):\n",
" if constant<0:\n",
" m = (-constant)*(p^N-1)\n",
" return m*self\n",
" if constant == 0:\n",
" return witt(N*[0])\n",
" return self + (constant - 1)*self\n",
" def __sub__(self, other):\n",
" return self + (-1)*other\n",
"\n",
"def teichmuller(f):\n",
" Rx.<x> = PolynomialRing(QQ)\n",
" RXp.<Xp> = PolynomialRing(QQ)\n",
" f = Rx(f)\n",
" ff = witt([f, 0])\n",
" coeffs = f.coefficients(sparse=false)\n",
" for i in range(0, len(coeffs)):\n",
" ff -= coeffs[i]*witt([Rx(x^i), 0])\n",
" print(ff)\n",
" f1 = sum(coeffs[i]*RXp(Xp^(3*i)) for i in range(0, len(coeffs))) + p*RXp(ff.coordinates[1](x = Xp))\n",
" RXp.<Xp> = PolynomialRing(Integers(p^2))\n",
" f1 = RXp(f1)\n",
" return f1"
]
},
{
"cell_type": "code",
"execution_count": 29,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[0, -x^7 + x^5]\n"
]
},
{
"data": {
"text/plain": [
"Xp^9 + 6*Xp^7 + 3*Xp^5 + 8*Xp^3"
]
},
"execution_count": 29,
"metadata": {
},
"output_type": "execute_result"
}
],
"source": [
"Rx.<x> = PolynomialRing(QQ)\n",
"f = Rx(x^3 - x)\n",
"teichmuller(f)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
],
"source": [
"f = Rx(x^3 - x)"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/plain": [
"[0, -1, 0, 1]"
]
},
"execution_count": 13,
"metadata": {
},
"output_type": "execute_result"
}
],
"source": [
"f.coefficients(sparse=false)"
]
},
{
"cell_type": "code",
"execution_count": 0,
@ -25,6 +154,18 @@
},
"name": "sage-9.5",
"resource_dir": "/ext/jupyter/kernels/sage-9.5"
},
"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.9"
}
},
"nbformat": 4,