Skip to content

Reject zero substitutions in Laurent denominators#4357

Open
pzinn wants to merge 1 commit into
Macaulay2:developmentfrom
pzinn:subinvzero
Open

Reject zero substitutions in Laurent denominators#4357
pzinn wants to merge 1 commit into
Macaulay2:developmentfrom
pzinn:subinvzero

Conversation

@pzinn
Copy link
Copy Markdown
Contributor

@pzinn pzinn commented May 23, 2026

I forget if I ever submitted an issue:

   R=QQ[x,Inverses=>true,MonomialOrder=>Lex]
   f=matrix{{x^-1,1/2}}
   sub(f,x=>0)

will happily produce matrix{{0,1/2}} instead of throwing an error. Fixed with test.

AI Disclosure

codex helped me diagnose this.

@d-torrance d-torrance added the Engine Macaulay2/e label May 23, 2026
@pzinn
Copy link
Copy Markdown
Contributor Author

pzinn commented May 23, 2026

Interestingly, this PR unearthed a bug in an example of InvariantRing:
https://www.unimelb-macaulay2.cloud.edu.au/usr/share/doc/Macaulay2/InvariantRing/html/_equivariant__Hilbert__Series.html
Note that last substitution at z_0, z_1 = 0.
@LuigiFerraro88 @galettof @fragandi @whuang259 @mnmastro @xlni

Copy link
Copy Markdown
Member

@mahrud mahrud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable to me, but I fear the chance of conflicting with the two engine refactoring PRs is significant at the moment, so it would make sense to wait until those are merged first, then apply this small fix.

@galettof
Copy link
Copy Markdown
Contributor

Of course this makes sense mathematically. However, it was a convenient "feature" to able to use sub to extract the part of the polynomial that is constant in the z variables. I have some code that works but it is not particularly elegant.

R = QQ[x_1..x_3]
W = matrix{{-1,0,1},{0,-1,1}}
T = diagonalAction(W, R)
E = equivariantHilbertSeries(T, Order => 7)
(Z,phi) = flattenRing ring E;
(product toList coefficients(phi E,Monomials=>apply(7,i->Z_0^i)))_(0,0)

Surely, there must be a better, less ad-hoc way to achieve something like this. Any suggestions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Engine Macaulay2/e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants