#10355: containment for multivariate polynomial rings
-------------------------------------------------+--------------------------
Reporter: niles | Owner: malb
Type: defect | Status: needs_review
Priority: major | Milestone:
Component: commutative algebra | Keywords: multivariate
polynomial containment
Author: Niles Johnson, Andrey Novoseltsev | Upstream: N/A
Reviewer: | Merged:
Work_issues: |
-------------------------------------------------+--------------------------
Changes (by newvalueoldvalue):
* work_issues: address failing doctests =>
* author: => Niles Johnson, Andrey Novoseltsev
Old description:
> A bug in containment for multivariate polynomial rings:
>
> {{{
> sage: A1.<a> = PolynomialRing(QQ)
> sage: 3 in A1
> True
>
> sage: A2.<a,b> = PolynomialRing(QQ)
> sage: 3 in A2
> False
>
> sage: A1(a) in A2
> False
> }}}
>
> This occurs because `__contains__(self,x)` for multivariate polynomial
> rings simply tests whether the parent of `x` is `self`. Instead, it
> should inherit `__contains__` from the class `Parent`. Further
> discussion can be found on this [http://groups.google.com/group/sage-
> devel/browse_thread/thread/dab74506d9ff94bf sage-devel thread].
New description:
A bug in containment for multivariate polynomial rings:
{{{
sage: A1.<a> = PolynomialRing(QQ)
sage: 3 in A1
True
sage: A2.<a,b> = PolynomialRing(QQ)
sage: 3 in A2
False
sage: A1(a) in A2
False
}}}
This occurs because `__contains__(self,x)` for multivariate polynomial
rings simply tests whether the parent of `x` is `self`. Instead, it
should inherit `__contains__` from the class `Parent`. Further discussion
can be found on this [http://groups.google.com/group/sage-
devel/browse_thread/thread/dab74506d9ff94bf sage-devel thread].
== Apply ==
1. [attachment:trac_10355_multi_polynomial_containment_2.patch]
1.
[attachment:trac_10355_polynomial_containment_in_toric_varieties.patch]
--
Comment:
I decided to add the doctest to the `__init__` method for 3 reasons:
* keeps the doctest in the file which defines multivariate polynomial
rings
* `__init__` is one of the "closest" methods (in
`multi_polynomial_ring_generic.py`) to the `Parent` class
* Having the test in the docstring for an underscore method means that it
won't appear in any of the Sage documentation -- for this test, I think
that's appropriate.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10355#comment:7>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.