zapis w bazie dziala w polowie

This commit is contained in:
jgarnek 2021-08-22 21:48:21 +02:00
parent 75290c6b6a
commit 68d1ca6d03

View File

@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 115,
"metadata": {},
"outputs": [],
"source": [
@ -35,8 +35,8 @@
" Fxy = FractionField(Rxy)\n",
" \n",
" basis = {}\n",
" k = 0\n",
" if j == 'all':\n",
" k = 0\n",
" for j in range(1, m):\n",
" for i in range(1, r):\n",
" if (r*j - m*i >= delta):\n",
@ -44,14 +44,13 @@
" 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(self, Fxy(x^(i-1)/y^j))\n",
" k = k+1\n",
" return basis\n",
" \n",
" def basis_de_rham(self, j = 'all'):\n",
" def degree_and_basis_de_rham(self, j = 'all'):\n",
" f = self.polynomial\n",
" m = self.exponent\n",
" p = self.characteristic\n",
@ -61,21 +60,39 @@
" Rxy.<x, y> = PolynomialRing(GF(p), 2)\n",
" Fxy = FractionField(Rxy)\n",
" basis = {}\n",
" degrees0 = {}\n",
" degrees1 = {}\n",
" t = 0\n",
" if j == 'all':\n",
" for j in range(1, m):\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, Rx(0))) \n",
" k = len(basis)\n",
" \n",
" basis[t] = superelliptic_cech(self, holo[k], superelliptic_function(self, Rx(0))) \n",
" g = Rx(holo[k].jth_component(j))\n",
" degrees0[t] = (g.degree(), j)\n",
" t += 1\n",
" for i in range(1, r):\n",
" if (r*(m-j) - m*i >= delta):\n",
" s = Rx(m-j)*Rx(x)*Rx(f.derivative()) - Rx(m)*Rx(i)*f\n",
" psi = Rx(cut(s, i))\n",
" basis[k] = superelliptic_cech(self, superelliptic_form(self, Fxy(psi/y^j)), superelliptic_function(self, Fxy(m*y^j/x^i)))\n",
" k = k+1\n",
" return basis\n",
" \n",
" basis[t] = superelliptic_cech(self, superelliptic_form(self, Fxy(psi/y^j)), superelliptic_function(self, Fxy(m*y^j/x^i)))\n",
" degrees0[t] = (psi.degree(), j)\n",
" degrees1[t] = (-i, j)\n",
" t += 1\n",
" return basis, degrees0, degrees1\n",
" \n",
" def degree_de_rham(self, i, j='all'):\n",
" basis, degrees0, degrees1 = self.degree_and_basis_de_rham(j)\n",
" if i==0:\n",
" return degrees0\n",
" \n",
" if i==1:\n",
" return degrees1\n",
" \n",
" def basis_de_rham(self, j = 'all'): \n",
" basis, degrees0, degrees1 = self.degree_and_basis_de_rham(j)\n",
" return basis\n",
" \n",
"def reduction(C, g):\n",
" p = C.characteristic\n",
" Rxy.<x, y> = PolynomialRing(GF(p), 2)\n",
@ -110,7 +127,7 @@
" m = C.exponent\n",
" g = reduction(C, g)\n",
"\n",
" g1 = RR(0)\n",
" g1 = Rxy(0)\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
" Fx = FractionField(Rx)\n",
" FxRy.<y> = PolynomialRing(Fx)\n",
@ -119,7 +136,7 @@
" for j in range(0, m):\n",
" if j==0:\n",
" G = coff(g, 0)\n",
" g1 += G\n",
" g1 += FxRy(G)\n",
" else:\n",
" G = coff(g, j)\n",
" g1 += Fxy(y^(j-m)*f*G)\n",
@ -143,9 +160,13 @@
" \n",
" def jth_component(self, j):\n",
" g = self.function\n",
" Rxy.<x, y> = PolynomialRing(GF(p), 2)\n",
" g = Rxy(g)\n",
" return g.coefficient(y^j)\n",
" C = self.curve\n",
" p = C.characteristic\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
" Fx.<x> = FractionField(Rx)\n",
" FxRy.<y> = PolynomialRing(Fx)\n",
" g = FxRy(g)\n",
" return coff(g, j)\n",
" \n",
" def __add__(self, other):\n",
" C = self.curve\n",
@ -219,11 +240,13 @@
" \n",
" def jth_component(self, j):\n",
" g = self.form\n",
" C = self.curve\n",
" p = C.characteristic\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
" Fx = FractionField(Rx)\n",
" FxRy.<y> = PolynomialRing(Fx)\n",
" Fxy = FractionField(FxRy)\n",
" Ryinv = PolynomialRing(Fx)\n",
" Ryinv.<y_inv> = PolynomialRing(Fx)\n",
" g = Fxy(g)\n",
" g = g(y = 1/y_inv)\n",
" g = Ryinv(g)\n",
@ -272,8 +295,75 @@
" C = self.curve\n",
" return superelliptic_cech(C, self.omega0 - other.omega0, self.f - other.f)\n",
" \n",
" def mult(self, constant):\n",
" C = self.curve\n",
" w1 = self.omega0.form\n",
" f1 = self.f.function\n",
" w2 = superelliptic_form(C, constant*w1)\n",
" f2 = superelliptic_function(C, constant*f1)\n",
" return superelliptic_cech(C, w2, f2)\n",
" \n",
" def __repr__(self):\n",
" return \"(\" + str(self.omega0) + \", \" + str(self.f) + \", \" + str(self.omega8) + \")\" \n",
" \n",
" def basis_coeffs(self):\n",
" C = self.curve\n",
" g = self.f\n",
" basis = C.basis_de_rham()\n",
"\n",
" def coordinates(self):\n",
" print(self)\n",
" C = self.curve\n",
" p = C.characteristic\n",
" m = C.exponent\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
" Fx = FractionField(Rx)\n",
" FxRy.<y> = PolynomialRing(Fx)\n",
" g = C.genus()\n",
" degrees0 = C.degree_de_rham(0)\n",
" degrees0_inv = {b:a for a, b in degrees0.items()} \n",
" degrees1 = C.degree_de_rham(1)\n",
" degrees1_inv = {b:a for a, b in degrees1.items()}\n",
" basis = C.basis_de_rham()\n",
" \n",
" omega = self.omega0\n",
" fct = self.f\n",
" \n",
" if fct.function == Rx(0) and omega.form == Rx(0):\n",
" for j in range(1, m):\n",
" omega_j = Fx(omega.jth_component(j))\n",
" if omega_j != Fx(0):\n",
" d = d = degree_of_rational_fctn(omega_j)\n",
" index = degrees0_inv[(d, j)]\n",
" a = coeff_of_rational_fctn(omega_j)\n",
" a1 = coeff_of_rational_fctn(basis[index].omega0.jth_component(j))\n",
" elt = self - basis[index].mult(a/a1)\n",
" return elt.coordinates() + a/a1*vector([GF(p)(i == index) for i in range(0, 2*g)])\n",
" \n",
" for j in range(1, m):\n",
" fct_j = Fx(fct.jth_component(j))\n",
" if (fct_j != Rx(0)):\n",
" d = degree_of_rational_fctn(fct_j)\n",
" \n",
" if (d, j) in degrees1.values():\n",
" index = degrees1_inv[(d, j)]\n",
" a = coeff_of_rational_fctn(fct_j)\n",
" a1 = coeff_of_rational_fctn(basis[index].f.jth_component(j))\n",
" elt = self - basis[index].mult(a/a1)\n",
" return elt.coordinates() + a/a1*vector([GF(p)(i == index) for i in range(0, 2*g)])\n",
" \n",
" if d<0:\n",
" a = coeff_of_rational_fctn(fct_j)\n",
" elt =- superelliptic_cech(C, elt.omega0, elt.f - FxRy(y^j*x^d)).mult(a)\n",
" return elt.coordinates()\n",
" \n",
" if (fct_j != Rx(0)):\n",
" G = superelliptic_function(C, y^j*x^d)\n",
" a = coeff_of_rational_fctn(fct_j)\n",
" elt =-superelliptic_cech(diffn(G), G).mult(a)\n",
" return elt.coordinates()\n",
"\n",
" return vector(2*g*[0])\n",
" \n",
"def degree_of_rational_fctn(f):\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
@ -285,6 +375,18 @@
" d2 = f2.degree()\n",
" return(d1 - d2)\n",
"\n",
"def coeff_of_rational_fctn(f):\n",
" Rx.<x> = PolynomialRing(GF(p))\n",
" Fx = FractionField(Rx)\n",
" f = Fx(f)\n",
" f1 = f.numerator()\n",
" f2 = f.denominator()\n",
" d1 = f1.degree()\n",
" d2 = f2.degree()\n",
" a1 = f1.coefficients(sparse = false)[d1]\n",
" a2 = f2.coefficients(sparse = false)[d2]\n",
" return(a1/a2)\n",
"\n",
"def coff(f, d):\n",
" lista = f.coefficients(sparse = false)\n",
" if len(lista) <= d:\n",
@ -299,30 +401,86 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 116,
"metadata": {},
"outputs": [
{
"ename": "TypeError",
"evalue": "unsupported operand parent(s) for +: 'Real Field with 53 bits of precision' and 'Fraction Field of Univariate Polynomial Ring in x over Finite Field of size 5'",
"data": {
"text/plain": [
"{0: ((x/y) dx, 2/x*y, ((x^3*y^5 - x^3 + x - 1)/(x^2*y^6)) dx),\n",
" 1: (((-1)/y) dx, 2/x^2*y, ((-x^3*y^5 + x^3 - 2*x - 2)/(x^3*y^6)) dx),\n",
" 2: (((-2*x)/y^2) dx, 2/x*y^2, ((-2*x^3*y^3 + x^3 - 1)/(x^2*y^5)) dx),\n",
" 3: ((1/y^2) dx, 2/x^2*y^2, ((x^3*y^3 - 2*x^3 + 2*x - 2)/(x^3*y^5)) dx),\n",
" 4: ((1/y^3) dx, 0, (1/y^3) dx),\n",
" 5: (0 dx, 2/x*y^3, ((-2*x^3 - x - 1)/(x^2*y^4)) dx),\n",
" 6: ((1/y^4) dx, 0, (1/y^4) dx),\n",
" 7: ((2*x/y^4) dx, 2/x*y^4, ((2*x^3 - 2*x*y - y)/(x^2*y^4)) dx),\n",
" 8: ((1/y^5) dx, 0, (1/y^5) dx),\n",
" 9: ((x/y^5) dx, 0, (x/y^5) dx),\n",
" 10: ((1/y^6) dx, 0, (1/y^6) dx),\n",
" 11: ((x/y^6) dx, 0, (x/y^6) dx)}"
]
},
"execution_count": 116,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"p = 5\n",
"C = superelliptic(x^3 + x + 2, 7, p)\n",
"C.basis_de_rham()\n",
"#C.basis_holomorphic_differentials()"
]
},
{
"cell_type": "code",
"execution_count": 113,
"metadata": {},
"outputs": [],
"source": [
"RxRy.<x, y> = PolynomialRing(GF(p), 2)\n",
"w1 = superelliptic_cech(C, superelliptic_form(C, (1/y^5)), superelliptic_function(C, 0))\n",
"w2 = superelliptic_cech(C, superelliptic_form(C,2*x/y^4), superelliptic_function(C, 2/x*y^4))\n",
"w = w1+w2+w2"
]
},
{
"cell_type": "code",
"execution_count": 114,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(((-x*y + 1)/y^5) dx, 4/x*y^4, ((-x^3*y + x*y^2 + x^2 - 2*y^2)/(x^2*y^5)) dx)\n"
]
},
{
"ename": "AttributeError",
"evalue": "'superelliptic_function' object has no attribute 'jth_coordinate'",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-20-d63657cf06e3>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mC\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msuperelliptic\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m3\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m7\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\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[0;32m----> 2\u001b[0;31m \u001b[0mC\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbasis_de_rham\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 3\u001b[0m \u001b[0;31m#C.basis_holomorphic_differentials()\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-19-a65119f7de4f>\u001b[0m in \u001b[0;36mbasis_de_rham\u001b[0;34m(self, j)\u001b[0m\n\u001b[1;32m 65\u001b[0m \u001b[0ms\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mm\u001b[0m\u001b[0;34m-\u001b[0m\u001b[0mj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mderivative\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mm\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mi\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 66\u001b[0m \u001b[0mpsi\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mRx\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcut\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ms\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mi\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[0;32m---> 67\u001b[0;31m \u001b[0mbasis\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mk\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0msuperelliptic_cech\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msuperelliptic_form\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mFxy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mpsi\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0msuperelliptic_function\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mFxy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mm\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0my\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mj\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m**\u001b[0m\u001b[0mi\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 68\u001b[0m \u001b[0mk\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mk\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[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 69\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0mbasis\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-19-a65119f7de4f>\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, C, g)\u001b[0m\n\u001b[1;32m 186\u001b[0m \u001b[0mRxy\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[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\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'y'\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[0my\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mRxy\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_first_ngens\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 187\u001b[0m \u001b[0mFxy\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mFractionField\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mRxy\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 188\u001b[0;31m \u001b[0mg\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mFxy\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mreduction_form\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mC\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mg\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 189\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mform\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mg\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 190\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcurve\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mC\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m<ipython-input-19-a65119f7de4f>\u001b[0m in \u001b[0;36mreduction_form\u001b[0;34m(C, g)\u001b[0m\n\u001b[1;32m 112\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mj\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[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 113\u001b[0m \u001b[0mG\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcoff\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\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[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 114\u001b[0;31m \u001b[0mg1\u001b[0m \u001b[0;34m+=\u001b[0m \u001b[0mG\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 115\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 116\u001b[0m \u001b[0mG\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcoff\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mg\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/sagemath-9.1/local/lib/python3.7/site-packages/sage/structure/element.pyx\u001b[0m in \u001b[0;36msage.structure.element.Element.__add__ (build/cythonized/sage/structure/element.c:10839)\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1232\u001b[0m \u001b[0;31m# Left and right are Sage elements => use coercion model\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1233\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mBOTH_ARE_ELEMENT\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcl\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[0;32m-> 1234\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mcoercion_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mbin_op\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mleft\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mright\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0madd\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 1235\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1236\u001b[0m \u001b[0mcdef\u001b[0m \u001b[0mlong\u001b[0m \u001b[0mvalue\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;32m/opt/sagemath-9.1/local/lib/python3.7/site-packages/sage/structure/coerce.pyx\u001b[0m in \u001b[0;36msage.structure.coerce.CoercionModel.bin_op (build/cythonized/sage/structure/coerce.c:11180)\u001b[0;34m()\u001b[0m\n\u001b[1;32m 1253\u001b[0m \u001b[0;31m# We should really include the underlying error.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1254\u001b[0m \u001b[0;31m# This causes so much headache.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m-> 1255\u001b[0;31m \u001b[0;32mraise\u001b[0m \u001b[0mbin_op_exception\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mop\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\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 1256\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 1257\u001b[0m \u001b[0mcpdef\u001b[0m \u001b[0mcanonical_coercion\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mx\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\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[0;31mTypeError\u001b[0m: unsupported operand parent(s) for +: 'Real Field with 53 bits of precision' and 'Fraction Field of Univariate Polynomial Ring in x over Finite Field of size 5'"
"\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-114-c2988137dec9>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mw\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcoordinates\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[0;32m<ipython-input-111-0f546555b2f0>\u001b[0m in \u001b[0;36mcoordinates\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 341\u001b[0m \u001b[0mindex\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mdegrees1_inv\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0md\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mj\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 342\u001b[0m \u001b[0ma\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcoeff_of_rational_fctn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfct_j\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 343\u001b[0;31m \u001b[0ma1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mcoeff_of_rational_fctn\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbasis\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mf\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjth_coordinate\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mj\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 344\u001b[0m \u001b[0melt\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0mbasis\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mindex\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmult\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0ma\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0ma1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 345\u001b[0m \u001b[0;32mreturn\u001b[0m \u001b[0melt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcoordinates\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m+\u001b[0m \u001b[0ma\u001b[0m\u001b[0;34m/\u001b[0m\u001b[0ma1\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mvector\u001b[0m\u001b[0;34m(\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[0mi\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0mindex\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;32mfor\u001b[0m \u001b[0mi\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[0mInteger\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m2\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m*\u001b[0m\u001b[0mg\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[0;31mAttributeError\u001b[0m: 'superelliptic_function' object has no attribute 'jth_coordinate'"
]
}
],
"source": [
"C = superelliptic(x^3 + x + 2, 7, 5)\n",
"C.basis_de_rham()\n",
"#C.basis_holomorphic_differentials()"
"w.coordinates()"
]
},
{
"cell_type": "code",
"execution_count": 65,
"metadata": {},
"outputs": [],
"source": [
"a, b, c = C.degree_and_basis_de_rham()"
]
},
{
@ -653,6 +811,46 @@
"A.derivative(x)"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"dict1 = {}\n",
"dict1[3] = 5\n",
"dict1[6] = 121"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"degrees1_inv = {b:a for a, b in dict1.items()}"
]
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"{5: 3, 121: 6}"
]
},
"execution_count": 47,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"degrees1_inv"
]
},
{
"cell_type": "code",
"execution_count": null,