Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: Course
Views: 41
%md Today, we've encounter two concepts from group theory(Permutations group and homomorphism). It is instructive to manipulate permutations. Assume that you have $$ \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7\\ 2 & 3 & 1 & 5 & 6 & 7 & 4 \end{pmatrix} $$ To check if your cycle decompositions is correct, plug list thact contains pair (element, its image), in our case $$[(1,2), (2,3), (3,1), (4,5), (5, 6), (6,7), (7,4)]$$

Today, we've encounter two concepts from group theory(Permutations group and homomorphism). It is instructive to manipulate permutations. Assume that you have (12345672315674) \begin{pmatrix} 1 & 2 & 3 & 4 & 5 & 6 & 7\\ 2 & 3 & 1 & 5 & 6 & 7 & 4 \end{pmatrix} To check if your cycle decompositions is correct, plug list thact contains pair (element, its image), in our case [(1,2),(2,3),(3,1),(4,5),(5,6),(6,7),(7,4)][(1,2), (2,3), (3,1), (4,5), (5, 6), (6,7), (7,4)]

from permutations import permutations #Leave it print permutations([(1,2), (2,3), (3,1), (4,5), (5, 6), (6,7), (7,4)]) #Edit the input
[(1, 2, 3), (4, 5, 6, 7)]
%md For permutations group, you need to define the group first, then define an element by passing its representaion as string to the created group. Now you can do what ever you like.

For permutations group, you need to define the group first, then define an element by passing its representaion as string to the created group. Now you can do what ever you like.

G = SymmetricGroup(8) #Edit the group size r = G("(1, 2, 3), (4, 5, 6, 7)") s = G("(5,8)(4,7,3)") r*s
(1,2,4,8,5,6,3)
%md $\mathbb{Z}_n$

Zn\mathbb{Z}_n

Z14 = AbelianGroup([14]) Z.cayley_table(names='elements')
* 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 +---------------------------------------------------------------------- 1| 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 f| f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f^2| f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^3| f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^4| f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^5| f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^6| f^6 f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^7| f^7 f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^8| f^8 f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^9| f^9 f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^10| f^10 f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^11| f^11 f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^12| f^12 f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^13| f^13 1 f f^2 f^3 f^4 f^5 f^6 f^7 f^8 f^9 f^10 f^11 f^12
H = SymmetricGroup(4) #Show all methods for G print dir(H) print dir(r)
['CartesianProduct', 'Hom', '__cached_methods', '__call__', '__class__', '__classcall__', '__cmp__', '__contains__', '__copy__', '__deepcopy__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__getattribute__', '__getitem__', '__getstate__', '__hash__', '__init__', '__init_extra__', '__iter__', '__len__', '__make_element_class__', '__metaclass__', '__module__', '__mul__', '__new__', '__nonzero__', '__pyx_vtable__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__temporarily_change_names', '__weakref__', '_abstract_element_class', '_an_element', '_an_element_', '_an_element_c', '_an_element_from_iterator', '_an_element_impl', '_ascii_art_', '_assign_names', '_axiom_', '_axiom_init_', '_base', '_cache_an_element', '_cache_key', '_cardinality_from_iterator', '_cardinality_from_list', '_clear_cache_', '_cmp_', '_coerce_', '_coerce_c', '_coerce_impl', '_coerce_map_from_', '_coerce_map_via', '_coerce_try', '_coercions_used', '_convert_map_from_', '_convert_method_name', '_deg', '_domain', '_domain_from_gap', '_domain_gap', '_domain_to_gap', '_element_class', '_element_constructor', '_element_constructor_', '_element_constructor_from_element_class', '_element_init_pass_parent', '_factory_data', '_first_from_iterator', '_first_ngens', '_fricas_', '_fricas_init_', '_gap_', '_gap_init_', '_generic_convert_map', '_gens', '_get_action_', '_giac_', '_giac_init_', '_gp_', '_gp_init_', '_has_coerce_map_from', '_has_natural_domain', '_included_private_doc_', '_init_category_', '_initial_action_list', '_initial_coerce_list', '_initial_convert_list', '_interface_', '_interface_init_', '_interface_is_cached_', '_internal_coerce_map_from', '_internal_convert_map_from', '_introspect_coerce', '_is_category_initialized', '_is_valid_homomorphism_', '_iterator_from_list', '_iterator_from_next', '_iterator_from_unrank', '_kash_', '_kash_init_', '_last_from_iterator', '_last_from_unrank', '_latex_', '_latex_names', '_list', '_list_default', '_list_from_iterator', '_list_from_iterator_cached', '_macaulay2_', '_macaulay2_init_', '_magma_init_', '_maple_', '_maple_init_', '_mathematica_', '_mathematica_init_', '_maxima_', '_maxima_init_', '_maxima_lib_', '_maxima_lib_init_', '_names', '_next_from_iterator', '_ngens_', '_octave_', '_octave_init_', '_order', '_pari_', '_pari_init_', '_populate_coercion_lists_', '_populate_generators_', '_r_init_', '_random_element_from_unrank', '_rank_from_iterator', '_reduction', '_refine_category_', '_repr_', '_repr_option', '_richcmp', '_sage_', '_sage_src_lines_', '_set_element_constructor', '_singular_', '_singular_init_', '_some_elements_from_iterator', '_temporarily_change_names', '_test_an_element', '_test_associativity', '_test_cardinality', '_test_category', '_test_elements', '_test_elements_eq_reflexive', '_test_elements_eq_symmetric', '_test_elements_eq_transitive', '_test_elements_neq', '_test_enumerated_set_contains', '_test_enumerated_set_iter_cardinality', '_test_enumerated_set_iter_list', '_test_eq', '_test_has_descent', '_test_inverse', '_test_not_implemented_methods', '_test_one', '_test_pickling', '_test_prod', '_test_reduced_word', '_test_simple_projections', '_test_some_elements', '_tester', '_unicode_art_', '_unrank_from_iterator', '_unrank_from_list', '_unset_category', '_unset_coercions_used', '_unset_embedding', 'algebra', 'an_element', 'as_finitely_presented_group', 'base', 'base_extend', 'base_ring', 'blocks_all', 'bruhat_interval', 'bruhat_poset', 'cambrian_lattice', 'canonical_representation', 'cardinality', 'cartan_type', 'cartesian_product', 'categories', 'category', 'cayley_graph', 'cayley_graph_disabled', 'cayley_table', 'center', 'centralizer', 'character', 'character_table', 'coerce', 'coerce_embedding', 'coerce_map_from', 'coerce_map_from_c', 'cohomology', 'cohomology_part', 'commutator', 'composition_series', 'conjugacy_class', 'conjugacy_classes', 'conjugacy_classes_iterator', 'conjugacy_classes_representatives', 'conjugacy_classes_subgroups', 'conjugate', 'construction', 'convert_map_from', 'cosets', 'cycle_index', 'db', 'degree', 'demazure_product', 'derived_series', 'direct_product', 'domain', 'dump', 'dumps', 'element_class', 'elements_of_length', 'exponent', 'first', 'fitting_subgroup', 'fixed_points', 'frattini_subgroup', 'from_reduced_word', 'gen', 'gens', 'gens_dict', 'gens_dict_recursive', 'gens_small', 'get_action', 'get_action_c', 'get_action_impl', 'grassmannian_elements', 'group_generators', 'group_id', 'group_primitive_id', 'has_base', 'has_coerce_map_from', 'has_coerce_map_from_c', 'has_element', 'holomorph', 'hom', 'homology', 'homology_part', 'id', 'ideal', 'idempotents', 'identity', 'index_set', 'inject_variables', 'injvar', 'intersection', 'inversion_sequence', 'irreducible_characters', 'is_abelian', 'is_atomic_repr', 'is_coercion_cached', 'is_commutative', 'is_conversion_cached', 'is_cyclic', 'is_elementary_abelian', 'is_empty', 'is_exact', 'is_finite', 'is_isomorphic', 'is_monomial', 'is_multiplicative', 'is_nilpotent', 'is_normal', 'is_parent_of', 'is_perfect', 'is_pgroup', 'is_polycyclic', 'is_primitive', 'is_regular', 'is_semi_regular', 'is_simple', 'is_solvable', 'is_subgroup', 'is_supersolvable', 'is_transitive', 'isomorphism_to', 'isomorphism_type_info_simple_group', 'j_classes', 'j_classes_of_idempotents', 'j_transversal_of_idempotents', 'largest_moved_point', 'last', 'latex_name', 'latex_variable_names', 'list', 'long_element', 'lower_central_series', 'm_cambrian_lattice', 'magma_generators', 'major_index', 'map', 'minimal_generating_set', 'molien_series', 'monoid_generators', 'multiplication_table', 'next', 'ngens', 'non_fixed_points', 'normal_subgroups', 'normalize_names', 'normalizer', 'normalizes', 'objgen', 'objgens', 'one', 'one_element', 'orbit', 'orbits', 'order', 'parent', 'pieri_factors', 'poincare_series', 'prod', 'product', 'product_from_element_class_mul', 'quantum_bruhat_graph', 'quotient', 'random_element', 'random_element_of_length', 'rank', 'reflections_from_w0', 'register_action', 'register_coercion', 'register_conversion', 'register_embedding', 'rename', 'representative_action', 'reset_name', 'save', 'semidirect_product', 'semigroup_generators', 'simple_projection', 'simple_projections', 'simple_reflection', 'simple_reflections', 'smallest_moved_point', 'socle', 'solvable_radical', 'some_elements', 'stabilizer', 'strong_generating_system', 'structure_description', 'subgroup', 'subgroups', 'submonoid', 'subsemigroup', 'succ_generators', 'sylow_subgroup', 'transversals', 'trivial_character', 'unrank', 'upper_central_series', 'variable_name', 'variable_names', 'version', 'w0', 'weak_lattice', 'weak_order_ideal', 'weak_poset', 'young_subgroup'] ['N', '__call__', '__class__', '__cmp__', '__copy__', '__custom_name', '__delattr__', '__dict__', '__dir__', '__div__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getmetaclass__', '__getstate__', '__gt__', '__hash__', '__imul__', '__init__', '__invert__', '__le__', '__lt__', '__module__', '__mul__', '__ne__', '__new__', '__nonzero__', '__pos__', '__pow__', '__pyx_vtable__', '__rdiv__', '__reduce__', '__reduce_ex__', '__repr__', '__rmul__', '__rpow__', '__rtruediv__', '__rxor__', '__setattr__', '__setstate__', '__sizeof__', '__str__', '__subclasshook__', '__truediv__', '__weakref__', '__xor__', '_act_on_', '_act_on_array_on_position', '_act_on_list_on_position', '_acted_upon_', '_add_', '_ascii_art_', '_axiom_', '_axiom_init_', '_cache_key', '_cmp_', '_coeff_repr', '_div_', '_dummy_attribute', '_fricas_', '_fricas_init_', '_gap_', '_gap_cycle_string', '_gap_init_', '_gap_list', '_giac_', '_giac_init_', '_gp_', '_gp_init_', '_im_gens_', '_interface_', '_interface_init_', '_interface_is_cached_', '_is_atomic', '_kash_', '_kash_init_', '_latex_', '_latex_coeff_repr', '_macaulay2_', '_macaulay2_init_', '_magma_init_', '_make_new_with_parent_c', '_maple_', '_maple_init_', '_mathematica_', '_mathematica_init_', '_maxima_', '_maxima_init_', '_maxima_lib_', '_maxima_lib_init_', '_mpmath_', '_mul_', '_mul_parent', '_octave_', '_octave_init_', '_pari_', '_pari_init_', '_pow_', '_pow_naive', '_r_init_', '_reduction', '_repr_', '_richcmp_', '_sage_', '_sage_src_lines_', '_set_parent', '_singular_', '_singular_init_', '_test_category', '_test_eq', '_test_not_implemented_methods', '_test_pickling', '_tester', '_unicode_art_', 'absolute_le', 'absolute_length', 'apply_conjugation_by_simple_reflection', 'apply_demazure_product', 'apply_simple_projection', 'apply_simple_reflection', 'apply_simple_reflection_left', 'apply_simple_reflection_right', 'apply_simple_reflections', 'base_extend', 'base_ring', 'binary_factorizations', 'bruhat_le', 'bruhat_lower_covers', 'bruhat_lower_covers_coroots', 'bruhat_lower_covers_reflections', 'bruhat_upper_covers', 'bruhat_upper_covers_coroots', 'bruhat_upper_covers_reflections', 'canonical_matrix', 'cartesian_product', 'category', 'conjugacy_class', 'coset_representative', 'cover_reflections', 'coxeter_knuth_graph', 'coxeter_knuth_neighbor', 'coxeter_sorting_word', 'cycle_string', 'cycle_tuples', 'cycles', 'db', 'deodhar_factor_element', 'deodhar_lift_down', 'deodhar_lift_up', 'descents', 'dict', 'domain', 'dump', 'dumps', 'first_descent', 'has_descent', 'has_full_support', 'has_left_descent', 'has_right_descent', 'inverse', 'inversion_arrangement', 'inversions', 'inversions_as_reflections', 'is_coxeter_sortable', 'is_grassmannian', 'is_idempotent', 'is_one', 'is_pieri_factor', 'is_zero', 'left_inversions_as_reflections', 'left_pieri_factorizations', 'length', 'lower_cover_reflections', 'lower_covers', 'matrix', 'min_demazure_product_greater', 'multiplicative_order', 'n', 'numerical_approx', 'orbit', 'order', 'parent', 'powers', 'pseudo_order', 'quantum_bruhat_successors', 'rank', 'reduced_word', 'reduced_word_graph', 'reduced_word_reverse_iterator', 'reduced_words', 'reflection_to_coroot', 'reflection_to_root', 'rename', 'reset_name', 'save', 'sign', 'stanley_symmetric_function', 'stanley_symmetric_function_as_polynomial', 'subs', 'substitute', 'support', 'tuple', 'upper_covers', 'version', 'weak_covers', 'weak_le', 'word_problem']
H.cayley_table(names='elements') #The whole multiplication table
* () (1,2) (1,2,3,4) (1,3)(2,4) (1,3,4) (2,3,4) (1,4,3,2) (1,3,4,2) (1,3,2,4) (1,4,2,3) (1,2,4,3) (2,4,3) (1,4,3) (1,4)(2,3) (1,4,2) (1,3,2) (1,3) (3,4) (2,4) (1,4) (2,3) (1,2)(3,4) (1,2,3) (1,2,4) +------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ ()| () (1,2) (1,2,3,4) (1,3)(2,4) (1,3,4) (2,3,4) (1,4,3,2) (1,3,4,2) (1,3,2,4) (1,4,2,3) (1,2,4,3) (2,4,3) (1,4,3) (1,4)(2,3) (1,4,2) (1,3,2) (1,3) (3,4) (2,4) (1,4) (2,3) (1,2)(3,4) (1,2,3) (1,2,4) (1,2)| (1,2) () (1,3,4) (1,4,2,3) (1,2,3,4) (1,3,4,2) (2,4,3) (2,3,4) (1,4)(2,3) (1,3)(2,4) (1,4,3) (1,4,3,2) (1,2,4,3) (1,3,2,4) (2,4) (2,3) (1,2,3) (1,2)(3,4) (1,4,2) (1,2,4) (1,3,2) (3,4) (1,3) (1,4) (1,2,3,4)| (1,2,3,4) (2,3,4) (1,3)(2,4) (1,4,3,2) (1,2,4,3) (1,3,2,4) () (2,4,3) (1,4,3) (1,3,2) (1,4,2) (1,4) (1,2) (1,3) (2,3) (3,4) (1,2)(3,4) (1,2,4) (1,4)(2,3) (1,2,3) (1,3,4) (2,4) (1,3,4,2) (1,4,2,3) (1,3)(2,4)| (1,3)(2,4) (1,3,2,4) (1,4,3,2) () (1,4,2) (1,4,3) (1,2,3,4) (1,4) (1,2) (3,4) (2,3) (1,2,3) (2,3,4) (1,2)(3,4) (1,3,4) (1,2,4) (2,4) (1,4,2,3) (1,3) (1,3,4,2) (1,2,4,3) (1,4)(2,3) (2,4,3) (1,3,2) (1,3,4)| (1,3,4) (1,3,4,2) (1,4,2,3) (2,4,3) (1,4,3) (1,4)(2,3) (1,2) (1,4,3,2) (1,2,4,3) (2,3) (2,4) (1,2,4) () (1,2,3) (1,3,2) (1,2)(3,4) (3,4) (1,4) (1,3,2,4) (1,3) (1,2,3,4) (1,4,2) (2,3,4) (1,3)(2,4) (2,3,4)| (2,3,4) (1,2,3,4) (1,2,4,3) (1,3,2) (1,3)(2,4) (2,4,3) (1,4) (1,3,2,4) (1,3) (1,4,3,2) (1,2) () (1,4,2) (1,4,3) (1,4)(2,3) (1,3,4) (1,3,4,2) (2,4) (2,3) (1,4,2,3) (3,4) (1,2,4) (1,2)(3,4) (1,2,3) (1,4,3,2)| (1,4,3,2) (1,4,3) () (1,2,3,4) (2,3) (1,2) (1,3)(2,4) (1,2,3) (2,3,4) (1,2,4) (1,3,4) (1,3,4,2) (1,3,2,4) (2,4) (1,2,4,3) (1,4,2,3) (1,4)(2,3) (1,3,2) (1,2)(3,4) (2,4,3) (1,4,2) (1,3) (1,4) (3,4) (1,3,4,2)| (1,3,4,2) (1,3,4) (1,4,3) (2,3) (1,4,2,3) (1,4,3,2) (1,2,4) (1,4)(2,3) (1,2,3) (2,4,3) () (1,2) (2,4) (1,2,4,3) (1,3,2,4) (1,2,3,4) (2,3,4) (1,4,2) (1,3,2) (1,3)(2,4) (1,2)(3,4) (1,4) (3,4) (1,3) (1,3,2,4)| (1,3,2,4) (1,3)(2,4) (1,4,2) (3,4) (1,4,3,2) (1,4) (1,2,3) (1,4,3) (1,2)(3,4) () (2,3,4) (1,2,3,4) (2,3) (1,2) (1,3) (1,2,4,3) (2,4,3) (1,4)(2,3) (1,3,4) (1,3,2) (1,2,4) (1,4,2,3) (2,4) (1,3,4,2) (1,4,2,3)| (1,4,2,3) (1,4)(2,3) (2,4,3) (1,2) (2,4) (1,2,4,3) (1,3,4) (1,2,4) () (1,2)(3,4) (1,3,2) (1,3) (1,3,4,2) (3,4) (1,2,3,4) (1,4) (1,4,2) (1,3)(2,4) (1,2,3) (2,3,4) (1,4,3) (1,3,2,4) (1,4,3,2) (2,3) (1,2,4,3)| (1,2,4,3) (2,4,3) (1,3,2) (1,4) (1,2) (1,3) (2,3,4) () (1,4,2) (1,3,4) (1,4)(2,3) (1,4,2,3) (1,2,3,4) (1,3,4,2) (3,4) (2,4) (1,2,4) (1,2,3) (1,4,3) (1,2)(3,4) (1,3)(2,4) (2,3) (1,3,2,4) (1,4,3,2) (2,4,3)| (2,4,3) (1,2,4,3) (1,2) (1,3,4) (1,3,2) () (1,4,2,3) (1,3) (1,3,4,2) (1,4) (1,2,3,4) (2,3,4) (1,4)(2,3) (1,4,2) (1,4,3) (1,3)(2,4) (1,3,2,4) (2,3) (3,4) (1,4,3,2) (2,4) (1,2,3) (1,2,4) (1,2)(3,4) (1,4,3)| (1,4,3) (1,4,3,2) (2,3) (1,2,4) () (1,2,3) (1,3,4,2) (1,2) (2,4) (1,2,3,4) (1,3,2,4) (1,3)(2,4) (1,3,4) (2,3,4) (1,2)(3,4) (1,4,2) (1,4) (1,3) (1,2,4,3) (3,4) (1,4,2,3) (1,3,2) (1,4)(2,3) (2,4,3) (1,4)(2,3)| (1,4)(2,3) (1,4,2,3) (2,4) (1,2)(3,4) (2,4,3) (1,2,4) (1,3) (1,2,4,3) (3,4) (1,2) (1,3,4,2) (1,3,4) (1,3,2) () (1,2,3) (1,4,3) (1,4,3,2) (1,3,2,4) (1,2,3,4) (2,3) (1,4) (1,3)(2,4) (1,4,2) (2,3,4) (1,4,2)| (1,4,2) (1,4) (3,4) (1,2,3) (2,3,4) (1,2)(3,4) (1,3,2,4) (1,2,3,4) (2,3) (1,2,4,3) (1,3) (1,3,2) (1,3)(2,4) (2,4,3) (1,2,4) (1,4)(2,3) (1,4,2,3) (1,3,4,2) (1,2) (2,4) (1,4,3,2) (1,3,4) (1,4,3) () (1,3,2)| (1,3,2) (1,3) (1,4) (2,3,4) (1,4)(2,3) (1,4,2) (1,2,4,3) (1,4,2,3) (1,2,3,4) (2,4) (3,4) (1,2)(3,4) (2,4,3) (1,2,4) (1,3)(2,4) (1,2,3) (2,3) (1,4,3,2) (1,3,4,2) (1,3,2,4) (1,2) (1,4,3) () (1,3,4) (1,3)| (1,3) (1,3,2) (1,4)(2,3) (2,4) (1,4) (1,4,2,3) (1,2)(3,4) (1,4,2) (1,2,4) (2,3,4) (2,4,3) (1,2,4,3) (3,4) (1,2,3,4) (1,3,4,2) (1,2) () (1,4,3) (1,3)(2,4) (1,3,4) (1,2,3) (1,4,3,2) (2,3) (1,3,2,4) (3,4)| (3,4) (1,2)(3,4) (1,2,3) (1,3,2,4) (1,3) (2,3) (1,4,2) (1,3,2) (1,3)(2,4) (1,4)(2,3) (1,2,4) (2,4) (1,4) (1,4,2,3) (1,4,3,2) (1,3,4,2) (1,3,4) () (2,4,3) (1,4,3) (2,3,4) (1,2) (1,2,3,4) (1,2,4,3) (2,4)| (2,4) (1,2,4) (1,2)(3,4) (1,3) (1,3,4,2) (3,4) (1,4)(2,3) (1,3,4) (1,3,2) (1,4,3) (1,2,3) (2,3) (1,4,2,3) (1,4,3,2) (1,4) (1,3,2,4) (1,3)(2,4) (2,3,4) () (1,4,2) (2,4,3) (1,2,3,4) (1,2,4,3) (1,2) (1,4)| (1,4) (1,4,2) (2,3,4) (1,2,4,3) (3,4) (1,2,3,4) (1,3,2) (1,2)(3,4) (2,4,3) (1,2,3) (1,3)(2,4) (1,3,2,4) (1,3) (2,3) (1,2) (1,4,3,2) (1,4,3) (1,3,4) (1,2,4) () (1,4)(2,3) (1,3,4,2) (1,4,2,3) (2,4) (2,3)| (2,3) (1,2,3) (1,2,4) (1,3,4,2) (1,3,2,4) (2,4) (1,4,3) (1,3)(2,4) (1,3,4) (1,4,2) (1,2)(3,4) (3,4) (1,4,3,2) (1,4) (1,4,2,3) (1,3) (1,3,2) (2,4,3) (2,3,4) (1,4)(2,3) () (1,2,4,3) (1,2) (1,2,3,4) (1,2)(3,4)| (1,2)(3,4) (3,4) (1,3) (1,4)(2,3) (1,2,3) (1,3,2) (2,4) (2,3) (1,4,2,3) (1,3,2,4) (1,4) (1,4,2) (1,2,4) (1,3)(2,4) (2,4,3) (2,3,4) (1,2,3,4) (1,2) (1,4,3,2) (1,2,4,3) (1,3,4,2) () (1,3,4) (1,4,3) (1,2,3)| (1,2,3) (2,3) (1,3,2,4) (1,4,2) (1,2,4) (1,3)(2,4) (3,4) (2,4) (1,4) (1,3,4,2) (1,4,3,2) (1,4,3) (1,2)(3,4) (1,3,4) (2,3,4) () (1,2) (1,2,4,3) (1,4,2,3) (1,2,3,4) (1,3) (2,4,3) (1,3,2) (1,4)(2,3) (1,2,4)| (1,2,4) (2,4) (1,3,4,2) (1,4,3) (1,2)(3,4) (1,3,4) (2,3) (3,4) (1,4,3,2) (1,3) (1,4,2,3) (1,4)(2,3) (1,2,3) (1,3,2) () (2,4,3) (1,2,4,3) (1,2,3,4) (1,4) (1,2) (1,3,2,4) (2,3,4) (1,3)(2,4) (1,4,2)
%md ### Futurama: Prisoner of Benda

Futurama: Prisoner of Benda

from IPython.display import Image, VimeoVideo x = VimeoVideo("164623027") show(x)
<IPython.lib.display.VimeoVideo object at 0x7fe836f4b290>\displaystyle \text{\texttt{<IPython.lib.display.VimeoVideo{ }object{ }at{ }0x7fe836f4b290>}}
T = AbelianGroup([4,4]) T.cayley_graph().show3d( color_by_label=True, edge_labels=True)
3D rendering not yet implemented
%md ### Appendix: permutations source code

Appendix: permutations source code

import permutations permutations??
File: /projects/3e6ae89a-1761-4366-aaf6-9dc1ff986356/Introduction/Permutation Groups/permutations.py Source: def rotatePer(lis): """Certainly it is not an optimized solution Given list, i.e. [3,4,2,5], it will returns [2,5,3,4]. In general it will rotate the input so its minimum become the leading element. """ length = len(lis) ind = lis.index(min(lis)) result = [0]*length for i in range(len(lis)): result[(i-ind)%length] = lis[i] return result def permutations(inp, n = None): """""" #Checking if len(inp) == 0: return falseIfLengthIs2 = lambda lis: len(lis) != 2 #Check wheter or not every element has length 2 if sum(map(falseIfLengthIs2, inp)) > 0: raise ValueError("Your input must be similar to [(1,2), (2,1)]") #Filling output out = [[inp[0][0], inp[0][1]]] lastEleCycle = [t[-1] for t in out] #Last element of each cycle firstEleCycle = [t[0] for t in out] #First element of each cycle del inp[0] for tup in inp: if (tup[0] in lastEleCycle) and (tup[1] not in firstEleCycle): #For instance tup= (1,2) and out=[[3,4,6,1], ...] not out=[[2,4,6,1], ..] nor out=[[8,4,6,7], ..] i = lastEleCycle.index(tup[0])#Suppose that we are processing (1,2), and output= [[3,4,6,1],...] out[i].append(tup[1])#Then the output will become output= [[3,4,6,1,2],...] lastEleCycle[i] = tup[1]#Update last element elif (tup[0] in lastEleCycle) and (tup[1] in firstEleCycle): #We have completed a cycle, just do nothing pass elif (tup[1] in firstEleCycle) and (tup[0] not in lastEleCycle): #For instance tup= (1,2) and out=[[1,4,6,3], ...] not out=[[1,4,6,2], ..] nor out=[[8,4,6,7], ..] i = firstEleCycle.index(tup[1])#Suppose that we are processing (1,2), and output= [[1,4,6,3],...] out[i].insert(0,tup[0])#Then the output will become output= [[3,4,6,1,2],...] firstEleCycle[i] = tup[0]#Update last element else: #elif tup[0] not in lastEleCycle and tup[1] not in firstEleCycle: #create new cycle i = len(lastEleCycle) lastEleCycle.append(tup[1]) #Notice the index of tup[0] in lastEleCycle is i, since index starts from 0. firstEleCycle.append(tup[0]) #Notice the index of tup[0] in lastEleCycle is i, since index starts from 0. out.append([tup[0], tup[1]]) ################ #Extra features: #Sometimes we might have an output as [3,1,2], we wish to make it (1,2,3) output = [0]*len(out) #Because there is a problem in copying elements of a list. I might edit later. for ind, cycle in enumerate(out): output[ind] = tuple(rotatePer(cycle)) ############################################################### # An example of complicated and severely incorrect solution: #try: #You can use if condition instead #Notice that python returns only first occurrence of searched element, however it works because we are constructinf a disjoint cycle # i = firstEleCycle.index(tup[1])#For the special case when out= [[1,2,3],...] and [3,1] is being processed. # i = lastEleCycle.index(tup[0])#Just do nothing #except ValueError: # try: # i = lastEleCycle.index(tup[0]) #Suppose that we are processing (4,7), and output= [[6,4], [1,2,3,9]] # out[i].append(tup[1])#Then the output will become [[6,4,7], [1,2,3,9]] # lastEleCycle[i] = tup[0]#Update last element # # i = firstEleCycle.index(tup[1]) # except:#Create new cycle # i = len(lastEleCycle) # lastEleCycle.append(tup[1]) #Notice the index of tup[0] in lastEleCycle is i, since index starts from 0. # firstEleCycle.append(tup[0]) #Notice the index of tup[0] in lastEleCycle is i, since index starts from 0. # out.append([tup[0], tup[1]]) ################################################################ del out return sorted(output) #It is not important to sort them