I'm trying to compute derivatives of the form
D[Tr[A],x] for A being a large polynomial in a single variable $x$. Mathematica always gets me the result with formal derivatives of the trace itself, that I don't want (Note that Tr[A]^2, Tr[A.A], ... all can happen). I was thinking, is there a way of extracting all the variables x from the linear function Tr? Say that, for example, A = B + x C, is it possible to tell Mathematica to first write the trace as Tr[B] + x Tr[C] and then take the derivative?
$\begingroup$
$\endgroup$
5
-
1$\begingroup$ Please show a sample of the matrix $A$ as Mathematica code. $\endgroup$A. Kato– A. Kato2025-03-04 03:30:13 +00:00Commented Mar 4 at 3:30
-
$\begingroup$ TR works on matrices. Tr[A] where A is a polynomial in x is not defined. $\endgroup$Daniel Huber– Daniel Huber2025-03-04 11:26:26 +00:00Commented Mar 4 at 11:26
-
$\begingroup$ Hi all, thanks for your answers. $A$ here looks like $A = a + b x + c x^2$, where $a,b,c$ are unspecified matrices (now that I think about it, should I tell Mathematica that these are actually matrices? How do I do so without specifying them?) and $x$ is just a variable. $\endgroup$Fr6– Fr62025-03-04 13:11:26 +00:00Commented Mar 4 at 13:11
-
3$\begingroup$ Are you trying to do something like this? $\endgroup$ydd– ydd2025-03-04 15:21:31 +00:00Commented Mar 4 at 15:21
-
$\begingroup$ Since so far OP hasn't replied to ydd's comment, I'd say the question requires further clarification thus off-topic for now. Please edit your question to make it clearer. (Showing an example of expected input and output would be helpful. ) The question will be reopened once it meets the standard of the site. $\endgroup$xzczd– xzczd ♦2025-10-10 11:50:53 +00:00Commented Oct 10 at 11:50
Add a comment
|


