CoCalc Logo Icon
DocsShareSupportNewsSign UpSign In
| Download
Project: AGNES
Views: 57
Visibility: Unlisted (only visible to those who know the link)
Image: ubuntu2204
Kernel: Magma

Quick overview of computational geometry in Magma

If you encounter any problem, please share it with us via the form

What is Magma?

Magma is a computer algebra system for computations in algebra, number theory, and geometry.

(A magma, in the sense of Bourbaki, is a set with binary operation.)

We strive to provide:

  • a mathematically rigorous environment, with

  • highly efficient algorithms and implementations.

Magma consists of a large C kernel to achieve efficiency, and an ever increasing package of library functions programmed in the Magma language for higher level functions.

http://magma.maths.usyd.edu.au/magma/handbook/

The Magma model

The Magma model is based on concepts from category theory.

  • Every object belongs to a (unique, extended) category, a class of objects belonging to a variety that share the same representation.

  • Every object has a (unique) parent structure, describing the mathematical context in which it is viewed.

  • Univariate and multivariate polynomial ring form the categories RngUPol and RngMPol (which lie in the variety Rng). Univariate polynomials over the integers form an extended category RngUPol[RngInt]. The parent of a univariate polynomial is its polynomial ring.

Schemes

In this example we write down a monomial scheme and analyze the basic properties of its components.

// Declare affine 3-space over the rationals. A<x,y,z> := AffineSpace(Rationals(),3); A;
// Define the subscheme of A defined by a sequence of polynomials. X := Scheme(A,[x*y^2,x^4*z]); X;
// Invariants and predicates. Dimension(X); IsReduced(X); Xprim := PrimaryComponents(X); Xprim;
// Xprim is a sequence of components; to access elements, use brackets. Xprim[1]; PrimeComponents(X); Xred, f := ReducedSubscheme(X); Xred;
// f is the inclusion map f:Xred -> X. f; AmbientSpace(X);
// Comparison in Magma is "eq" AmbientSpace(X) eq A; I := DefiningIdeal(X); I;
// The ring containing I. R := Generic(I); R;
// Define a subscheme of projective space. Proj(R/I);

Groebner bases

// We compute the Groebner basis of the "Cyclic-6" ideal with respect // to the lexicographical order. P<x,y,z,t,u,v> := PolynomialRing(Rationals(), 6); P; // Declare the ideal. I := ideal<P | x + y + z + t + u + v, x*y + y*z + z*t + t*u + u*v + v*x, x*y*z + y*z*t + z*t*u + t*u*v + u*v*x + v*x*y, x*y*z*t + y*z*t*u + z*t*u*v + t*u*v*x + u*v*x*y + v*x*y*z, x*y*z*t*u + y*z*t*u*v + z*t*u*v*x + t*u*v*x*y + u*v*x*y*z + v*x*y*z*t, x*y*z*t*u*v - 1>;
// Declare the ideal in a more clever way. sigma := hom<P -> P | [y,z,t,u,v,x]>; sigma(x); gens := [ &+[ (sigma^i)(m) : i in [1..6] ] : m in [x,x*y,x*y*z,x*y*z*t,x*y*z*t*u] ] cat [x*y*z*t*u*v - 1]; gens eq Generators(I);
// Compute a Groebner basis time gb := GroebnerBasis(I); #gb;
// Now we can compute dimension Dimension(I);
// Since the ideal is zero-dimensional and the monomial order is lex, // the last polynomial in the lex Groebner basis is univariate. gb[17]; time Factorization(gb[17]); Roots(UnivariatePolynomial(gb[17]), ComplexField());
// Now compute the elimination ideal of I which eliminates // variables 1 through 4. EliminationIdeal(I, 4);
// We write a "short" function for creating the cyclic n-ideal. function CyclicNIdeal(n); P := PolynomialRing(Rationals(), n); sigma := hom<P -> P | [P.i : i in [2..n] cat [1]]>; monoms := [P.1]; for i := 2 to n do Append(~monoms, monoms[i-1]*P.i); end for; gens := [ &+[ (sigma^i)(m) : i in [1..n] ] : m in monoms[1..n-1] ] cat [ monoms[n] - 1]; return ideal<P | gens>; end function;
CyclicNIdeal(7);
// Instruct the Faugere algorithm to be chatty so we can watch // the progression of the computation. SetVerbose("Groebner", 1); time gb := GroebnerBasis(CyclicNIdeal(7)); gb[#gb]; // Turn verbosity off! SetVerbose("Groebner", 0);
SetNthreads(1); // 80-variable HFE mutlivariable polynomial system over GF(2) B := HFESystem(2, 80, 100); Universe(B); SetShowRealTime(true); time gbHFE := GroebnerBasis(B ,4 : HFE, ReductionHeuristic := 1000); SetNthreads(8); time gbHFE := GroebnerBasis(B ,4 : HFE, ReductionHeuristic := 1000); SetShowRealTime(false);
// Magma can work with many different kinds of term orders and ground rings. Z := IntegerRing(); // Construct polynomial ring with weight order and x > y > z P<a,b,c> := PolynomialRing(Z, 3, "weight", [4,2,1, 1,2,3, 1,1,1]); (a+b^2+c^3)^4;

Resolution graph of a curve singularity

// First make a curve with a singularity A<x,y> := AffineSpace(Rationals(),2); C := Curve(A,(x^2 - y^3)^2 + x*y^6); C;
// The interesting singularity is at the origin. // Calculate the resolution graph of this singularity and display it. g := ResolutionGraph(C, Origin(A)); g; // The resulting graph has 6 vertices. So the transverse resolution // of this singularity is achieved by 6 blowups. // In brackets, each vertex has a label of the form [s, m, k, t], where: // s is the self-intersection; // m is the multiplicity (dependent on context); // k is the canonical multiplicity; // t is the number of transverse intersections at v.
Genus(C);
A<x,y> := AffineSpace(Rationals(),2); X := Scheme(A, [(x^2 - y^3)^2 + x*y^6]); pt := X!Origin(A); X1, m1 := Blowup(X, pt); S := IrreducibleComponents(SingularSubscheme(X1)); Blowup(X1, X1 meet S[1]);

What else?

A<x,y> := AffineSpace(Rationals(),2); C := Curve(A,(x^2 - y^3)^2 + x*y^6); PC<x,y,z> := ProjectiveClosure(C); PC; conic<x,y,z>, m := Conic(PC); conic; "#"^30; m;