Julia中的对称群作用

Julia中的对称群作用,julia,Julia,我是新来的朱莉娅。我想做一个可以使用集体行动的程序 < P>:取向量$(a,b,c,d)$ $ $MaTbB{r}^ { 4 } $,并考虑$ S{{ 4 } $上的元素的动作,例如循环$(1,2,3,4)$。我想要一个程序来计算: $$(1,2,3,4)(a,b,c,d)=(d,a,b,c)$$ 这将是伟大的,如果这将是可能的任何排列。你知道我必须下载哪些软件包吗?我该怎么写呢 谢谢您的帮助。您可能会喜欢软件包排列 julia> using Permutations julia>

我是新来的朱莉娅。我想做一个可以使用集体行动的程序

< P>:取向量$(a,b,c,d)$ $ $MaTbB{r}^ { 4 } $,并考虑$ S{{ 4 } $上的元素的动作,例如循环$(1,2,3,4)$。我想要一个程序来计算:

$$(1,2,3,4)(a,b,c,d)=(d,a,b,c)$$

这将是伟大的,如果这将是可能的任何排列。你知道我必须下载哪些软件包吗?我该怎么写呢


谢谢您的帮助。

您可能会喜欢软件包排列

julia> using Permutations

julia> p = Permutation([2,3,4,1]) # an element of S_4
(1,2,3,4)                         # printed in cycle notation

julia> p(1)  # apply it to one element
2

julia> two_row(p)  # alternative way to print this
2×4 Matrix{Int64}:
 1  2  3  4
 2  3  4  1

julia> inv(p)
(1,4,3,2)

julia> input = [:a, :b, :c, :d];  # an array of any 4 things

julia> [input[p(i)] for i in eachindex(input)]  # permute those?
4-element Vector{Symbol}:
 :b
 :c
 :d
 :a

julia> ans == input[p.(eachindex(input))]  # another way to write the same
true

julia> input[inv(p).(eachindex(input))]  # with inv(p)
4-element Vector{Symbol}:
 :d
 :a
 :b
 :c

julia> Permutation([2,3,1,4,6,5])
(1,2,3)(4)(5,6)                   # it really prints the cycles