# AbstractAlgebra.jl examples¶

We begin by starting up the AbstractAlgebra.jl module.

In :
using AbstractAlgebra

INFO: Precompiling module AbstractAlgebra.

Welcome to AbstractAlgebra version 0.0.8

AbstractAlgebra comes with absolutely no warranty whatsoever



## Univariate polynomials¶

In :
R, x = PolynomialRing(ZZ, "x")

Out:
(Univariate Polynomial Ring in x over Integers, x)

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

In :
p = rand(R, 5:5, -10:10)

Out:
5*x^5-4*x^4+5*x^3-8*x^2+6*x+8
In :
q = rand(R, 5:5, -10:10)

Out:
10*x^5+5*x^4-8*x^2-x+1
In :
r = resultant(p, q)

Out:
-8196951635

## Multivariate polynomials¶

In :
R = ResidueField(ZZ, 65537) # R = Z/65537Z

Out:
Residue field of Integers modulo 65537
In :
S, (x, y) = PolynomialRing(R, ["x", "y"])

Out:
(Multivariate Polynomial Ring in x, y over Residue field of Integers modulo 65537, AbstractAlgebra.Generic.MPoly{AbstractAlgebra.Generic.ResF{BigInt}}[x, y])
In :
f = 1 + x + y

Out:
x+y+1
In :
g = f^5;

In :
h = g*(g + 1);

In :
length(h)

Out:
66

## Matrices¶

In :
R, x = PolynomialRing(QQ, "x")
K = ResidueField(R, x^3 + 3x + 1) # Number field

Out:
Residue field of Univariate Polynomial Ring in x over Rationals modulo x^3+3//1*x+1//1
In :
S = MatrixSpace(K, 3, 3)
M = rand(S, 2:2, -10:10)

Out:
[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 :
U, t = PolynomialRing(K, "t")
p = minpoly(U, M) # compute minimum polynomial of M

Out:
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 :
D = det(M)

Out:
-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 :
R = ResidueField(ZZ, 23)

Out:
Residue field of Integers modulo 23
In :
S, y = PolynomialRing(R, "y")

Out:
(Univariate Polynomial Ring in y over Residue field of Integers modulo 23, y)
In :
T = ResidueRing(S, y^3 + 3y + 1)

Out:
Residue ring of Univariate Polynomial Ring in y over Residue field of Integers modulo 23 modulo y^3+3*y+1
In :
U, z = PolynomialRing(T, "z")

Out:
(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 :
p = rand(U, 2:2, 5:5, -10:10); q = rand(U, 2:2, 5:5, -10:10);

In :
s = resultant(p, q)

Out:
4*y^2+10

## Puiseux series¶

We verify an identity on Weber functions

Work to an internal precision of 1000 terms

In :
R, q = PuiseuxSeriesRing(ZZ, 1000 , "q" )

Out:
(Puiseux series ring in q over Integers, q+O(q^1001))

Define the Dedekind eta function

In :
eta_qexp(q) = prod(1 - q^n for n = 1:50)*q^(1//24)

Out:
eta_qexp (generic function with 1 method)

Define one of the Weber modular functions

In :
f1(q) = divexact(eta_qexp(q^(1//2)), eta_qexp(q))

Out:
f1 (generic function with 1 method)

Define two Puiseux series in terms of the Weber function

In :
A = divexact(f1(q)^2, f1(q^20)^2)
B = divexact(f1(q^2)^2, f1(q^10)^2)

Out:
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 :
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:
0+O(q^163//6)