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:
parent
2674652221
commit
873361af73
@ -35,9 +35,7 @@ end
|
||||
# https://github.com/JuliaIntervals/ValidatedNumerics.jl/blob/master/LICENSE.md
|
||||
function subscriptify(n::Integer)
|
||||
subscript_0 = Int(0x2080) # Char(0x2080) -> subscript 0
|
||||
@assert 0 <= n <= 9
|
||||
return Char(subscript_0 + n)
|
||||
# return [Char(subscript_0 + i) for i in reverse(digits(n))])
|
||||
return join([Char(subscript_0 + i) for i in reverse(digits(n))], "")
|
||||
end
|
||||
|
||||
function id_autsymbol()
|
||||
@ -45,18 +43,26 @@ function id_autsymbol()
|
||||
end
|
||||
|
||||
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))
|
||||
end
|
||||
|
||||
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))
|
||||
end
|
||||
|
||||
function flip(i::Integer, pow::Integer=1)
|
||||
iseven(pow) && return id_autsymbol()
|
||||
id = Symbol("ɛ", subscriptify(i))
|
||||
id = Symbol(:ɛ, subscriptify(i))
|
||||
return AutSymbol(id, 1, FlipAut(i))
|
||||
end
|
||||
|
||||
@ -66,7 +72,7 @@ function AutSymbol(p::Generic.Perm, pow::Integer=1)
|
||||
end
|
||||
|
||||
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))
|
||||
end
|
||||
return id_autsymbol()
|
||||
@ -78,9 +84,8 @@ end
|
||||
σ(v::Generic.Perm, pow::Integer=1) = AutSymbol(v, pow)
|
||||
|
||||
function change_pow(s::AutSymbol, n::Integer)
|
||||
if n == zero(n)
|
||||
return id_autsymbol()
|
||||
end
|
||||
iszero(n) && id_autsymbol()
|
||||
|
||||
symbol = s.fn
|
||||
if symbol isa FlipAut
|
||||
return flip(symbol.i, n)
|
||||
|
Loading…
Reference in New Issue
Block a user