Ticket #13736: trac_13736-content-take2.patch

File trac_13736-content-take2.patch, 1.8 KB (added by burcin, 9 years ago)
  • sage/libs/ginac.pxd

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1353508690 -3600
    # Node ID d016e574a4a2b050a32922c458a6bee945499270
    # Parent  3c8e08404139569d9aa891f52312b8433eff7c24
    trac 13736: Add _content() method to symbolic expressions.
    
    diff --git a/sage/libs/ginac.pxd b/sage/libs/ginac.pxd
    a b  
    8888        GEx numer_denom()             except +
    8989        int degree(GEx expr)          except +
    9090        int ldegree(GEx expr)         except +
     91        GEx content(GEx expr)         except +
    9192        GEx rhs()                     except +
    9293        GEx lhs()                     except +
    9394        int nops()                    except +
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    49174917        cdef Expression ss = self.coerce_in(s)
    49184918        return self._gobj.degree(ss._gobj)
    49194919
     4920    def _content(self, s):
     4921        """
     4922        Return the content of this expression with respect to the
     4923        expression ``s``.
     4924
     4925        .. warning::
     4926
     4927            The values returned by this function may not be compatible with
     4928            the output of the ``content()`` method provided by various
     4929            polynomial rings in Sage.
     4930
     4931        EXAMPLES::
     4932
     4933            sage: (2*x+4)._content(x)
     4934            2
     4935            sage: (2*x+1)._content(x)
     4936            1
     4937            sage: (2*x+1/2)._content(x)
     4938            1/2
     4939            sage: var('y')
     4940            y
     4941            sage: (2*x + 4*sin(y))._content(sin(y))
     4942            2
     4943        """
     4944        cdef Expression ss = self.coerce_in(s)
     4945        return new_Expression_from_GEx(self._parent, self._gobj.content(ss._gobj))
     4946
    49204947    def poly(self, x=None):
    49214948        r"""
    49224949        Express this symbolic expression as a polynomial in *x*. If