Opened 5 years ago

Last modified 5 years ago

#15437 new enhancement

Add basic ideals to Laurent Polynomials

Reported by: mmarco Owned by: mmarco
Priority: major Milestone: sage-6.4
Component: commutative algebra Keywords: Laurent polynomials, ideals
Cc: roed, mhansen, vbraun, defeo Merged in:
Authors: mmarco Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Description

This patch adds basic ideals to Laurent Polynomials. It does so by using an auxiliary polynomial ring with new variables $\bar{t_i}$, and the relations ${t\cdot \bar{t_i}-1$.

Attachments (1)

trac_15437_laurent_ideals.patch (143.7 KB) - added by mmarco 5 years ago.

Download all attachments as: .zip

Change History (7)

Changed 5 years ago by mmarco

comment:1 Changed 5 years ago by mmarco

Pickling fails, i don't know why:

sage: L=LaurentPolynomialRing(QQ,3,'t')
sage: loads(dumps(L))
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-fe3c73a77523> in <module>()
----> 1 loads(dumps(L))
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.loads (sage/structure/sage_object.c:11044)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8316)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.convert_map_from (sage/structure/parent.c:16121)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.discover_convert_map_from (sage/structure/parent.c:162
86)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.coerce_map_from (sage/structure/parent.c:14849)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent._register_pair (sage/structure/parent.c:22017)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.EltPair.__hash__ (sage/structure/parent.c:21664)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/category_object.so in sage.structure.category_object.CategoryObject.__hash__ (sage/structure/cat
egory_object.c:8312)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial_ring.pyc in __repr__(self)
    449             'Univariate Laurent Polynomial Ring in x over Rational Field'
    450         """
--> 451         if self._n == 1:
    452             return "Univariate Laurent Polynomial Ring in %s over %s"%(self._R.variable_name(), self._R.base_ring())
    453         else:
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__getattr__ (sage/structure/parent.c:6736)()
 
<type 'str'>: (<type 'exceptions.AttributeError'>, AttributeError('LaurentPolynomialRing_mpair_with_category' object has no attribute '_n',))

comment:2 Changed 5 years ago by defeo

  • Cc defeo added

comment:3 Changed 5 years ago by mmarco

Another issue is that, if we define a quotient ring, the elements fail to be respresented. I think it is because, somehow, the init method is not properly run, and then they don't get the rep atribute:

sage: L=LaurentPolynomialRing(QQ,3,'t')
sage: L.inject_variables()
Defining t0, t1, t2
sage: I=L.ideal([t0*t1-t2**(-2),t1*t2-3*t0**2+1,t1*t2-t0**(-3)])
sage: RB=sage.rings.quotient_ring.QuotientRing(L,I)
sage: RB
Quotient of Multivariate Laurent Polynomial Ring in t0, t1, t2 over Rational Field by the ideal (t0*t1 - t2^-2, -3*t0^2 + t1*t2 + 1, t1*t2 - t0^-3)
sage: RB(t0)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-31-84ddc2a90887> in <module>()
----> 1 RB(t0)
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in __call__(self, result)
    236             self.start_displayhook()
    237             self.write_output_prompt()
--> 238             format_dict = self.compute_format_data(result)
    239             self.write_format_data(format_dict)
    240             self.update_user_ns(result)
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/core/displayhook.pyc in compute_format_data(self, result)
    148             MIME type representation of the object.
    149         """
--> 150         return self.shell.display_formatter.format(result)
    151
    152     def write_format_data(self, format_dict):
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in format(self, obj, include, exclude)
    124                     continue
    125             try:
--> 126                 data = formatter(obj)
    127             except:
    128                 # FIXME: log the exception
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/misc/displayhook.pyc in __call__(self, obj)
    508         s = self.try_format_obj(obj)
    509         if s is None:
--> 510             s = super(SagePlainTextFormatter, self).__call__(obj)
    511         return s
    512
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/core/formatters.pyc in __call__(self, obj)
    445                 type_pprinters=self.type_printers,
    446                 deferred_pprinters=self.deferred_printers)
--> 447             printer.pretty(obj)
    448             printer.flush()
    449             return stream.getvalue()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in pretty(self, obj)
    358                             if callable(meth):
    359                                 return meth(obj, self, cycle)
--> 360             return _default_pprint(obj, self, cycle)
    361         finally:
    362             self.end_group()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/IPython/lib/pretty.pyc in _default_pprint(obj, p, cycle)
    478     if getattr(klass, '__repr__', None) not in _baseclass_reprs:
    479         # A user-provided repr.
--> 480         p.text(repr(obj))
    481         return
    482     p.begin_group(1, '<')
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1
921)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/quotient_ring_element.pyc in _repr_(self)
    218             return str(self.__rep)
    219         with localvars(R, P.variable_names(), normalize=False):
--> 220             return str(self.__rep)
    221
    222     def _pari_(self):
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/sage_object.so in sage.structure.sage_object.SageObject.__repr__ (sage/structure/sage_object.c:1
921)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial.so in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair
._repr_ (sage/rings/polynomial/laurent_polynomial.c:4464)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial.so in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair
._compute_polydict (sage/rings/polynomial/laurent_polynomial.c:4366)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/laurent_polynomial.so in sage.rings.polynomial.laurent_polynomial.LaurentPolynomial_mpair
._dict (sage/rings/polynomial/laurent_polynomial.c:4165)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/multi_polynomial.so in sage.rings.polynomial.multi_polynomial.MPolynomial._mpoly_dict_rec
ursive (sage/rings/polynomial/multi_polynomial.c:6415)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/parent.so in sage.structure.parent.Parent.__call__ (sage/structure/parent.c:8372)()
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/rings/polynomial/polynomial_element.so in sage.rings.polynomial.polynomial_element.ConstantPolynomialSecti
on._call_ (sage/rings/polynomial/polynomial_element.c:49290)()
 
TypeError: not a constant polynomial
sage: a=RB(t0)
sage: a.__rep
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-33-ce9f756d0b3b> in <module>()
----> 1 a.__rep
 
/mnt/home/njsgxy8n/sage-5.12-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/local/lib/python2.7/site-packages/sage/structure/element.so in sage.structure.element.Element.__getattr__ (sage/structure/element.c:3761)()
 
AttributeError: 'QuotientRing_generic_with_category.element_class' object has no attribute '__rep'

comment:4 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:5 Changed 5 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:6 Changed 5 years ago by vbraun_spam

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