Ticket #15059: trac_15059-multivariate_fix-dg.patch

File trac_15059-multivariate_fix-dg.patch, 1.5 KB (added by darij, 6 years ago)
  • sage/rings/multi_power_series_ring_element.py

    # HG changeset patch
    # User darij grinberg <darijgrinberg@gmail.com>
    # Date 1376831063 25200
    # Node ID 165522834ae0be89e424863d1651b8dc6671d397
    # Parent  27fcda614e77e0596f62de4430270c34b2a0356e
    trac #15059: modifying __call__ on elements of multivariate power series rings to avoid calling add_bigoh on elements of the base ring
    
    diff --git a/sage/rings/multi_power_series_ring_element.py b/sage/rings/multi_power_series_ring_element.py
    a b class MPowerSeries(PowerSeries): 
    437437
    438438            sage: f.truncate()(t,2)
    439439            2*t + 3*t^2 + 7*t^3 + 3*t^4
     440
     441        Checking that :trac:`15059` is fixed::
     442
     443            sage: M.<u,v> = PowerSeriesRing(GF(5))
     444            sage: s = M.hom([u, u+v])     
     445            sage: s(M.one())
     446            1
    440447        """
    441448        if len(x) != self.parent().ngens():
    442449            raise ValueError("Number of arguments does not match number of variables in parent.")
    443450
    444451        sub_dict = {}
    445         valn_list =[]
     452        valn_list = []
    446453        for i in range(len(x)):
    447454            try:
    448455                 xi = self.parent(x[i])
    class MPowerSeries(PowerSeries): 
    461468            newprec = infinity
    462469        else:
    463470            newprec = self.prec()*min(valn_list)
    464         return self._value().subs(sub_dict).add_bigoh(newprec)
     471        return self.parent()(self._value().subs(sub_dict)).add_bigoh(newprec)
    465472
    466473    def _subs_formal(self, *x, **kwds):
    467474        """