Related Articles
Python | SymPy Permutation.atoms() method
• Last Updated : 26 Aug, 2019

Permutation.atoms() : atoms() is a sympy Python library function that returns all the elements that are present in the permutation.

Syntax : sympy.combinatorics.permutations.Permutation.atoms()

Return : elements of the argumented permutation.

Code #1 : atoms() Example

 `# Python code explaining``# SymPy.Permutation.atoms()`` ` `# importing SymPy libraries``from` `sympy.combinatorics.partitions ``import` `Partition``from` `sympy.combinatorics.permutations ``import` `Permutation`` ` `# Using from sympy.combinatorics.permutations.Permutation.atoms() method `` ` `# creating Permutation``a ``=` `Permutation([[``2``, ``0``], [``3``, ``1``]])`` ` `b ``=` `Permutation([``1``, ``3``, ``5``, ``4``, ``2``, ``0``])`` ` ` ` `print` `(``"Permutation a - atoms form : "``, a.atoms())``print` `(``"Permutation b - atoms form : "``, b.atoms())`

Output :

Permutation a – atoms form : {0, 1, 2, 3}
Permutation b – atoms form : {0, 1, 2, 3, 4, 5}

Code #2 : atoms() Example – 2D Permutation

 `# Python code explaining``# SymPy.Permutation.atoms()`` ` `# importing SymPy libraries``from` `sympy.combinatorics.partitions ``import` `Partition``from` `sympy.combinatorics.permutations ``import` `Permutation`` ` `# Using from sympy.combinatorics.permutations.Permutation.atoms() method `` ` `# creating Permutation``a ``=` `Permutation([[``2``, ``4``, ``0``], ``                 ``[``3``, ``1``, ``2``],``                 ``[``1``, ``5``, ``6``]])`` ` ` ` `print` `(``"Permutation a - atoms form : "``, a.atoms())`

Output :

Permutation a – ascents form : [1, 2, 4]

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course

My Personal Notes arrow_drop_up
{"ft_lang_label":"__label__en","ft_lang_prob":0.5474076,"math_prob":0.7638657,"size":1654,"snap":"2021-21-2021-25","text_gpt3_token_len":478,"char_repetition_ratio":0.21515152,"word_repetition_ratio":0.32941177,"special_character_ratio":0.2762999,"punctuation_ratio":0.25666666,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9962828,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-05-10T19:01:28Z\",\"WARC-Record-ID\":\"<urn:uuid:6a6ff12f-8ac1-4dc7-8e1e-eb3e6b7d1708>\",\"Content-Length\":\"91765\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ac8ce5a0-ddcd-41c3-9d0f-35bfa6149ef6>\",\"WARC-Concurrent-To\":\"<urn:uuid:3663ff00-6035-4044-9640-709f53a5e17e>\",\"WARC-IP-Address\":\"104.96.220.131\",\"WARC-Target-URI\":\"https://www.geeksforgeeks.org/python-sympy-permutation-atoms-method/?ref=rp\",\"WARC-Payload-Digest\":\"sha1:4UPU6KMZP4KGECGHCDCWWUK4YZ2KU52W\",\"WARC-Block-Digest\":\"sha1:JJLSJIYNPCV7SALD7XFCLFU6O3B5TQU5\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-21/CC-MAIN-2021-21_segments_1620243991759.1_warc_CC-MAIN-20210510174005-20210510204005-00462.warc.gz\"}"}