Tries to embed the module as an ideal in R. It will make several automatic tries followed by MTries=>n (the default n value is 10). If IsGraded is set to true, then it returns a list, the first entry denoting the ideal, the second denoting the degree shift (the default value for the option IsGraded is false). Parts of this function were based on code originally written in the Macaulay2 Divisor tutorial and also based on code by Mordechai Katzman, see the canonicalIdeal function in http://katzman.staff.shef.ac.uk/FSplitting/ParameterTestIdeals.m2
i1 : R = QQ[x,y]
o1 = R
o1 : PolynomialRing
|
i2 : M = (ideal(x^2,x*y))*R^1
o2 = image | x2 xy |
1
o2 : R-module, submodule of R
|
i3 : module2Ideal(M)
o3 = ideal (y, x)
o3 : Ideal of R
|
It also works for non-domains
i4 : R = QQ[x,y]/ideal(x*y)
o4 = R
o4 : QuotientRing
|
i5 : M = (ideal(x^3, y^5))*R^1
o5 = image | x3 y5 |
1
o5 : R-module, submodule of R
|
i6 : module2Ideal(M)
o6 = ideal (y, x)
o6 : Ideal of R
|
i7 : N = (ideal(x,y))*R^1
o7 = image | x y |
1
o7 : R-module, submodule of R
|
i8 : module2Ideal(N)
o8 = ideal (y, x)
o8 : Ideal of R
|
Note that the answer is right even if you don’t recognize it at first. Finally, consider the IsGraded option.
i9 : R = QQ[x,y]
o9 = R
o9 : PolynomialRing
|
i10 : M = R^{-3}
1
o10 = R
o10 : R-module, free, degrees {3}
|
i11 : module2Ideal(M, IsGraded=>true)
o11 = {ideal 1, {-3}}
o11 : List
|