Ask Your Question

# Can I import M2 matrices into sage?

I have thousands of matrices I computed in Macaulay2. They are scattered throughout sub-directories of ~/matrices/ one example of one of these matrices is

\$ cat ~/matrices/foo/001-matrix

map((ZZ)^9,(ZZ)^7,{{1, 0, -1, 0, 0, 0, 0}, {1, 0, 1, 0, 0, 0, 0}, {1, 0, 0, -1, -1, -1, -1}, {1, 0, 0, 1, 0, 0, 0}, {1, 0, 0, 0, 1, 0, 0}, {0, 1, 0, 0, 0, 1, 0}, {0, 1, 0, 0, 0, 0, 1}, {1, 0, 0, 0, 0, 0, 0}, {0, 1, 0, 0, 0, 0, 0}})

I would like to write a script to convert each of these matrices into a format that sage can read. It seems like

sage: A = macaulay2(value get "~/matrices/foo/001-matrix")

should work but this returns the error invalid syntax. Is it possible to perform my desired conversions?

edit retag close merge delete

## 1 answer

Sort by ยป oldest newest most voted

I don't know anything about macaulay and don't have it installed, but I suggest you try to make the content of your command be a string, or you will keep hitting this syntax error. What about

sage: A = macaulay2('value get "~/matrices/foo/001-matrix"')

Does it give what you want ?

Nathann

more

## Comments

Yes thank you!

( 2016-02-02 12:07:26 -0600 )edit

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2016-02-01 22:26:18 -0600

Seen: 113 times

Last updated: Feb 02 '16