・Arrayで、diffができましたが、invができませんでした。
sympyで
from sympy import *
var('x',real=True)
M=Matrix([[2*x,3*x],[4*x,5*x]])
print("#",M ,type(M))
print("#",M.diff())
print("#",M.inv() )
print()
A=Array ([[2*x,3*x],[4*x,5*x]])
print("#",A ,type(A))
print("#",A.diff())
print("#",A.inv() )
# Matrix([[2*x, 3*x], [4*x, 5*x]]) <class 'sympy.matrices.dense.MutableDenseMatrix'>
# Matrix([[2, 3], [4, 5]])
# Matrix([[-5/(2*x), 3/(2*x)], [2/x, -1/x]])
# [[2*x, 3*x], [4*x, 5*x]] <class 'sympy.tensor.array.dense_ndim_array.ImmutableDenseNDimArray'>
# [[2, 3], [4, 5]]
# AttributeError: 'ImmutableDenseNDimArray' object has no attribute 'inv'
DOC