I'm new here so I'm a little lost.

I need to minimize a function considering that the minimizing parameter belongs to a preestablished set. It all involves matrices.It's something like this:

enter image description here

Where enter image description here is a 8x8 given matrix (which has a variable p), G is the set I need to create and enter image description here represents an element of such a set, which is composed of 8x8 matrices. In the group G all enter image description here with a single subscript (A, B or C) are 2x2 matrices and enter image description here with two subscripts (BC, AC or AB) are 4x4 matrices, so the 8x8 matrices of the group are resulted from Kronecker products (as shown above) and they also depend on p. Therefore the output on Minimize should be an expression depending on p cause I'm using Trace. I tried to input exactly like that on Mathematica but (of course) it doesnt work, cause I really don't know how to deal with Lists.

The message that appears: enter image description here

  • 1
    $\begingroup$ More details would be helpful. What group? Is it a finite group? Write down as much as you can in Mathematica syntax, give us an example input with desired output, and so on. A sample rho is necessary too. $\endgroup$
    – march
    Commented Feb 15, 2021 at 21:50
  • $\begingroup$ @march I've edited it hope its ok now. Thank you for your time. $\endgroup$
    – Carollice
    Commented Feb 16, 2021 at 14:36
  • 1
    $\begingroup$ Min[Table[Tr[rho . MatrixLog[rho]] - Tr[rho . MatrixLog[sigma]], {sigma, G}]] or something like it? I forget if there’s a MatrixLog built in, or it was in a Q&A... $\endgroup$
    – Michael E2
    Commented Feb 16, 2021 at 14:49
  • $\begingroup$ @MichaelE2 It didn't work for me. I defined a function "log" based on MatrixLog and it works on the rest of the code so I don't think that's the problem. $\endgroup$
    – Carollice
    Commented Feb 17, 2021 at 19:13
  • $\begingroup$ I feel I'm probably not understanding the problem. I suggest including code for generating G and code for your log function. Most problems with code not working require the code. You are much more likely to get someone to investigate if it is easy for them to copy something and compute with it. $\endgroup$
    – Michael E2
    Commented Feb 17, 2021 at 19:25

1 Answer 1


Using random rho and sigma matrices, here's a proof of concept:

rho = #\[Transpose] . # &@RandomReal[{-1, 1}, {8, 8}];
sX = {sA, sB, sC} = #\[Transpose] . # & /@ 
    RandomReal[{-1, 1}, {3, 2, 2}];
sXY = {sBC, sAC, sAB} = #\[Transpose] . # & /@ 
    RandomReal[{-1, 1}, {3, 4, 4}];
G = MapThread[KroneckerProduct, {sX, sXY}];
Min[Table[Tr[rho.MatrixLog[rho]] - Tr[rho.MatrixLog[sigma]], {sigma, G}]]

(*  25.0909  *)

You could use your own log[] and also write G explicitly:

G = {KroneckerProduct[sA, sBC],
     KroneckerProduct[sB, sAC],
     KroneckerProduct[sC, sAB]};

Minimize probably won't work because the variables have to represent real numbers, not members of a discrete group of matrices.

  • $\begingroup$ I'm still have a problem: my matrices depend on a variable, let's say "p", so the output I get using your answer it's just Min['expression1', 'expression2', 'expression3'] . I saw that Min gives a real number output, so that's probably why I get that output. So I still need a minimization function that gives me as an output an expression depending on "p". If anyone could help I'd apreciate it very very much. And thank you @Michael E2 !!!! $\endgroup$
    – Carollice
    Commented Mar 10, 2021 at 22:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.