Skip to content

Commit 478bc87

Browse files
committed
Fixed derivative of constant matrix in matrix_dense.pyx
1 parent dc99dc8 commit 478bc87

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/sage/matrix/matrix_dense.pyx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ cimport sage.matrix.matrix as matrix
1313
from sage.structure.richcmp cimport richcmp_item, rich_to_bool
1414
import sage.matrix.matrix_space
1515
import sage.structure.sequence
16+
import sage.calculus.functional
1617

1718

1819
cdef class Matrix_dense(matrix.Matrix):
@@ -275,11 +276,17 @@ cdef class Matrix_dense(matrix.Matrix):
275276
sage: m._derivative(x) # needs sage.symbolic
276277
[ 0 1]
277278
[ 2*x 3*x^2]
279+
280+
TESTS:
281+
282+
sage: u = matrix(1, 2, [-1, 1])
283+
sage: derivative(u, x)
284+
[0 0]
278285
"""
279286
# We could just use apply_map
280287
if self._nrows==0 or self._ncols==0:
281288
return self.__copy__()
282-
v = [z.derivative(var) for z in self.list()]
289+
v = [sage.calculus.functional.derivative(z, var) for z in self.list()]
283290
if R is None:
284291
v = sage.structure.sequence.Sequence(v)
285292
R = v.universe()

0 commit comments

Comments
 (0)