Ticket #13736: trac_13736-content.patch

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

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1353508690 -3600
    # Node ID d012102e0e41f5f8cfd5b4a96bf4ff74d0ff80b9
    # Parent  0690a0801edb5e5ba43dad25400043ba32114b95
    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  
    47534753        cdef Expression ss = self.coerce_in(s)
    47544754        return self._gobj.degree(ss._gobj)
    47554755
     4756    def content(self, s):
     4757        """
     4758        Return the content of this expression with respect to the
     4759        expression ``s``.
     4760
     4761        EXAMPLES::
     4762
     4763            sage: (2*x+4).content(x)
     4764            2
     4765            sage: (2*x+1).content(x)
     4766            1
     4767            sage: (2*x+1/2).content(x)
     4768            1/2
     4769            sage: var('y')
     4770            y
     4771            sage: (2*x + 4*sin(y)).content(sin(y))
     4772            2
     4773        """
     4774        cdef Expression ss = self.coerce_in(s)
     4775        return new_Expression_from_GEx(self._parent, self._gobj.content(ss._gobj))
     4776
     4777
    47564778    def poly(self, x=None):
    47574779        r"""
    47584780        Express this symbolic expression as a polynomial in *x*. If