I noticed that for the input a*b/c, b/c is evaluated first, and then a*(b/c).
In[1]:=FullForm@Hold[a*b/c]
Out[1]=Hold[Times[a,Times[b,Power[c,-1]]]]
But I don't know why.
Later I found a built-in function Precedence (which seems to not be in the official document, but it is in my Mathematica 14.0 software). With it, I found out that the precedence of Divide is higher than Times.
In[2]:=Precedence@# & /@ {Times, Divide, Plus, Subtract}
Out[2]={400., 470., 310., 310.}
Well, it's pretty easy to show that the result is correct although we give Divide a higher precedence than Times (as long as they are both left associative). But in most programming languages, * and / have the same precedence. It also makes sense to us.
So, why does Mathematica give Divide higher precedence? Is it to make the evaluation faster? Or are there other reasons?
If there are some good reasons for the unequal precedence, why does Plus and Subtract have the same precedence? (The result is correct even if - is higher than +, as long as they are both left associative)
*and/in precedence for some reason.Precedenceand get410to460.a*b/ctranslates toa/1 * b/1 * 1/c.