No, you are right; there "does not seem to be a document page that tells us that "2x is valid"" but there should be (if not a page, a line of clarification). If it is good enough for the documentation to confirm the mathematically obvious 0x = 0 then one might reasonably expect that it also be good enough to state:
cx
parses to Times[c, x]
when c
appears as an atomic, real number (but not as basic constants like \[Pi]
and E).
With such an insertion it becomes clear, for example, why (possibly against initial expectations) each member of
does not evaluate to 0
unlike the expression
The last example illustrates how "mathematical obviousness" is not always the clear, disambiguating arbiter that might be initially presumed. This is further reinforced by the following elements not evaluating to 0
in apparent disregard of multiplicative commutativity (despite Times
being Orderless
) and BIMDAS' precedence rules (despite Times
's parsing generally conforming to it):
Of course, the above exemplifies the extra challenges faced by a computational system compared with traditional mathematical notation but it is also an argument for the importance of documentation clarity. While the particular case 2x
does appear elsewhere in the documentation, it is not foreshadowed in the initial specifications (as redundant as this may appear to experienced users) nor does its particular appearance necessarily infer the more general case.
The instructiveness of the OP's question seems to be less about the number 2
, a little more about how numbers/letters are parsed to the (fundamental) Times
operation but most of all it seems to be about users' relationship to the Help Documentation. The OP's question is probing to what extent the documentation should be taken as a formal description of the WL. The remarkable aspect of WL's documentation is how closely it does come to describing a formal grammar while retaining a natural expressiveness and consistency. Part of this involves completeness together with pedagogically progressing from the general to the particular and a general awareness of this constancy, IMO, invariably holds new users in good stead.
2x
cannot be interpreted as a symbol since symbol names cannot start with a number by convention (a convention shared by many languages). There is no ambiguity about what2x
means because of that, so that's why it can be valid syntax. $\endgroup$2x
contradicts the documentation, which itself contains the examples0x
and0.0x
, as well as2{x,y,z}
and{{a,b},{c,d}}{x,y}
which don't contain spaces. It says "Enter Times with spaces," but that's one alternative. The documentation is notoriously incomplete. For instance, it tells you that2 x
is sufficient to enterTimes[2,x]
, but it does not tell you whether the space is necessary. That the documentation is not a complete definition of the language does seem a valid criticism, but the documentation isn't meant to be one. $\endgroup$