Hello everybody, I am new in the comunity, just joined and I am also a beginner in Mathematica.

I really hope somebody can help me.

I am having a problem with making the product of matrices in mathematica.

The code is very simple I am just creating a function that create a Matrices that has some parameters I pass to the function.

The first time I run the nb, just after I started Mathematica it works perfectly and it is fast.

The problem is that when I ask to evaluate it a second time, for example after changing some parameters values, it takes for ever and I can wait also 5/10 minutes before to have the output. If I abort the evaluation and I start it again it works fine.But I have to do it every time and I simply don't understand why.

Could please somebody help me with this?

Cheers

Here is the very simple code

ClearAll;

fMZI[\2_, \_, \1_] := {{Sqrt[\2], I Sqrt[1 - \2]}, {I Sqrt[1 - \2], Sqrt[\2]}}.{{Exp[I*\], 0}, {0, 1}}.{{Sqrt[\1], Sqrt[1 - \1]}, {I Sqrt[1 - \1], Sqrt[\1]}}

UNITARY = fMZI[0.3, \/3, 0.1];

UNITARY // MatrixForm