{ "cells": [ { "cell_type": "markdown", "id": "aa26ee70", "metadata": { "tags": [] }, "source": [ "Land acknowledgement\n", "--------------------\n", "I respectfully acknowledge we are presently on the unceded traditional territories of the Coast Salish peoples, including the səl̓ilw̓ətaʔɬ (Tsleil-Waututh), kʷikʷəƛ̓əm (Kwikwetlem), Sḵwx̱wú7mesh Úxwumixw (Squamish) and xʷməθkʷəy̓əm (Musqueam) Nations.\n", "\n", "Introduction to Magma\n", "=====================\n", "\n", "Basic model for most computer algebra systems: *glorified graphing calculator*. They tend to be built around a read-evaluate-print-loop (REPL)\"\n", " - you type in instructions that the system **reads**\n", " - the system **evaluates** (executes) the instructions\n", " - the system **prints** the result (if appropriate)\n", "\n", "The instructions may also change state of the system (storing things in memory etc.). Using it looks something like this: \n", "\n", "Python and many interactive programming languages work in the same way.\n", "\n", "The interface you see here is a [*Jupyter notebook*](https://jupyter.org/). It offers a convenient way to communicate with a REPL when you are developing or experimenting." ] }, { "cell_type": "code", "execution_count": 1, "id": "0ce5bd6a", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "10\n" ] } ], "source": [ "a:=10;a;" ] }, { "cell_type": "code", "execution_count": 2, "id": "e23319c0", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "11\n", "12\n", "13\n", "14\n", "15\n", "16\n", "17\n", "18\n", "19\n", "20\n" ] } ], "source": [ "for i in [1..10] do\n", " a := a + 1;\n", " print(a);\n", "end for;" ] }, { "cell_type": "markdown", "id": "0df58541", "metadata": {}, "source": [ "Some basic computations in Magma\n", "----------------------------------------------------\n", "\n", "How about factoring a polynomial:" ] }, { "cell_type": "code", "execution_count": 3, "id": "05ec6257", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[\n", ",\n", ",\n", "\n", "]\n" ] } ], "source": [ "R:=PolynomialRing(Rationals());\n", "Factorization(x^4-1);" ] }, { "cell_type": "code", "execution_count": 4, "id": "77b1b20b", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "F:=GF(64);\n", "f:=MinimalPolynomial(a);" ] }, { "cell_type": "code", "execution_count": 5, "id": "79e049d8-1a24-4728-802d-a44d3f9ec962", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Univariate Polynomial Ring in y over GF(2)\n", "y^6 + y^4 + y^3 + y + 1\n" ] } ], "source": [ "rr:=Parent(f);\n", "rr;\n", "f;" ] }, { "cell_type": "markdown", "id": "9a138d57", "metadata": {}, "source": [ "Observations:\n", "--------------------\n", " - Magma uses `<` and `>` as a special kind of bracket (as a result, equality and ordering relations are spelled `eq`, `ne`, `lt`, `le`, `gt`, `le`)\n", " - In order to define a polynomial, one first defines a polynomial ring and gives a name to the generator.\n", " - One can then create the polynomials. Because Magma is explicit about the ring a polynomial lies in, questions about factorizations are unambiguous." ] }, { "cell_type": "markdown", "id": "d4e10ddf", "metadata": {}, "source": [ "Some algebraic number theory\n", "--------------------------------------------\n", "As an example where Magma's sometimes seemingly pedantic insistence on explicitly defined mathematical context starts to pay of, let's look at some basic algebraic number theory. We consider a finite extension of $\\mathbb{Q}$, i.e., a *number field*:\n", "$$K= \\mathbb{Q}(a) = \\mathbb{Q}[x]/(x^5+x+15).$$\n", "We determine the subring $\\mathcal{O}_K$ of elements that are integral over $\\mathbb{Z}$. This is called the *ring of integers* of $K$.\n", "\n", "The ring $\\mathcal{O}_K$ is a Dedekind domain. Dirichlet's Unit Theorem tells us that $\\mathcal{O}_K$\n", "\n", ", and hence it has unique ideal factorization. The only obstruction to it being a unique factorization domain itself is that it might not be a Principal Ideal Domain.\n", "\n" ] }, { "cell_type": "code", "execution_count": 6, "id": "4d5dc6e9", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Number Field with defining polynomial x^5 + x + 15 over the Rational Field\n", "-a - 15\n" ] } ], "source": [ "R:=PolynomialRing(Rationals());\n", "K:=NumberField(x^5+x+15);\n", "K;\n", "a^5;" ] }, { "cell_type": "code", "execution_count": 7, "id": "6e6cfd72-cb08-4cec-ad5b-77543faef428", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Set of sequences over Unramified extension defined by the polynomial (1 + O(41^20))*x^2 + (38 + O(41^20))*x + 6 + O(41^20) over 41-adic ring\n" ] } ], "source": [ "G,l,data:=GaloisGroup(K);\n", "Parent(l);" ] }, { "cell_type": "code", "execution_count": 8, "id": "911b188d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Maximal Equation Order with defining polynomial x^5 + x + 15 over its ground order\n" ] } ], "source": [ "OK:=IntegerRing(K);OK;" ] }, { "cell_type": "markdown", "id": "e24471f0", "metadata": {}, "source": [ "Dirichlet's Unit Theorem tells us that the group of units $\\mathcal{O}_K^\\times$ is finitely generated. Magma can compute it:" ] }, { "cell_type": "code", "execution_count": 9, "id": "23cb47a0", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Abelian Group isomorphic to Z/2 + Z + Z\n", "Defined on 3 generators\n", "Relations:\n", "2*U.1 = 0\n", "---\n", "Mapping from: GrpAb: U to RngOrd: OK\n" ] } ], "source": [ "U,m:=UnitGroup(OK);\n", "U;\n", "print \"---\";\n", "m;" ] }, { "cell_type": "markdown", "id": "9171e403", "metadata": {}, "source": [ "Note the representation of the unit group: It is returned as an abstract finitely generated abelian group, together with a mapping from the group into $\\mathcal{O}_K$. The mapping allows us to go back and forth between the two." ] }, { "cell_type": "code", "execution_count": 10, "id": "e20f647d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "U.1\n", "U.2\n", "U.3\n" ] } ], "source": [ "U.1, U.2, U.3;" ] }, { "cell_type": "code", "execution_count": 11, "id": "58fc3e32", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[\n", "-1,\n", "505*a^4 - 540*a^3 - 864*a^2 + 2549*a + 151,\n", "4*a^4 - 3*a^3 - 7*a^2 + 18*a + 4\n", "]\n" ] } ], "source": [ "[K!m(U.i): i in [1,2,3]];" ] }, { "cell_type": "code", "execution_count": 12, "id": "3451d2e7", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "3589*a^4 - 6024*a^3 + 10111*a^2 - 16971*a + 32074\n" ] } ], "source": [ "1/(K!m(U.3));" ] }, { "cell_type": "markdown", "id": "fd6038ed", "metadata": {}, "source": [ "We can check that the generators of the unit group are indeed units by verifying that their minimal polynomials have a unit constant term in $\\mathbb{Z}$." ] }, { "cell_type": "code", "execution_count": 13, "id": "78a79b79", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "$.1^5 + 1265*$.1^4 + 128060607*$.1^3 - 4382382*$.1^2 + 1330*$.1 - 1\n" ] } ], "source": [ "f:=MinimalPolynomial(m(U.2));\n", "f;" ] }, { "cell_type": "markdown", "id": "7342c02e", "metadata": {}, "source": [ "Note the odd `$.1`. That is how Magma prints generators it doesn't know a name for. To fix it, we should give a name to the generator, which we can obtain from the `Parent`. If you use Magma a bit you will encounter these `$.1` quite a bit, so it's good to learn how to remedy them." ] }, { "cell_type": "code", "execution_count": 14, "id": "c26a81a9", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "Zx:=Parent(f);" ] }, { "cell_type": "markdown", "id": "e84afb82", "metadata": {}, "source": [ "The ring $\\mathcal{O}_K$ is a Dedekind domain. That means the only obstruction to it being a unique factorization domain is that it may fail to be a principal ideal domain. The *Ideal Class Group* measures the index of the subgroup generated by principal ideals in the group of (fractional) ideals of $\\mathcal{O}_K$. It is a finite group and Magma can compute it:" ] }, { "cell_type": "code", "execution_count": 15, "id": "87898531", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[\n", ",\n", ",\n", "\n", "]\n" ] } ], "source": [ "P3s:=Factorization(3*OK);P3s;" ] }, { "cell_type": "code", "execution_count": 16, "id": "d3b4afa6-9ddf-4622-b8e8-6582191d0cba", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Set of ideals of Maximal Equation Order with defining polynomial x^5 + x + 15 over its ground order\n" ] } ], "source": [ "Pa:=P3s[3][1];\n", "Parent(Pa);" ] }, { "cell_type": "code", "execution_count": 17, "id": "2bfd2e99-827f-40f8-9d12-59f0b4293561", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "xZ^5 + 77*xZ^4 + 2713*xZ^3 + 1808*xZ^2 + 336*xZ + 9\n" ] } ], "source": [ "bl,gen:=IsPrincipal(Pa);MinimalPolynomial(gen);" ] }, { "cell_type": "code", "execution_count": 18, "id": "5fe2b74d", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ false, false, true ]\n" ] } ], "source": [ "[IsPrincipal(p[1]) : p in P3s];" ] }, { "cell_type": "code", "execution_count": 19, "id": "098361ea", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Abelian Group isomorphic to Z/2\n", "Defined on 1 generator\n", "Relations:\n", "2*Cl.1 = 0\n", "---\n", "Mapping from: GrpAb: Cl to Set of ideals of OK\n" ] } ], "source": [ "Cl, mp:=ClassGroup(OK);\n", "Cl;\n", "print \"---\";\n", "mp;" ] }, { "cell_type": "code", "execution_count": 20, "id": "12f56871", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Ideal of OK\n", "Two element generators:\n", "[2, 0, 0, 0, 0]\n", "[1, 1, 1, 0, 0]\n" ] } ], "source": [ "(Cl.1)@mp;" ] }, { "cell_type": "markdown", "id": "1a59cb3e", "metadata": {}, "source": [ "Evaluating a mapping\n", "-------------------------------\n", "Magma has its roots in the group theory community, where actions are often on the right. Mapping applications in Magma are even originally on the right: `f(a)` is actually just a different notation for `a@f`. As a result `f(g(a))` the same as `a@g@f`, which is the same as `a@(g*f)` (where `*` is function composition), so function composition `g*f` in magma actually read as \"`g` then `f`\". So `(g*f)(a)` is not what you might think it is. This is a good gotcha to be aware of.\n", "\n", "Some mappings may have an \"inverse\" or at least a way to select a preimage. This can be accessed by `a@@f`.\n" ] }, { "cell_type": "code", "execution_count": 21, "id": "ba169862", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[\n", "Cl.1,\n", "Cl.1,\n", "0\n", "]\n" ] } ], "source": [ "[p[1]@@mp : p in P3s];" ] }, { "cell_type": "markdown", "id": "6ff75177", "metadata": {}, "source": [ "Magma's Documentation\n", "------------------------------------\n", "Magma has quite extensive documentation, but it takes a little effort to find your way around in it:\n", "\n", "http://magma.maths.usyd.edu.au/magma/documentation/\n", "\n", "I recommend that at some point you read [First Steps in Magma](http://magma.maths.usyd.edu.au/magma/pdf/first.pdf). It describes the basic principles of Magma.\n", "\n", "The [Magma Handbook](http://magma.maths.usyd.edu.au/magma/handbook/) is the main reference. You can use \"Search\" to find topics, but do read the introduction of the relevant section. You should probably read the chapter on (The Magma Language)[http://magma.maths.usyd.edu.au/magma/handbook/part/1] in its entirety at some point." ] }, { "cell_type": "code", "execution_count": 22, "id": "6fa49afb", "metadata": { "tags": [] }, "outputs": [ { "data": { "text/html": [ "Magma help on Sequence" ], "text/plain": [ "Link to http://magma.maths.usyd.edu.au/magma/handbook/search?chapters=1&examples=1&intrinsics=1&query=Sequence" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "?Sequence" ] }, { "cell_type": "code", "execution_count": 23, "id": "3e91cb6c", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Intrinsic 'PolynomialRing'\n", "\n", "Signatures:\n", "\n", "(LS::LinearSys) -> RngMPol\n", "\n", "The polynomial ring of LS.\n", "\n", "(model::ModelG1) -> RngMPol\n", "\n", "The polynomial ring used to define the given genus one model.\n", "\n", "(R::Rng) -> RngUPol\n", "[\n", "Global: BoolElt, \n", "Exact: BoolElt\n", "]\n", "\n", "Create the univariate polynomial ring over R.\n", "\n", "(R::Rng, n::RngIntElt) -> RngMPol\n", "[\n", "Global: BoolElt, \n", "Sparse: BoolElt\n", "]\n", "\n", "Create a multivariate polynomial ring over R in n variables.\n", "\n", "(R::Rng, n::RngIntElt, O::MonStgElt) -> RngMPol\n", "(R::Rng, n::RngIntElt, O::MonStgElt, x1::Any) -> RngMPol\n", "(R::Rng, n::RngIntElt, O::MonStgElt, x1::Any, x2::Any) -> RngMPol\n", "(R::Rng, n::RngIntElt, O::MonStgElt, x1::Any, x2::Any, x3::Any) -> RngMPol\n", "\n", "Create the multivariate polynomial ring over R in n variables with given order O.\n", "\n", "(R::Rng, n::RngIntElt, T::Tup) -> RngMPol\n", "\n", "Create the multivariate polynomial ring over R in n variables with the order described by tuple T (matching what is returned by MonomialOrder).\n", "\n", "(R::Rng, G::SeqEnum[RngIntElt]) -> RngMPol\n", "\n", "Create the graded multivariate polynomial ring over R in #G variables and with the given grading G on the variables.\n", "\n", "(R::Rng, G::SeqEnum[RngIntElt], O::MonStgElt) -> RngMPol\n", "(R::Rng, G::SeqEnum[RngIntElt], O::MonStgElt, x1::Any) -> RngMPol\n", "(R::Rng, G::SeqEnum[RngIntElt], O::MonStgElt, x1::Any, x2::Any) -> RngMPol\n", "\n", "Create the graded multivariate polynomial ring over R in #G variables with the given grading G on the variables and with the given order O.\n", "\n", "(R::Rng, G::SeqEnum[RngIntElt], T::Tup) -> RngMPol\n", "\n", "Create the graded multivariate polynomial ring over R in #G variables with the given grading G on the variables and with the order described by tuple T (matching what is returned by MonomialOrder).\n", "\n", "(R::RngInvar) -> RngMPol\n", "\n", "The generic polynomial ring in which the elements of R lie.\n", "\n", "\n" ] } ], "source": [ "PolynomialRing;" ] }, { "cell_type": "markdown", "id": "8d38ea03-7be0-4078-aac9-a88a0a4ba1ce", "metadata": {}, "source": [ "A more elaborate example\n", "------------------------\n", "There is a classical algebraic-geometric construction that takes $7$ points in the projective plane and constructs a plane quartic curve from it. For the algebraic geometers in the audience: blowing up $7$ points in $\\mathbb{P}^2$ (in general position) yields a degree-$2$ del Pezzo surface, for which the anti-canonical system yields a double cover of $\\mathbb{P}^2$, branched over a quartic curve.\n", "\n", "The construction is the following:\n", " - We determine the space of cubics that vanish at the $7$ points. That space is $3$-dimensional; with basis, say, $f_1,f_2,f_3$\n", " - These define a map $\\phi\\colon:\\mathbb{P}^2\\to\\mathbb{P}^2$ defined by $(f_1:f_2:f_3)$\n", " - The map $\\phi$ has a $3\\times 3$ Jacobian matrix associated with it of the partial derivatives of $f_1,f_2,f_3$. Its determinant defined a sextic curve $D$ in $\\mathbb{P}^2$, passing through the seven points.\n", " - The image $C=\\phi(D)$ is a quartic plane curve. The map $\\phi$ actually defines a birational map between $C$ and $D$." ] }, { "cell_type": "code", "execution_count": 24, "id": "d0fdfc0a-3555-4baa-b209-52b73ad7f71a", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[\n", "[ 1, 0, 0 ],\n", "[ 0, 1, 0 ],\n", "[ 0, 0, 1 ],\n", "[ 1, 1, 1 ],\n", "[ 1, 3, -1 ],\n", "[ 1, 2, 7 ],\n", "[ 1, -1, -2 ]\n", "]\n" ] } ], "source": [ "P:=[[1,0,0],[0,1,0],[0,0,1],[1,1,1],[1,3,-1],[1,2,7],[1,-1,-2]];\n", "P;" ] }, { "cell_type": "code", "execution_count": 25, "id": "165c3ee5-da49-46b5-ba1a-8743b888693e", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "P2uvw:=ProjectiveSpace(Rationals(),2);" ] }, { "cell_type": "code", "execution_count": 26, "id": "da673016-c5cd-44d1-bd6b-885e9248a140", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[ (1 : 0 : 0), (0 : 1 : 0), (0 : 0 : 1), (1 : 1 : 1), (-1 : -3 : 1), (1/7 : 2/7 : 1), (-1/2 : 1/2 : 1) ]\n" ] } ], "source": [ "[P2uvw!p : p in P];" ] }, { "cell_type": "code", "execution_count": 27, "id": "c7d576a4-e80b-4701-89cb-6491df482693", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{@\n", "u^3,\n", "u^2*v,\n", "u^2*w,\n", "u*v^2,\n", "u*v*w,\n", "u*w^2,\n", "v^3,\n", "v^2*w,\n", "v*w^2,\n", "w^3\n", "@}\n" ] } ], "source": [ "mons:=MonomialsOfDegree(Parent(w),3);mons;" ] }, { "cell_type": "code", "execution_count": 28, "id": "cfb726e2-b19d-4592-9d75-278c90a0392e", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "K:=Kernel(Matrix([[Evaluate(m,p): p in P]:m in mons]));" ] }, { "cell_type": "code", "execution_count": 29, "id": "22455556-12b2-4de3-82bd-26ab2dae6fec", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "PHI:=[&+[b[i]*mons[i]: i in [1..#mons]]: b in Basis(K)];\n" ] }, { "cell_type": "code", "execution_count": 30, "id": "eb23cc7f-03dc-46c2-befe-cadfe4cac1dd", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mapping from: Prj: P2uvw to Prj: P2xyz\n", "with equations : \n", "u^2*v - 208/63*u*v*w + 19/14*v^2*w + 37/21*u*w^2 - 103/126*v*w^2\n", "u^2*w - 67/27*u*v*w + 2/3*v^2*w + 13/9*u*w^2 - 17/27*v*w^2\n", "u*v^2 - 85/21*u*v*w + 31/14*v^2*w + 13/7*u*w^2 - 43/42*v*w^2\n" ] } ], "source": [ "P2xyz:=ProjectiveSpace(Rationals(),2);\n", "phi:=mapP2xyz|PHI>;phi;" ] }, { "cell_type": "code", "execution_count": 31, "id": "9b908bf4-8ec0-47f5-bfce-95f306ef6310", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{ (0 : 1 : 0), (1 : 0 : 0), (1 : 1 : 1), (0 : 0 : 1), (1/7 : 2/7 : 1), (-1/2 : 1/2 : 1), (-1 : -3 : 1) }\n" ] } ], "source": [ "Support(BaseScheme(phi));" ] }, { "cell_type": "code", "execution_count": 32, "id": "d26d1658-f3a9-40d0-b183-78ba2e9b45fb", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[2*u*v - 208/63*v*w + 37/21*w^2 2*u*w - 67/27*v*w + 13/9*w^2 v^2 - 85/21*v*w + 13/7*w^2]\n", "[u^2 - 208/63*u*w + 19/7*v*w - 103/126*w^2 -67/27*u*w + 4/3*v*w - 17/27*w^2 2*u*v - 85/21*u*w + 31/7*v*w - 43/42*w^2]\n", "[-208/63*u*v + 19/14*v^2 + 74/21*u*w - 103/63*v*w u^2 - 67/27*u*v + 2/3*v^2 + 26/9*u*w - 34/27*v*w -85/21*u*v + 31/14*v^2 + 26/7*u*w - 43/21*v*w]\n" ] } ], "source": [ "jacobian_matrix:=Matrix([[Derivative(PHI[i],j): i in [1..3]]: j in [1..3]]);\n", "jacobian_matrix;" ] }, { "cell_type": "code", "execution_count": 33, "id": "87120a8c-8428-4e4e-a0a8-dd508af80957", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Curve over Rational Field defined by\n", "-3*u^4*v^2 + 67/9*u^3*v^3 - 2*u^2*v^4 + 85/7*u^4*v*w - 223/7*u^3*v^2*w + 853/42*u^2*v^3*w - 7/2*u*v^4*w - 39/7*u^4*w^2 + 143/7*u^3*v*w^2 - 25*u^2*v^2*w^2 + 53/6*u*v^3*w^2 - 13/14*v^4*w^2 - 3*u^3*w^3 + 139/14*u^2*v*w^3 - 47/14*u*v^2*w^3 - 10/63*v^3*w^3 - 6/7*u^2*w^4 - 1/14*u*v*w^4 + 3/14*v^2*w^4\n" ] } ], "source": [ "det:=Determinant(jacobian_matrix);\n", "D:=Curve(P2uvw,det);\n", "D;" ] }, { "cell_type": "code", "execution_count": 34, "id": "1f1c1d6e-44f4-404c-94c4-b71afcd0986a", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "C:=phi(D);" ] }, { "cell_type": "code", "execution_count": 35, "id": "bc25738c-7935-4738-98d0-82eef28e7598", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Curve over Rational Field defined by\n", "x^4 - 170/21*x^3*y + 8863/441*x^2*y^2 - 2210/147*x*y^3 + 169/49*y^4 - 134/27*x^3*z + 8140/567*x^2*y*z - 22844/1323*x*y^2*z + 2440/441*y^3*z + 5461/729*x^2*z^2 - 23084/1701*x*y*z^2 + 26758/3969*y^2*z^2 - 268/81*x*z^3 + 598/189*y*z^3 + 4/9*z^4\n" ] } ], "source": [ "C;" ] }, { "cell_type": "code", "execution_count": 36, "id": "2d3eba0e-2872-4274-af8d-3f0e2cb1eaf8", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "phires:=Restriction(phi,D,C);" ] }, { "cell_type": "code", "execution_count": 37, "id": "db6a32d8-a447-4131-8290-bc6d8463c321", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mapping from: CrvPln: D to CrvPln: C\n", "with equations : \n", "u^2*v - 208/63*u*v*w + 19/14*v^2*w + 37/21*u*w^2 - 103/126*v*w^2\n", "u^2*w - 67/27*u*v*w + 2/3*v^2*w + 13/9*u*w^2 - 17/27*v*w^2\n", "u*v^2 - 85/21*u*v*w + 31/14*v^2*w + 13/7*u*w^2 - 43/42*v*w^2\n" ] } ], "source": [ "phires;" ] }, { "cell_type": "code", "execution_count": 38, "id": "77bf5fc6-2a93-4726-a69d-19103c16a3ea", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "true Mapping from: CrvPln: C to CrvPln: D\n", "with equations : \n", "-392/1755*x^4 + 1904/1053*x^3*y - 126013/31590*x^2*y^2 + 1513/1134*x*y^3 + 299/1890*y^4 + 52528/47385*x^3*z - 108178/28431*x^2*y*z + 477419/94770*x*y^2*z - 15394/22113*y^3*z - 390040/255879*x^2*z^2 + 1668814/426465*x*y*z^2 - 408167/142155*y^2*z^2 + 52528/142155*x*z^3 - 29092/47385*y*z^3\n", "-392/1755*x^3*z + 7126/5265*x^2*y*z - 1499/1215*x*y^2*z + 338/405*y^3*z + 52528/47385*x^2*z^2 - 220094/142155*x*y*z^2 - 4943/9477*y^2*z^2 - 390040/255879*x*z^3 + 600992/426465*y*z^3 + 52528/142155*z^4\n", "y^3*z - 140/117*y^2*z^2 + 1568/5265*y*z^3\n", "and inverse\n", "u^2*v - 208/63*u*v*w + 19/14*v^2*w + 37/21*u*w^2 - 103/126*v*w^2\n", "u^2*w - 67/27*u*v*w + 2/3*v^2*w + 13/9*u*w^2 - 17/27*v*w^2\n", "u*v^2 - 85/21*u*v*w + 31/14*v^2*w + 13/7*u*w^2 - 43/42*v*w^2\n" ] } ], "source": [ "IsInvertible(phires);" ] }, { "cell_type": "code", "execution_count": 39, "id": "fe1d9f4e-dc28-42e5-adfd-f5f2795df429", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mapping from: CrvPln: C to CrvPln: D\n", "with equations : \n", "-392/1755*x^4 + 1904/1053*x^3*y - 126013/31590*x^2*y^2 + 1513/1134*x*y^3 + 299/1890*y^4 + 52528/47385*x^3*z - 108178/28431*x^2*y*z + 477419/94770*x*y^2*z - 15394/22113*y^3*z - 390040/255879*x^2*z^2 + 1668814/426465*x*y*z^2 - 408167/142155*y^2*z^2 + 52528/142155*x*z^3 - 29092/47385*y*z^3\n", "-392/1755*x^3*z + 7126/5265*x^2*y*z - 1499/1215*x*y^2*z + 338/405*y^3*z + 52528/47385*x^2*z^2 - 220094/142155*x*y*z^2 - 4943/9477*y^2*z^2 - 390040/255879*x*z^3 + 600992/426465*y*z^3 + 52528/142155*z^4\n", "y^3*z - 140/117*y^2*z^2 + 1568/5265*y*z^3\n", "and inverse\n", "u^2*v - 208/63*u*v*w + 19/14*v^2*w + 37/21*u*w^2 - 103/126*v*w^2\n", "u^2*w - 67/27*u*v*w + 2/3*v^2*w + 13/9*u*w^2 - 17/27*v*w^2\n", "u*v^2 - 85/21*u*v*w + 31/14*v^2*w + 13/7*u*w^2 - 43/42*v*w^2\n", "and alternative equations :\n", "1/2*x^3 - 73/24*x^2*y + 1979/392*x*y^2 - 741/392*y^3 - 67/54*x^2*z + 2105/504*x*y*z - 494/147*y^2*z + 1/3*x*z^2 - 19/28*y*z^2\n", "1/2*x^2*z - 1/84*x*y*z - 13/14*y^2*z - 67/54*x*z^2 + 299/252*y*z^2 + 1/3*z^3\n", "x*y*z - 57/28*y^2*z\n", "\n", "85/42*x^3 - 71075/7056*x^2*y + 187255/16464*x*y^2 - 19175/5488*y^3 + 515/756*x^2*z + 27455/7056*x*y*z - 15265/4116*y^2*z - 1213/756*x*z^2 + 1871/3528*y*z^2 + 13/42*z^3\n", "113/28*x^2*z - 13105/3528*x*y*z - 13/588*y^2*z - 10831/2268*x*z^2 + 37595/10584*y*z^2 + 8/9*z^3\n", "x^2*z - 747/392*y^2*z - 67/27*x*z^2 + 299/126*y*z^2 + 2/3*z^3\n", "\n", "67/54*x^4 - 4583/1512*x^3*y + 265/392*x^2*y^2 + 2791/2744*x*y^3 - 209/343*y^4 - 4975/1458*x^3*z + 56167/4536*x^2*y*z - 73127/5292*x*y^2*z + 103759/18522*y^3*z + 134/81*x^2*z^2 - 1871/378*x*y*z^2 + 5681/1764*y^2*z^2 - 2/9*x*z^3 + 19/42*y*z^3\n", "1/2*x^4 - 57/28*x^3*y + 85/1764*x^2*y^2 + 2197/588*x*y^3 - 169/98*y^4 - 67/54*x^3*z + 14081/2268*x^2*y*z - 37609/5292*x*y^2*z + 3887/1764*y^3*z + 1/3*x^2*z^2 - 85/63*x*y*z^2 + 13/21*y^2*z^2\n", "x^3*y - 73/12*x^2*y^2 + 1979/196*x*y^3 - 741/196*y^4\n" ] } ], "source": [ "Extend(Inverse(phires));" ] }, { "cell_type": "code", "execution_count": 40, "id": "c6b44c3f-2053-4d0b-94dd-75b6810162d9", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "true\n" ] } ], "source": [ "IsNonsingular(C);" ] }, { "cell_type": "markdown", "id": "8ea9524d-42a8-4df7-aeba-4b4c597a6947", "metadata": { "tags": [] }, "source": [ "Some things Magma can do that are hard to find in other computer algebra packages\n", "----------------\n", " - Computations with finite groups, such as their character tables, cohomology, subgroups\n", " - Computations with elliptic curves over number fields" ] }, { "cell_type": "code", "execution_count": 41, "id": "a97ed869-7e24-446c-8471-6e183a50a5b0", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Permutation group G acting on a set of cardinality 8\n", "Order = 168 = 2^3 * 3 * 7\n", "(3, 6, 7)(4, 5, 8)\n", "(1, 8, 2)(4, 5, 6)\n" ] } ], "source": [ "G:=PSL(2,7);G;" ] }, { "cell_type": "code", "execution_count": 42, "id": "1361ec1b-e5b9-4c86-98d1-28fa5e1d9e22", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "\n", "Character Table of Group G\n", "--------------------------\n", "\n", "\n", "------------------------------\n", "Class | 1 2 3 4 5 6\n", "Size | 1 21 56 42 24 24\n", "Order | 1 2 3 4 7 7\n", "------------------------------\n", "p = 2 1 1 3 2 5 6\n", "p = 3 1 2 1 4 6 5\n", "p = 7 1 2 3 4 1 1\n", "------------------------------\n", "X.1 + 1 1 1 1 1 1\n", "X.2 0 3 -1 0 1 Z1 Z1#3\n", "X.3 0 3 -1 0 1 Z1#3 Z1\n", "X.4 + 6 2 0 0 -1 -1\n", "X.5 + 7 -1 1 -1 0 0\n", "X.6 + 8 0 -1 0 1 1\n", "\n", "\n", "Explanation of Character Value Symbols\n", "--------------------------------------\n", "\n", "# denotes algebraic conjugation, that is,\n", "#k indicates replacing the root of unity w by w^k\n", "\n", "Z1 = (CyclotomicField(7: Sparse := true)) ! [ RationalField() | 0, 1, 1, 0, 1, 0 ]\n", "\n", "\n" ] } ], "source": [ "CharacterTable(G);" ] }, { "cell_type": "code", "execution_count": 43, "id": "126de699-52dd-438e-b871-d6bf6d5131c4", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "Partially ordered set of subgroup classes\n", "-----------------------------------------\n", "\n", "[15] Order 168 Length 1 Maximal Subgroups: 9 13 14\n", "---\n", "[14] Order 24 Length 7 Maximal Subgroups: 8 10 11\n", "[13] Order 24 Length 7 Maximal Subgroups: 8 10 12\n", "---\n", "[12] Order 12 Length 7 Maximal Subgroups: 3 5\n", "[11] Order 12 Length 7 Maximal Subgroups: 3 6\n", "[10] Order 8 Length 21 Maximal Subgroups: 5 6 7\n", "---\n", "[ 9] Order 21 Length 8 Maximal Subgroups: 3 4\n", "[ 8] Order 6 Length 28 Maximal Subgroups: 2 3\n", "[ 7] Order 4 Length 21 Maximal Subgroups: 2\n", "[ 6] Order 4 Length 7 Maximal Subgroups: 2\n", "[ 5] Order 4 Length 7 Maximal Subgroups: 2\n", "---\n", "[ 4] Order 7 Length 8 Maximal Subgroups: 1\n", "[ 3] Order 3 Length 28 Maximal Subgroups: 1\n", "[ 2] Order 2 Length 21 Maximal Subgroups: 1\n", "---\n", "[ 1] Order 1 Length 1 Maximal Subgroups:\n", "\n" ] } ], "source": [ "SubgroupLattice(G);" ] }, { "cell_type": "code", "execution_count": 44, "id": "96b0b900-3a47-475b-a65a-f309fe6baaa9", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "M:=TrivialModule(G,GF(2));\n", "ch:=CohomologyModule(G,M);" ] }, { "cell_type": "code", "execution_count": 45, "id": "7114705f-1d61-48ed-bfcc-24730f6bc2f2", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Full Vector space of degree 1 over GF(2)\n" ] } ], "source": [ "CohomologyGroup(ch,2);" ] }, { "cell_type": "code", "execution_count": 46, "id": "55ccda62-aaac-46b8-8b39-df2fde577a49", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [] } ], "source": [ "R:=PolynomialRing(Rationals());\n", "C:=GenusOneModel(2*(x^4-17));" ] }, { "cell_type": "code", "execution_count": 47, "id": "c6599212-77f1-4414-b7d0-8c13e854ac1f", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "true (1 + O(17^20) : O(17^20) : -621139010588222429002458 + O(17^20))\n" ] } ], "source": [ "IsLocallySolvable(C,17);" ] }, { "cell_type": "code", "execution_count": 48, "id": "048ccc11-3be8-4438-ba3d-772a324082d9", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Elliptic Curve defined by y^2 = x^3 + 272*x over Rational Field\n" ] } ], "source": [ "E:=Jacobian(C);E;" ] }, { "cell_type": "code", "execution_count": 49, "id": "b193a1ea-71b3-4832-a809-1ad3f9f0d871", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0 true\n" ] } ], "source": [ "Rank(E);" ] }, { "cell_type": "code", "execution_count": 50, "id": "209b1f09-bbae-4a11-8265-d2420b25ef91", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Abelian Group isomorphic to Z/2 + Z/2 + Z/2\n", "Defined on 3 generators\n", "Relations:\n", "2*$.1 = 0\n", "2*$.2 = 0\n", "2*$.3 = 0\n", "Mapping from: Univariate Quotient Polynomial Algebra in theta over Rational Field\n", "with modulus theta^3 + 17*theta to Abelian Group isomorphic to Z/2 + Z/2 + Z/2\n", "Defined on 3 generators\n", "Relations:\n", "2*$.1 = 0\n", "2*$.2 = 0\n", "2*$.3 = 0 given by a rule\n" ] } ], "source": [ "TwoSelmerGroup(E);" ] }, { "cell_type": "code", "execution_count": 51, "id": "e8dde786-bc94-4ec2-a332-25c8038f376b", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2 true\n" ] } ], "source": [ "Rank(QuadraticTwist(E,2));" ] }, { "cell_type": "code", "execution_count": 52, "id": "75709ff4-425d-4582-9e2e-8098ee239793", "metadata": { "tags": [] }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2 true\n" ] } ], "source": [ "Rank(BaseChange(E,QuadraticField(2)));" ] }, { "cell_type": "code", "execution_count": null, "id": "81a8631c-c7d4-4a42-97c6-25f3633097ae", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Magma", "language": "magma", "name": "magma" }, "language_info": { "codemirror_mode": "magma", "file_extension": ".m", "mimetype": "text/x-magma", "name": "magma", "version": "2.26-12" } }, "nbformat": 4, "nbformat_minor": 5 }