You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sympy
Let's say I have a matrix M in the SymPy Matrix class, how may I create a Numpy array variable that takes the same values as in M?
I tried np.array(M). But its dtype=Object which is strange and I am not sure what does it mean.
Any idea would be extremely helpful! Thanks!
Aaron Meurer
unread,
Jul 19, 2018, 5:32:12 PM7/19/18
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sy...@googlegroups.com
Ideally you should be able to just do np.array(Matrix(...),
dtype=float) (or dtype=int) to create a numpy array with a native
dtype. But it looks like there is a bug that prevents it from working
(https://github.com/sympy/sympy/issues/14943). So for now you can use
from sympy import matrix2numpy
matrix2numpy(M, dtype=float)