# 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
Answer
5 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.
Answer
5 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?
Answer
5 years ago
 Sean Clarke 1 Vote Please make sure you have restarted Mathematica. This will prevent any extraneous defintions that were made from being part of the problem.If you continue to see these issues, I would suggest contacting Wolfram Technical Support via email at (support@wolfram.com). Please be sure to include your activation key and a description of your problem in the email. Please also mention what you have tried to resolve the issue and attach a notebook of the output of evaluating the function SystemInformation[] in Mathematica. Evaluating SystemInformation[], produces a dialog with information about your computer, which will help them better understand the issue.
Answer
5 years ago
 Already restarted and the problem is still there.Thank you very much for all these informations, I will try to contact them.bye
Answer
5 years ago
 Raffaele Santagati 1 Vote Hello! I finally solved the problem uninstalling and reinstalling my copy of Mathematica. Now it works perfectly.Thanks for your help!
Answer
5 years ago