containment

67 views
Skip to first unread message

Martin R

unread,
Feb 24, 2024, 4:35:56 PM2/24/24
to sage-devel
In combinat/free_module.py, CombinatorialFreeModule, I find the doctest below.

Do we *really* want that 5/3 is not in CombinatorialFreeModule(QQ,["a", "b"])???

Martin

    def __contains__(self, x):
        """
        TESTS::

            sage: F = CombinatorialFreeModule(QQ,["a", "b"])
            sage: G = CombinatorialFreeModule(ZZ,["a", "b"])
            sage: F.monomial("a") in F
            True
            sage: G.monomial("a") in F
            False
            sage: "a" in F
            False
            sage: 5/3 in F
            False
        """
        return parent(x) == self  # is self?

dmo...@deductivepress.ca

unread,
Feb 24, 2024, 4:47:49 PM2/24/24
to sage-devel
Yes. Elements of F are linear combinations of the basis vectors a and b. Since 5/3 is not such a linear combination, it is certainly not in F.

Martin R

unread,
Feb 24, 2024, 6:33:14 PM2/24/24
to sage-devel
Oh dear, I should have taken a break. Thank you.
Reply all
Reply to author
Forward
0 new messages