I frequently deal with matrix/vector calculus problems and would like to get the answers in matrix/vector form. The number of elements in these matrices and vectors is not specified, and the desired results are in matrix form anyway, not exploded out elements.

For example: d/dx x'Cx = x'(C'+C)

(x is column vector, C is a matrix and ' means transpose)

Is there a symbolic solver that could tell me that? As it stands now, I can use Matlab's solver if I make example vectors and matrices with all elements specified, but then it's on me to interpret the mess that comes out and try to form it back into the original matrices and vectors.

  • $\begingroup$ I think sympy has some ability to deal with vectors, but I’m not sure whether it fits your requirements $\endgroup$
    – tbrugere
    Jan 17, 2022 at 22:15
  • $\begingroup$ It works like a charm: In [7]: diff(v.T*C*v,v) -> Out[7]: C*v + C.T*v. If you want to make an answer I'll mark it solved. Thanks. $\endgroup$
    – Mastiff
    Jan 17, 2022 at 22:53
  • $\begingroup$ done, glad it helped! $\endgroup$
    – tbrugere
    Jan 17, 2022 at 23:17

1 Answer 1


Sympy has some ability to deal with vectors (related documentation)


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .