Tag Info

New answers tagged


If you have version 10 or later you can use operators forms, i.e. Map[Tr] acts as a function: mylistofmatrices = {{{a, b}, {c, d}}, {{q, r, s}, {t, u, v}}}; Map[Tr][mylistofmatrices] {a + d, q + u} This is a subtle difference but it may be useful nevertheless. If you always want the trace of a tensor with a specific array depth you can check for ...


No, there isn't. There are several reasons for that: Tr operates on tensors of arbitrary rank, not just matrices Listable functions will automatically thread to the deepest level of lists, so if you set Tr to be Listable, it'll individually wrap each deepest element of a nested list, e.g. Tr[{{1,2},{3,4}}] would transform to {{Tr[1], Tr[2]}, {Tr[3], ...

Top 50 recent answers are included