# Odd problem with product of Matrices

GROUPS:
 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?CheersHere is the very simple codeClearAll;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
4 years ago
5 Replies
 Sean Clarke 1 Vote It looks like something might have gone wrong when you copied your code. The code you provided has many backslashes in it and isn't syntactically correct. Here is your code again, but without the slashes:fMZI[a_, b_, c_] := {{Sqrt[c], I Sqrt[1 - c]}, {I Sqrt[1 - c], Sqrt[c]}}.{{Exp, 0}, {0, 1}}.{{Sqrt[a], Sqrt[1 - a]}, {I Sqrt[1 - a], Sqrt[a]}}UNITARY = fMZI[0.3, 3, 0.1];UNITARY//MatrixFormI wasn't able to reproduce the problem you mentioned with this code. Are you able to? One thing to try is to reset Mathematica's configuration to installation default settings.
4 years ago
 Yes!  thank you very much for correcting it and for your answer!  I don't know why it changed in this way in the pasting process. I tried your proposed solution but it didn't work,also after cleaning the directories, the problem is always the same.The weird thing is that I installed a trial version of Mathematica on another machine and with the same program the code works just fine.It is quite weird.Could it be the fact that in the machine where the problem was observed, I don't have full administrator rights but just superuser rights?