は、サイズ4のランダム順列を生成するためにコードの2行は、次のとおりです。互換ここ
TypeError Traceback (most recent call last)
<ipython-input-3-033ef4665637> in <module>()
1 from numpy import random
----> 2 t = random.permutation(Integer(4))
mtrand.pyx in mtrand.RandomState.permutation (numpy/random/mtrand/mtrand.c:34842)()
mtrand.pyx in mtrand.RandomState.shuffle (numpy/random/mtrand/mtrand.c:33796)()
TypeError: len() of unsized object
なぜですか?
もう少し詳しく:私はPython 3でコードを実行し、mtrand
はPython 3ディレクトリにもあります。これは、sageがnumpyのPython 2バージョンを呼び出す可能性を排除するものです。
しかし、現在使用されているSageにはPython 2しかありません(ただし、近い将来変更される可能性があります(https://trac.sagemath.org/ticket/15530を参照)。 – kcrisman