AbstractAlgebra.jl examples

We begin by starting up the AbstractAlgebra.jl module.

In [1]:
using AbstractAlgebra
INFO: Precompiling module AbstractAlgebra.
Welcome to AbstractAlgebra version 0.0.8

AbstractAlgebra comes with absolutely no warranty whatsoever

Univariate polynomials

In [2]:
R, x = PolynomialRing(ZZ, "x")
Out[2]:
(Univariate Polynomial Ring in x over Integers, x)

Create a random polynomial of degree 5 with integer coefficients in [-10, 10]

In [3]:
p = rand(R, 5:5, -10:10)
Out[3]:
5*x^5-4*x^4+5*x^3-8*x^2+6*x+8
In [4]:
q = rand(R, 5:5, -10:10)
Out[4]:
10*x^5+5*x^4-8*x^2-x+1
In [5]:
r = resultant(p, q)
Out[5]:
-8196951635

Multivariate polynomials

In [6]:
R = ResidueField(ZZ, 65537) # R = Z/65537Z
Out[6]:
Residue field of Integers modulo 65537
In [7]:
S, (x, y) = PolynomialRing(R, ["x", "y"])
Out[7]:
(Multivariate Polynomial Ring in x, y over Residue field of Integers modulo 65537, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.ResF{BigInt}}[x, y])
In [8]:
f = 1 + x + y
Out[8]:
x+y+1
In [9]:
g = f^5;
In [10]:
h = g*(g + 1);
In [11]:
length(h)
Out[11]:
66

Matrices

In [12]:
R, x = PolynomialRing(QQ, "x")
K = ResidueField(R, x^3 + 3x + 1) # Number field
Out[12]:
Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3+3//1*x+1//1
In [13]:
S = MatrixSpace(K, 3, 3)
M = rand(S, 2:2, -10:10)
Out[13]:
[3//10*x^2+1//3*x+3//5 1//2*x^2-1//3*x+6//1 -4//5*x^2+2//7*x+1//1]
[1//2*x^2+x-7//6 -1//3*x^2+9//5*x+5//1 -7//6*x^2+3//2*x-5//3]
[5//2*x^2+1//2*x-1//6 -7//2*x^2-8//3*x+7//8 -7//10*x^2-8//7*x-4//3]
In [14]:
U, t = PolynomialRing(K, "t")
p = minpoly(U, M) # compute minimum polynomial of M
Out[14]:
t^3+(11//15*x^2-104//105*x-64//15)*t^2+(-71963//25200*x^2-91127//5040*x+46537//12600)*t+(8446987//756000*x^2-1399517//27000*x-269947//36000)
In [15]:
D = det(M)
Out[15]:
-8446987//756000*x^2+1399517//27000*x+269947//36000

Generic tower

We will compute with a polynomial ring over a residue ring over a polynomial ring over a finite field

In [16]:
R = ResidueField(ZZ, 23)
Out[16]:
Residue field of Integers modulo 23
In [17]:
S, y = PolynomialRing(R, "y")
Out[17]:
(Univariate Polynomial Ring in y over Residue field of Integers modulo 23, y)
In [18]:
T = ResidueRing(S, y^3 + 3y + 1)
Out[18]:
Residue ring of Univariate Polynomial Ring in y over Residue field of Integers modulo 23 modulo y^3+3*y+1
In [19]:
U, z = PolynomialRing(T, "z")
Out[19]:
(Univariate Polynomial Ring in z over Residue ring of Univariate Polynomial Ring in y over Residue field of Integers modulo 23 modulo y^3+3*y+1, z)
In [20]:
p = rand(U, 2:2, 5:5, -10:10); q = rand(U, 2:2, 5:5, -10:10);
In [21]:
s = resultant(p, q)
Out[21]:
4*y^2+10

Puiseux series

We verify an identity on Weber functions

Work to an internal precision of 1000 terms

In [22]:
R, q = PuiseuxSeriesRing(ZZ, 1000 , "q" )
Out[22]:
(Puiseux series ring in q over Integers, q+O(q^1001))

Define the Dedekind eta function

In [23]:
eta_qexp(q) = prod(1 - q^n for n = 1:50)*q^(1//24)
Out[23]:
eta_qexp (generic function with 1 method)

Define one of the Weber modular functions

In [24]:
f1(q) = divexact(eta_qexp(q^(1//2)), eta_qexp(q))
Out[24]:
f1 (generic function with 1 method)

Define two Puiseux series in terms of the Weber function

In [25]:
A = divexact(f1(q)^2, f1(q^20)^2)
B = divexact(f1(q^2)^2, f1(q^10)^2)
Out[25]:
q^1//3-2*q^4//3+q^7//3-2*q^10//3+4*q^13//3-2*q^16//3+q^19//3-4*q^22//3+5*q^25//3-4*q^28//3+8*q^31//3-12*q^34//3+12*q^37//3-14*q^40//3+17*q^43//3-16*q^46//3+17*q^49//3-24*q^52//3+25*q^55//3-28*q^58//3+42*q^61//3+O(q^127//6)

Verify an identity between A and B to the maximum available precision

In [26]:
A^8*(B^18 + 2B^15 + 255B^12 - 580B^9 + 255B^6 - 30B^3 + 1 - 256A^8*B^11 + 256A^4*B^7) + 16A^4*B^11 - B^19
Out[26]:
0+O(q^163//6)