HP Forums

Full Version: is_cycle?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Does anyone know how this function is supposed to work? it is one of the CAS functions introduced in the latest update. The release notes do not explain it and Help just says it tests whether a permutation is a cycle. The functions cycle2perm and permu2cycles work as described here but is_cycle seems to return 1 for any permutation whether cyclic or not.

TIA,
John
is_cycle returns 0 if the list contains a negative value or if a value is not unique (by the way, I just realize that the algorithm for checking that should be improved, it is currently in O(n^2)).
I see. I was hoping it could test whether a given permutation was cyclic or not, but I realized that I could just check the size of the list returned by permu2cycles.
Reference URL's