Skip to content

Order builtin is wrong for monomial products of symbols #1886

Description

@rocky

Description

Mathematica treats symbols later in the alphabet ($z, y, x, \dots$) as "variables" with higher precedence than symbols early in the alphabet ($a, b, c, \dots$), which it views as "constants" or "coefficients".

Mathics3 appears to be sorting from left to right (or lower index to higher).

For example, consider Order[b c, a d].

Because $d$ is higher in the variable hierarchy than $c$, $ad$ is treated as having a "higher variable degree" than $bc$, placing $ad$ later in canonical polynomial order (e.g., $c + b x + a x^2$).

How to Reproduce and Output Given

In[1]:= Order[b c, a d]
Out[1]= -1

Expected behavior

In[1]:= Order[b c, a d]
Out[1]= 1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions