diff --git a/superelliptic.ipynb b/superelliptic.ipynb index 0d1accf..c159fbf 100644 --- a/superelliptic.ipynb +++ b/superelliptic.ipynb @@ -2,22 +2,9 @@ "cells": [ { "cell_type": "code", - "execution_count": 87, + "execution_count": 48, "metadata": {}, - "outputs": [ - { - "ename": "NameError", - "evalue": "name 'holo' is not defined", - "output_type": "error", - "traceback": [ - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", - "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", - "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0;32mclass\u001b[0m \u001b[0msuperelliptic\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 2\u001b[0m \u001b[0;32mdef\u001b[0m \u001b[0m__init__\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mp\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0mR\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mPolynomialRing\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mGF\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mp\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mnames\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'x'\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m;\u001b[0m \u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mR\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_first_ngens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpolynomial\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mR\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexponent\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;32m\u001b[0m in \u001b[0;36msuperelliptic\u001b[0;34m()\u001b[0m\n\u001b[1;32m 53\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mj\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mm\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 54\u001b[0m \u001b[0mholo\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mbaza_holo\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mf\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mp\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 55\u001b[0;31m \u001b[0;32mfor\u001b[0m \u001b[0mk\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mholo\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 56\u001b[0m \u001b[0mbaza\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mholo\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 57\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", - "\u001b[0;31mNameError\u001b[0m: name 'holo' is not defined" - ] - } - ], + "outputs": [], "source": [ "class superelliptic:\n", " def __init__(self, f, m, p):\n", @@ -44,6 +31,8 @@ " p = self.characteristic\n", " r = f.degree()\n", " delta = GCD(r, m)\n", + " R2. = PolynomialRing(GF(p), 2)\n", + " RR = FractionField(R2)\n", " \n", " basis = {}\n", " if j == 'all':\n", @@ -51,14 +40,14 @@ " for j in range(1, m):\n", " for i in range(1, r):\n", " if (r*j - m*i >= delta):\n", - " basis[k] = superelliptic_form(C, x^(i-1)/y^j)\n", + " basis[k] = superelliptic_form(self, RR(x^(i-1)/y^j))\n", " k = k+1\n", " return basis\n", " else:\n", " k = 0\n", " for i in range(1, r):\n", " if (r*j - m*i >= delta):\n", - " basis[k] = superelliptic_form(C, x^(i-1)/y^j)\n", + " basis[k] = superelliptic_form(self, RR(x^(i-1)/y^j))\n", " k = k+1\n", " return basis\n", " \n", @@ -68,13 +57,24 @@ " p = self.characteristic\n", " r = f.degree()\n", " delta = GCD(r, m)\n", - " #?????\n", + " R. = PolynomialRing(GF(p))\n", + " R1. = PolynomialRing(GF(p), 2)\n", + " RR = FractionField(R1)\n", " basis = {}\n", " if j == 'all':\n", " for j in range(1, m):\n", - " holo = baza_holo(m, f, j, p)\n", - " for k in range(0, len(holo)):\n", - " baza[k] = holo[k]\n", + " holo = C.basis_holomorphic_differentials(j)\n", + " for k in range(0, len(holo)):\n", + " basis[k] = superelliptic_cech(self, holo[k], superelliptic_function(self, R(0))) \n", + " k = len(basis)\n", + " \n", + " for i in range(1, r):\n", + " if (r*(m-j) - m*i >= delta):\n", + " s = R(m-j)*R(x)*R(f.derivative()) - R(m)*R(i)*f\n", + " psi = R(cut(s, i))\n", + " basis[k] = superelliptic_cech(self, superelliptic_form(self, psi/y^j), superelliptic_function(self, m*y^j/x^i))\n", + " k = k+1\n", + " return basis\n", " \n", "def reduction(C, g):\n", " p = C.characteristic\n", @@ -127,6 +127,7 @@ " \n", "class superelliptic_function:\n", " def __init__(self, C, g):\n", + " p = C.characteristic\n", " R. = PolynomialRing(GF(p), 2)\n", " RR = FractionField(R)\n", " f = C.polynomial\n", @@ -178,13 +179,18 @@ " C = self.curve\n", " f = C.polynomial\n", " m = C.exponent\n", + " p = C.characteristic\n", " g = self.function\n", + " R. = PolynomialRing(GF(p), 2)\n", + " RR = FractionField(R)\n", + " g = RR(g)\n", " A = g.derivative(x)\n", " B = g.derivative(y)*f.derivative(x)/(m*y^(m-1))\n", " return superelliptic_form(C, A+B)\n", " \n", "class superelliptic_form:\n", " def __init__(self, C, g):\n", + " p = C.characteristic\n", " R. = PolynomialRing(GF(p), 2)\n", " RR = FractionField(R)\n", " g = RR(reduction_form(C, g))\n", @@ -251,10 +257,11 @@ " return 1\n", " \n", "class superelliptic_cech:\n", - " def __init__(self, omega, fct):\n", + " def __init__(self, C, omega, fct):\n", " self.omega0 = omega\n", " self.omega8 = omega - diffn(fct)\n", " self.f = fct\n", + " self.curve = C\n", " \n", "def degree_of_rational_fctn(f):\n", " R. = PolynomialRing(GF(p))\n", @@ -273,35 +280,37 @@ " return lista[d]\n", "\n", "def cut(f, i):\n", + " R = f.parent()\n", " coeff = f.coefficients(sparse = false)\n", - " return sum(x^(j-i-1) * coeff[j] for j in range(i+1, f.degree() + 1))" + " return sum(R(x^(j-i-1)) * coeff[j] for j in range(i+1, f.degree() + 1))" ] }, { "cell_type": "code", - "execution_count": 80, + "execution_count": 49, "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "((-2*x^3*y + x^2 + x)/y) dx" + "{0: <__main__.superelliptic_cech object at 0x6fdcefeaf60>,\n", + " 1: <__main__.superelliptic_cech object at 0x6fdcefea8d0>}" ] }, - "execution_count": 80, + "execution_count": 49, "metadata": {}, "output_type": "execute_result" } ], "source": [ "C = superelliptic(x^3 + x + 2, 2, 5)\n", - "omega = superelliptic_form(C, (x^2+x)/y + 3*x^3)\n", - "omega" + "C.basis_de_rham()\n", + "#C.basis_holomorphic_differentials()" ] }, { "cell_type": "code", - "execution_count": 81, + "execution_count": 50, "metadata": {}, "outputs": [ { @@ -334,7 +343,7 @@ }, { "cell_type": "code", - "execution_count": 82, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -536,6 +545,95 @@ "f.coefficient()" ] }, + { + "cell_type": "code", + "execution_count": 35, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "x^3 + x + 1" + ] + }, + "execution_count": 35, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "x^3+x+1" + ] + }, + { + "cell_type": "code", + "execution_count": 36, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "Symbolic Ring" + ] + }, + "execution_count": 36, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "parent(x)" + ] + }, + { + "cell_type": "code", + "execution_count": 37, + "metadata": {}, + "outputs": [], + "source": [ + "R. = PolynomialRing(GF(5))" + ] + }, + { + "cell_type": "code", + "execution_count": 39, + "metadata": {}, + "outputs": [], + "source": [ + "R = (x^3+x).parent()" + ] + }, + { + "cell_type": "code", + "execution_count": 44, + "metadata": {}, + "outputs": [], + "source": [ + "R. = PolynomialRing(GF(5))\n", + "RR = FractionField(R)\n", + "A = RR(1/(x*y))" + ] + }, + { + "cell_type": "code", + "execution_count": 45, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "(-1)/(x^2*y)" + ] + }, + "execution_count": 45, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "A.derivative(x)" + ] + }, { "cell_type": "code", "execution_count": null,