What is the best way to convert a SymPy matrix to a numpy array/matrix

This looks like the most straightforward:

np.array(g).astype(np.float64)

If you skip the astype method, numpy will create a matrix of type ‘object’, which won’t work with common array operations.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)