Opened 11 years ago

Last modified 7 years ago

#11199 needs_info enhancement

QuotientRing elements are not callable

Reported by: vbraun Owned by: AlexGhitza
Priority: major Milestone: sage-6.4
Component: algebra Keywords:
Cc: novoselt Merged in:
Authors: Volker Braun Reviewers: John Palmieri
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jhpalmieri)

It would be convenient if quotient ring elements would be callable like polynomials. This is currently not the case:

sage: R.<x,y> = QQ[]
sage: I = R.ideal(x)
sage: Q = R.quotient_ring(I)
sage: Q
Quotient of Multivariate Polynomial Ring in x, y over Rational Field by the ideal (x)
sage: Q.inject_variables()
Defining xbar, ybar
sage: p = xbar + ybar
sage: p(1,1)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)

/home/vbraun/opt/sage-4.7.alpha4/devel/sage-main/<ipython console> in <module>()

TypeError: 'QuotientRingElement' object is not callable

The attached patch implements this functionality by handing the argument through to the lift.

Arguably, it should check that the result does not depend on the presentation. Pro: catches errors; Con: potentially slow, ideal membership test necessary if arguments are polynomials.


Apply trac_11199-jhp.patch.

Attachments (3)

trac_11199_QuotientRingElement_call.patch (2.6 KB) - added by vbraun 11 years ago.
Initial patch
trac_11199-delta.patch (1.1 KB) - added by jhpalmieri 10 years ago.
for reference only; difference beteen initial patch and jhp patch
trac_11199-jhp.patch (2.8 KB) - added by jhpalmieri 10 years ago.
apply this one

Download all attachments as: .zip

Change History (11)

Changed 11 years ago by vbraun

Initial patch

comment:1 Changed 11 years ago by vbraun

  • Cc novoselt added

comment:2 Changed 11 years ago by vbraun

  • Status changed from new to needs_review

comment:3 Changed 10 years ago by jhpalmieri

  • Description modified (diff)
  • Reviewers set to John Palmieri
  • Status changed from needs_review to needs_info

Evaluating an element of a quotient ring doesn't make mathematical sense in general, only if it makes sense to evaluate the lift: if you're taking a quotient of a group algebra or the p-adics, what does it mean to evaluate an element of it? I'm attaching a new patch which adds a comment about this to the docstring; is this enough warning?

I'm happy with the original patch as far as it goes, and I'm almost ready to give it a positive review, but I'd like to hear opinions about the issue I raised.

Changed 10 years ago by jhpalmieri

for reference only; difference beteen initial patch and jhp patch

Changed 10 years ago by jhpalmieri

apply this one

comment:4 Changed 10 years ago by fwclarke

Even with the extra warning in the docstring, users could very easily be misled. For to make the evaluation independent of the lift it is necessary for the ideal defining the quotient to annihilate the argument.

I think it would be sensible to have a parameter 'check' with default True, and a clause like:

if check and any(g(args) !=0 for g in f.parent().defining_ideal().gens()):
    raise ValueError, "argument not in the zero set of the ideal"

That way an unthinking user is not going to be caught out, while someone who knows what they're doing can speed things up by setting 'check=False'.

comment:5 Changed 8 years ago by jdemeyer

  • Milestone changed from sage-5.11 to sage-5.12

comment:6 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:7 Changed 8 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:8 Changed 7 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4
Note: See TracTickets for help on using tickets.