Why do we order the variables in certain physics questions the way we do? I'm writing a script involving physics equations, and someone complained that my script outputs $F = m a$ as $F = a m$, as well as outputting $E_p = m g h$ as $E_p = g h m$; another example would be $E = m c^2$ vs $E = c^2 m$. I've obviously opted for displaying the variables in the equations in alphabetical order, and it looks wrong because it's against convention - but why are the variables ordered in the way they conventionally are in the first place?
From what I can see of all the examples I've just given, the out-of-place variable is mass, so perhaps the convention is to put mass first? I don't see any reason why that would be the case though.
 A: Mass isn't always first. For example we write Newton's law for the force between two objects as:
$$ F = \frac{Gm_1m_2}{r^2} $$
I don't think there are hard and fast rules. I suspect conventions have arisen over the years and we have all got used to what we learned at school, which was taught by teachers who are used to what they learned at school and so on.
We tend to put constants first, as in the case above where Newton's constant $G$ is first, and in many cases the mass is a constant. For example when we write:
$$ F = ma $$
In the vast majority of cases $m$ is constant and that's probably why we put it first.
A: I would add to John's answer that $a$ is not always constant. It represents the second derivative of motion, and thus is potentially a function of time. So, the overall conventional ordering in equations (in Mathematics as well as Physics) is,
$$\mathrm{Constant  \times Parameter \times Variable}$$ where I'm distinguishing between, say, $G$ which is universal, and mass, which one plugs in a relevant value for. Besides, we  all know, that $F=ma$ is not true.
$F= \dot{p}$  is!
