# 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
|
|
88 | 88 | GEx numer_denom() except + |
89 | 89 | int degree(GEx expr) except + |
90 | 90 | int ldegree(GEx expr) except + |
| 91 | GEx content(GEx expr) except + |
91 | 92 | GEx rhs() except + |
92 | 93 | GEx lhs() except + |
93 | 94 | int nops() except + |
diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
a
|
b
|
|
4917 | 4917 | cdef Expression ss = self.coerce_in(s) |
4918 | 4918 | return self._gobj.degree(ss._gobj) |
4919 | 4919 | |
| 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 | |
4920 | 4947 | def poly(self, x=None): |
4921 | 4948 | r""" |
4922 | 4949 | Express this symbolic expression as a polynomial in *x*. If |