How to write disjoint cycles in matlab?

조회 수: 3 (최근 30일)
lilly lord
lilly lord 2021년 8월 2일
a and b are from S-16 permutation written as disjoint cycle
a=(1 3 5 7 9 11) b=(2 4 6 8 10 12 14) .
%disjoint cycles a=(1 3 5 7 9 11),b=(2 4 6 8 10 12 14 16)
a=[1:16;11 2 1 4 3 6 5 8 7 10 9 12 13 14 15 16];%missing numbers in 'a' are fixed
b=[1:16;1 16 3 2 5 4 7 6 9 8 11 10 13 12 15 14];% missing numbers in 'b' are fixed
It is easy to write disjoint cycles as written above but for large matrices for example for any permutation of 200 elements, writing fixed points (which may not be even or odd permutations)are very difficult . Can we do it in matlab to write fixed points automatically. For example i am talking a permutation
P=[1:200;1,3,15,13] % only four points are moving the rest are fixed. so how can it be done in matlab. Thanks for any help in advance

답변 (0개)

카테고리

Help CenterFile Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by