Macaulay2 / M2

The primary source code repository for Macaulay2, a system for computing in commutative algebra, algebraic geometry and related fields.
https://macaulay2.com
347 stars 231 forks source link

problem with localization #923

Closed LeslieRoberts closed 3 years ago

LeslieRoberts commented 5 years ago

Let $I$ be an ideal in a polynomial ring $R=QQ[x_1,\ldots,x_n]$ and $P$ be a prime ideal in $R$. The command localize(I,P) (from the package PrimaryDecomposition which is loaded on startup) is supposed to give $R\cap IR_P$. But sometimes it gives an incorrect answer. An example of this is $R=QQ[x_1],P=(x_1), J=(x_1^3+x_1^2)$ where localize(I,P) gives $(x_1^3+x_1^2)$ instead of the correct value $x_1^2$.

In the language of Zariski-Samuel Volume I Chapter 4 Section 8 (as well as several more recent books) $R\cap IR_P$ is the ideal $I^{ec}$ relative to the canonical ring inclusion $R\to R_P$. A possible work around is to use primary decomposition in $R$ and properties of $I^{ec}$ such as Section 10 Theorem 17 of Zariski-Samuel. In the above example Macaulay2 gives primaryDecomposition J equal to $(x_1^2)\cap(x_1+1)$ from which Theorem 17 yields that $R\cap IR_P$ is indeed equal to $x_1^2$.

robertsl@mast.queensu.ca

DanGrayson commented 5 years ago

Thanks for the bug report!

mahrud commented 3 years ago

@jchen419 I couldn't figure out why this is happening in our code. Any ideas?

jchen419 commented 3 years ago

First, let me note that calling

localize(I, P, Strategy => 0)

seems to work fine on this example (although the default strategy is 1). In any case, I think I know what the issue is: in the function SYlocalize at PrimaryDecomposition/Eisenbud-Huneke-Vasconcelos.m2, the example above is an instance where the variable "IntersectionOfPrimes" is not the unit ideal, but its image in "RP" (= R/P) is. Replacing line 91 with

f := first select(flatten entries generators gb IntersectionOfPrimes, g -> g % P1 != 0);

seems to work. This is also more similar to the style I used in the main primary decomposition routine for modules - in the future it would be good to rewrite the localize function (the current code has probably not been touched in over a decade...).

DanGrayson commented 3 years ago

By the way, 0 and 1 are not good names for strategies.