1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-25 18:15:29 +01:00

allow numbers > 9 in subscriptify

This commit is contained in:
kalmarek 2020-10-07 02:33:58 +02:00
parent 2674652221
commit 873361af73
No known key found for this signature in database
GPG Key ID: 8BF1A3855328FC15

View File

@ -35,9 +35,7 @@ end
# https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md # https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md
function subscriptify(n::Integer) function subscriptify(n::Integer)
subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0 subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0
@assert 0 <= n <= 9 return join([Char(subscript_0 + i) for i in reverse(digits(n))], "")
return Char(subscript_0 + n)
# return [Char(subscript_0 + i) for i in reverse(digits(n))])
end end
function id_autsymbol() function id_autsymbol()
@ -45,18 +43,26 @@ function id_autsymbol()
end end
function transvection_R(i::Integer, j::Integer, pow::Integer=1) function transvection_R(i::Integer, j::Integer, pow::Integer=1)
id = Symbol("ϱ", subscriptify(i), subscriptify(j)) if 0 < i < 10 && 0 < j < 10
id = Symbol(:ϱ, subscriptify(i), subscriptify(j))
else
id = Symbol(:ϱ, subscriptify(i), "." ,subscriptify(j))
end
return AutSymbol(id, pow, RTransvect(i, j)) return AutSymbol(id, pow, RTransvect(i, j))
end end
function transvection_L(i::Integer, j::Integer, pow::Integer=1) function transvection_L(i::Integer, j::Integer, pow::Integer=1)
id = Symbol("λ", subscriptify(i), subscriptify(j)) if 0 < i < 10 && 0 < j < 10
id = Symbol(, subscriptify(i), subscriptify(j))
else
id = Symbol(, subscriptify(i), "." ,subscriptify(j))
end
return AutSymbol(id, pow, LTransvect(i, j)) return AutSymbol(id, pow, LTransvect(i, j))
end end
function flip(i::Integer, pow::Integer=1) function flip(i::Integer, pow::Integer=1)
iseven(pow) && return id_autsymbol() iseven(pow) && return id_autsymbol()
id = Symbol("ɛ", subscriptify(i)) id = Symbol(, subscriptify(i))
return AutSymbol(id, 1, FlipAut(i)) return AutSymbol(id, 1, FlipAut(i))
end end
@ -66,7 +72,7 @@ function AutSymbol(p::Generic.Perm, pow::Integer=1)
end end
if any(p.d[i] != i for i in eachindex(p.d)) if any(p.d[i] != i for i in eachindex(p.d))
id = Symbol("σ", "", [subscriptify(i) for i in p.d]..., "") id = Symbol(:σ, "", join([subscriptify(i) for i in p.d],""), "")
return AutSymbol(id, 1, PermAut(p)) return AutSymbol(id, 1, PermAut(p))
end end
return id_autsymbol() return id_autsymbol()
@ -78,9 +84,8 @@ end
σ(v::Generic.Perm, pow::Integer=1) = AutSymbol(v, pow) σ(v::Generic.Perm, pow::Integer=1) = AutSymbol(v, pow)
function change_pow(s::AutSymbol, n::Integer) function change_pow(s::AutSymbol, n::Integer)
if n == zero(n) iszero(n) && id_autsymbol()
return id_autsymbol()
end
symbol = s.fn symbol = s.fn
if symbol isa FlipAut if symbol isa FlipAut
return flip(symbol.i, n) return flip(symbol.i, n)