JuliaPy / SymPy.jl

Julia interface to SymPy via PyCall
http://juliapy.github.io/SymPy.jl/
MIT License
268 stars 62 forks source link

MatrixSymbol converstion to Matrix returns PyCall.PyObject #462

Closed prittjam closed 2 years ago

prittjam commented 2 years ago

U = sympy.Matrix(sympy.MatrixSymbol("U",2,2)) typeof(U)

PyCall.PyObject

I can't do any matrix operations with it, unfortunately.

jverzani commented 2 years ago

Hmm, there is a convert method that isn't working here. Thanks for letting me know.

The sympy matrix operation work (e.g. U.det() will find the determinant) but Julia ones won't as the dispatch is setup for Matrix{Sym} types.

For this problem you can get a Matrix{Sym} object easy enough: U.tolist(). But there should be an automatic conversion (through pytypemapping or at least a convert(Matrix{Sym}, U) method defined.

prittjam commented 2 years ago

Thanks for the explanation! I can work around it for now.

jverzani commented 2 years ago

I think #463 closes this. Thanks for the report.