How to write disjoint cycles in matlab?

2 views (last 30 days)
lilly lord
lilly lord on 2 Aug 2021
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

Answers (0)

Categories

Find more on Resizing and Reshaping Matrices in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!