Skip to content

(matrix{{x}})^2 != matrix{{x^2}} #4114

@pzinn

Description

@pzinn

As discussed on zulip, right now we have

i1 : R=QQ[x]

o1 = R

o1 : PolynomialRing

i2 : (matrix{{x}})^2 == matrix{{x^2}}

o2 = false

which is borderline absurd.

I've always found this way of dealing with degrees incorrect. If we decide that m=matrix{{x}} is a map (of degree 0) from R^{-1} to R^{0}, which is the current convention, then we should be consistent and also apply it to products and powers, i.e., m^2 should be a map (also of degree 0) from R^{-2} to R^{0}.

I believe the culprit is this section of Matrix * Matrix in matrix.m2:

	  dif := degrees P - degrees Q;
	  deg := (
	       if #dif === 0
	       then degree m + degree n
	       else if same dif
	       then degree m + degree n + dif#0
 	       else toList (degreeLength ring m:0)
	       );

the degree of m*n should always be degree m+degree n (in particular, preserving the degree 0 case, i.e., preserving homogeneity of maps). So instead of the code above, one should degree-shift the source and target of n to align the target of n and the source of m.

Incidentally this would also resolve another annoying issue:

i3 : (matrix{{x}})^0
stdio:3:13:(3): error: expected source and target to agree

Metadata

Metadata

Assignees

No one assigned

    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