Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] Update book examples #4205

Merged
merged 8 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ jobs:
# be able to properly deal with PRs / merges
fetch-depth: 2
- name: "Set up Julia"
uses: julia-actions/setup-julia@v1
id: setup-julia
uses: julia-actions/setup-julia@v2
with:
version: ${{ matrix.julia-version }}
- uses: julia-actions/cache@v1
Expand All @@ -89,6 +90,9 @@ jobs:
- name: "set test subgroup"
if: ${{ matrix.group }} != ''
run: echo "OSCAR_TEST_SUBSET=${{matrix.group}}" >> $GITHUB_ENV
- name: "workaround libstdc++ issue for julia 1.6"
if: matrix.julia-version == '1.6' && runner.os == 'Linux'
run: rm -f ${{ steps.setup-julia.outputs.julia-bindir }}/../lib/julia/libstdc++.so.6
- name: "Run tests"
uses: julia-actions/julia-runtest@latest
with:
Expand Down
20 changes: 10 additions & 10 deletions test/book/cornerstones/algebraic-geometry/exres.jlcon
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
julia> R, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> S, (w, x, y, z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);

julia> I = ideal([w^2-x*z,w*x-y*z,x^2-w*y,x*y-z^2,y^2-w*z]);
julia> J = ideal([w^2-x*z,w*x-y*z,x^2-w*y,x*y-z^2,y^2-w*z]);

julia> A, _ = quo(R, I);
julia> A, _ = quo(S, J);

julia> FA = free_resolution(A)
Free resolution of A
R^1 <---- R^5 <---- R^6 <---- R^2 <---- 0
S^1 <---- S^5 <---- S^6 <---- S^2 <---- 0
0 1 2 3 4

julia> FA[1]
Graded free module R^5([-2]) of rank 5 over R
Graded free module S^5([-2]) of rank 5 over S

julia> FA[2]
Graded free module R^5([-3]) + R^1([-4]) of rank 6 over R
Graded free module S^5([-3]) + S^1([-4]) of rank 6 over S

julia> FA[3]
Graded free module R^1([-4]) + R^1([-5]) of rank 2 over R
Graded free module S^1([-4]) + S^1([-5]) of rank 2 over S

julia> map(FA,1)
R^5 -> R^1
S^5 -> S^1
e[1] -> (-w*z + y^2)*e[1]
e[2] -> (x*y - z^2)*e[1]
e[3] -> (-w*y + x^2)*e[1]
Expand All @@ -28,7 +28,7 @@ e[5] -> (w^2 - x*z)*e[1]
Homogeneous module homomorphism

julia> map(FA,2)
R^6 -> R^5
S^6 -> S^5
e[1] -> -x*e[1] + y*e[2] - z*e[4]
e[2] -> w*e[1] - x*e[2] + y*e[3] + z*e[5]
e[3] -> -w*e[3] + x*e[4] - y*e[5]
Expand All @@ -38,7 +38,7 @@ e[6] -> (-w^2 + x*z)*e[1] + (-w*z + y^2)*e[5]
Homogeneous module homomorphism

julia> map(FA,3)
R^2 -> R^6
S^2 -> S^6
e[1] -> -w*e[2] - y*e[3] + x*e[4] - e[6]
e[2] -> (-w^2 + x*z)*e[1] + y*z*e[2] + z^2*e[3] - w*y*e[4] + (w*z - y^2)*e[5] + x*e[6]
Homogeneous module homomorphism
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
julia> R, (w,x,y,z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);
julia> S, (w,x,y,z) = graded_polynomial_ring(QQ, ["w", "x", "y", "z"]);

julia> I = ideal(R, [x*w-y*z, y*w-(x-z)*(x-2*z)]);
julia> I = ideal(S, [x*w-y*z, y*w-(x-z)*(x-2*z)]);

julia> Q = projective_scheme(I);

Expand Down
13 changes: 5 additions & 8 deletions test/book/cornerstones/groups/actions.jlcon
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ G-set of
Alt(4)
with seeds 1:4

julia> G = dihedral_group(6)
Pc group of order 6
julia> G = dihedral_group(6);

julia> U = sub(G, [g for g in gens(G) if order(g) == 2])[1]
Pc group of order 2
Expand Down Expand Up @@ -37,7 +36,7 @@ Group homomorphism
julia> phi(G[1]), phi(G[2])
((2,3), (1,2,3))

julia> function optimal_perm_rep(G)
julia> function optimal_transitive_perm_rep(G)
is_natural_symmetric_group(G) && return hom(G,G,gens(G))
is_natural_alternating_group(G) && return hom(G,G,gens(G))
cand = [] # pairs (U,h) with U ≤ G and h a map G -> Sym(G/U)
Expand All @@ -52,7 +51,7 @@ julia> function optimal_perm_rep(G)
julia> U = dihedral_group(8)
Pc group of order 8

julia> optimal_perm_rep(U)
julia> optimal_transitive_perm_rep(U)
Group homomorphism
from pc group of order 8
to permutation group of degree 4 and order 8
Expand All @@ -65,8 +64,8 @@ Group homomorphism
julia> permutation_group(U)
Permutation group of degree 8 and order 8

julia> for g in all_transitive_groups(degree => 3:9, !is_primitive)
h = image(optimal_perm_rep(g))[1]
julia> for g in all_transitive_groups(degree => 3:8, !is_primitive)
h = image(optimal_transitive_perm_rep(g))[1]
if degree(h) < degree(g)
id = transitive_group_identification(g)
id_new = transitive_group_identification(h)
Expand All @@ -81,5 +80,3 @@ julia> for g in all_transitive_groups(degree => 3:9, !is_primitive)
(8, 13) => (6, 6)
(8, 14) => (4, 5)
(8, 24) => (6, 11)
(9, 4) => (6, 5)
(9, 8) => (6, 9)
4 changes: 1 addition & 3 deletions test/book/cornerstones/groups/auxiliary_code/main.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import Pkg
Pkg.add(name="GenericCharacterTables", version=v"0.2"; io=devnull)
Pkg.add(name="GenericCharacterTables", version="0.4"; io=devnull)
using GenericCharacterTables
# for nicer printing
using GenericCharacterTables: ParameterException
99 changes: 51 additions & 48 deletions test/book/cornerstones/groups/genchar.jlcon
Original file line number Diff line number Diff line change
@@ -1,63 +1,66 @@
julia> T = genchartab("SL3.n1")
Generic character table
julia> T = generic_character_table("SL3.n1")
Generic character table SL3.n1
of order q^8 - q^6 - q^5 + q^3
with 8 irreducible character types
with 8 class types
with parameters (a, b, m, n)

julia> printval(T,char=4,class=4)
Value of character type 4 on class type
4: (q + 1) * exp(2π𝑖(1//(q - 1)*a*n)) + (1) * exp(2π𝑖(-2//(q - 1)*a*n))

julia> h = tensor!(T,2,2)
9

julia> scalar(T,4,h)
(0, Set(ParameterException{QQPolyRingElem}[(2*n1)//(q - 1) ∈ ℤ]))

julia> print_decomposition(T, h)
Decomposing character 9:
<1,9> = 1
<2,9> = 2
<3,9> = 2
<4,9> = 0 with possible exceptions:
(2*n1)//(q - 1) ∈ ℤ
<5,9> = 0 with possible exceptions:
(2*n1)//(q - 1) ∈ ℤ
<6,9> = 0 with possible exceptions:
(m1 + n1)//(q - 1) ∈ ℤ
(2*m1 - n1)//(q - 1) ∈ ℤ
(m1)//(q - 1) ∈ ℤ
(n1)//(q - 1) ∈ ℤ
(m1 - n1)//(q - 1) ∈ ℤ
(m1 - 2*n1)//(q - 1) ∈ ℤ
<7,9> = 0 with possible exceptions:
(n1)//(q - 1) ∈ ℤ
<8,9> = 0 with possible exceptions:
((q + 1)*n1)//(q^2 + q + 1) ∈ ℤ
(q*n1)//(q^2 + q + 1) ∈ ℤ
(n1)//(q^2 + q + 1) ∈ ℤ
julia> chardeg(T, lincomb!(T,[1,2,2],[1,2,3]))
julia> T[4,4]
(q + 1)*exp(2π𝑖((a*n)//(q - 1))) + exp(2π𝑖((-2*a*n)//(q - 1)))

julia> h = T[2] * T[2];

julia> scalar_product(T[4], h)
0
With exceptions:
2*n1 ∈ (q - 1)ℤ

julia> for i in 1:8 println("<$i, h> = ", scalar_product(T[i], h)) end
<1, h> = 1
<2, h> = 2
<3, h> = 2
<4, h> = 0
With exceptions:
2*n1 ∈ (q - 1)ℤ
<5, h> = 0
With exceptions:
2*n1 ∈ (q - 1)ℤ
<6, h> = 0
With exceptions:
2*m1 - n1 ∈ (q - 1)ℤ
m1 - 2*n1 ∈ (q - 1)ℤ
m1 + n1 ∈ (q - 1)ℤ
m1 ∈ (q - 1)ℤ
m1 - n1 ∈ (q - 1)ℤ
n1 ∈ (q - 1)ℤ
<7, h> = 0
With exceptions:
n1 ∈ (q - 1)ℤ
<8, h> = 0
With exceptions:
q*n1 ∈ (q^2 + q + 1)ℤ
n1 ∈ (q^2 + q + 1)ℤ
q*n1 + n1 ∈ (q^2 + q + 1)ℤ

julia> degree(linear_combination([1,2,2],[T[1],T[2],T[3]]))
2*q^3 + 2*q^2 + 2*q + 1

julia> chardeg(T, h)
julia> degree(h)
q^4 + 2*q^3 + q^2

julia> printcharparam(T,4)
4 n ∈ {1,…, q - 1} except (n)//(q - 1)
julia> parameters(T[4])
n ∈ {1,…, q - 1} except n ∈ (q - 1)ℤ

julia> T2 = setcongruence(T, (0,2));
julia> T2 = set_congruence(T; remainder=0, modulus=2);

julia> (q, (a, b, m, n)) = params(T2);
julia> (q, (a, b, m, n)) = parameters(T2);

julia> x = param(T2, "x"); # create an additional "free" variable
julia> x = parameter(T2, "x"); # create an additional "free" variable

julia> speccharparam!(T2, 6, m, -n + (q-1)*x) # force m = -n (mod q-1)
julia> s = specialize(T2[6], m, -n + (q-1)*x); # force m = -n (mod q-1)

julia> s, e = scalar(T2,6,h); s
julia> scalar_product(s, T2(h))
1

julia> e
Set{ParameterException{QQPolyRingElem}} with 2 elements:
(2*n1)//(q - 1) ∈ ℤ
(3*n1)//(q - 1) ∈ ℤ
With exceptions:
3*n1 ∈ (q - 1)ℤ
2*n1 ∈ (q - 1)ℤ
8 changes: 1 addition & 7 deletions test/book/cornerstones/groups/intro.jlcon
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,7 @@ julia> pts = collect(orb)

julia> visualize(convex_hull(pts))

julia> R2 = free_module(K, 2) # the "euclidean" plane over K
Vector space of dimension 2 over field of algebraic numbers

julia> A = R2([0,1])
(Root 0 of x, Root 1.00000 of x - 1)

julia> pts = [A*mat_rot^i for i in 0:4];
julia> R2 = vector_space(K, 2); # the "euclidean" plane over K

julia> sigma_1 = hom(R2, R2, [-R2[1], R2[2]])
Module homomorphism
Expand Down
4 changes: 2 additions & 2 deletions test/book/cornerstones/number-theory/galoismod.jlcon
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ true

julia> V, f = galois_module(K); OK = ring_of_integers(K); M = f(OK);

julia> fl, c = is_free_with_basis(M); # the elements of c are a basis
julia> fl, c = is_free_with_basis(M); # the elements of c form a basis

julia> b = preimage(f, c[1]) # the element might different per session
julia> b = preimage(f, c[1]) # the element may be different per session
a

julia> A, mA = automorphism_group(K);
Expand Down
2 changes: 1 addition & 1 deletion test/book/cornerstones/number-theory/intro.jlcon
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,4 @@ julia> preimage(mU, -214841715*a - 3293461126)
Abelian group element [1, 5]

julia> -214841715*a - 3293461126 == (-1)^1 * (3a + 46)^5
true
true
3 changes: 1 addition & 2 deletions test/book/cornerstones/polyhedral-geometry/GKZ_orbits.jlcon
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ julia> OrbitRepresentatives=
julia> OrbitSizes =
[length(
filter(x->minimum(gset(G,permuted,[x]))==u,
GKZ_Vectors)
) for u in OrbitRepresentatives];
GKZ_Vectors)) for u in OrbitRepresentatives];

julia> show(OrbitSizes)
[12, 24, 24, 8, 2, 4]
3 changes: 2 additions & 1 deletion test/book/cornerstones/polyhedral-geometry/platonic.jlcon
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
julia> [ f_vector(P) for P in [T, cube(3), cross_polytope(3), dodecahedron(), icosahedron()] ]
julia> [ f_vector(P) for P in [T, cube(3), cross_polytope(3),
dodecahedron(), icosahedron()] ]
5-element Vector{Vector{ZZRingElem}}:
[4, 6, 4]
[8, 12, 6]
Expand Down
Loading
Loading