ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 18 Aug 2013 12:20:41 -0500Passing ideals between Macaulay and Sagehttp://ask.sagemath.org/question/10455/passing-ideals-between-macaulay-and-sage/During some sage code, I'd like to take an ideal, send it to Macaulay2, do some computations with it, and then continue to use the new ideal in sage.
Are there smart ways to do this? I'm currently doing it by converting all variables/equations to strings, and using string maniuplations to produce valid macaulay2 commands. More concretely:
1.) Define the same ring in Macaulay2 via:
<PRE>(my rings are Z-algebras):
l = R.cover_ring().variable_names(); #variable names
m = R.defining_ideal().gens(); #generators of ideal
T = "R = ZZ[" + ", ".join(str(z) for z in l) + "]/("+ ",".join(str(z) for z in m) +")" ;
macaulay2(T);
</PRE>
2.) Then, I can define an ideal I and do some computations with it.
3.) Question: I can print the generators of I via
<PRE>macaulay2("toString gens I");</PRE>
and then, again using string maniuplations remove the "matrix {{" and "}}" from Macaulay2's output, split the string to get a list which can be then be interpreted as generators of an ideal in sage.
Is there a better way to do any of these steps?Sun, 18 Aug 2013 12:20:41 -0500http://ask.sagemath.org/question/10455/passing-ideals-between-macaulay-and-sage/