2
sympy.combinatorics.permutations
のどの関数は、与えられた置換の逆置換を返すことができますか? Googleで検索しても結果は表示されません。この関数を書くことはできますが、すでにsympy
に実装されている場合は不要です。反転置換witn sympy
ありがとうございました!
sympy.combinatorics.permutations
のどの関数は、与えられた置換の逆置換を返すことができますか? Googleで検索しても結果は表示されません。この関数を書くことはできますが、すでにsympy
に実装されている場合は不要です。反転置換witn sympy
ありがとうございました!
あなたは~
を探しています:
In [5]: print Permutation.__invert__.__doc__
Return the inverse of the permutation.
A permutation multiplied by its inverse is the identity permutation.
Examples
========
>>> from sympy.combinatorics.permutations import Permutation
>>> p = Permutation([[2,0], [3,1]])
>>> ~p
Permutation([2, 3, 0, 1])
>>> _ == p**-1
True
>>> p*~p == ~p*p == Permutation([0, 1, 2, 3])
True
In [6]: ~Permutation(1, 2, 0)
Out[6]: Permutation(0, 2, 1)
** -1
も動作します。オンラインのドキュメントではこれを決して説明しないので、あなたがそれを見つけられなかった方法を知ることができます。 は、commutator
およびmul_inv
の方法の説明でのみ言及されている。