[next][previous][up][top][index]
search for:

equality and containment

Equality and containment can sometimes be subtle in Macaulay 2. For example, testing if an ideal is equal to 0 or 1 are special functions so we give an example here. We try to illustrate the subtleties.

Sections:

  • equal and not equal
  • reduction with respect to a Groebner basis and membership
  • containment for two ideals
  • ideal equal to 1 or 0
  • equal and not equal

    To test if two ideals in the same ring are equal use ==.

    i1 : R = QQ[a..d];
    i2 : I = ideal (a^2*b-c^2, a*b^2-d^3, c^5-d);

    o2 : Ideal of R
    i3 : J = ideal (a^2,b^2,c^2,d^2);

    o3 : Ideal of R
    i4 : I == J

    o4 = false
    i5 : I != J

    o5 = true

    reduction with respect to a Groebner basis and membership

    The function % reduces an element with respect to a Groebner basis of the ideal.

    i6 : (1+a+a^3+a^4) % J

    o6 = a + 1

    o6 : R

    We can then test membership in the ideal by comparing the answer to 0 using ==.

    i7 : (1+a+a^3+a^4) % J == 0

    o7 = false
    i8 : a^4 % J == 0

    o8 = true

    containment for two ideals

    Containment for two ideals is tested using isSubset.

    i9 : isSubset(I,J)

    o9 = false
    i10 : isSubset(I,I+J)

    o10 = true
    i11 : isSubset(I+J,I)

    o11 = false

    ideal equal to 1 or 0

    The function I == 1 checks to see if the ideal is equal to the ring. The function I == 0 checks to if the ideal is identically zero in the given ring.

    i12 : I = ideal (a^2-1,a^3+2);

    o12 : Ideal of R
    i13 : I == 1

    o13 = true
    i14 : S = R/I

    o14 = S

    o14 : QuotientRing
    i15 : S == 0

    o15 = true


    [next][previous][up][top][index]
    search for: