ベクトルと行列に対して異なる方法で機能する関数を Sage で作成しています。
isinstance
ベクトルまたは行列のタイプは要素のタイプに依存するため、関数を使用できません。
sage: type(matrix([[1]]))
<type 'sage.matrix.matrix_integer_dense.Matrix_integer_dense'>
sage: type(matrix([[i]]))
<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
ベクトルと行列を区別する最良の方法は何ですか?