Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
28147: Remove _derivative
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrenet committed Jul 9, 2019
1 parent d1d7948 commit 6384e2e
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions src/sage/rings/polynomial/polynomial_template.pxi
Expand Up @@ -804,43 +804,3 @@ cdef class Polynomial_template(Polynomial):
if not have_ring:
self.parent()._singular_(singular).set_ring() #this is expensive
return singular(self._singular_init_())

def _derivative(self, var=None):
r"""
Returns the formal derivative of self with respect to var.
var must be either the generator of the polynomial ring to which
this polynomial belongs, or None (either way the behaviour is the
same).
.. SEEALSO:: :meth:`.derivative`
EXAMPLES::
sage: R.<x> = Integers(77)[]
sage: f = x^4 - x - 1
sage: f._derivative()
4*x^3 + 76
sage: f._derivative(None)
4*x^3 + 76
sage: f._derivative(2*x)
Traceback (most recent call last):
...
ValueError: cannot differentiate with respect to 2*x
sage: y = var("y")
sage: f._derivative(y)
Traceback (most recent call last):
...
ValueError: cannot differentiate with respect to y
"""
if var is not None and var is not self._parent.gen():
raise ValueError("cannot differentiate with respect to %s" % var)

P = self.parent()
x = P.gen()
res = P(0)
for i,c in enumerate(self.list()[1:]):
res += (i+1)*c*x**i
return res

0 comments on commit 6384e2e

Please sign in to comment.