Macaulay2 / M2

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

Rational Maps Package refuses to find an inverse #2800

Open AlicaMir opened 1 year ago

AlicaMir commented 1 year ago

A3 = QQ[x, y, z] A2 = QQ[u, v] f = x^3y - z^3 + 2z^2 + 4*z - 8 needsPackage "RationalMaps" F = A3 / f phi2 = rationalMapping(F, A2, {x, z}) isBirationalMap(phi2) -- true inv2 = inverseOfMap(phi2) --error baseLocusOfMap(inv2) --error

image Please, can someone explain, is it a bug?

d-torrance commented 1 year ago

I'm not familiar with this package, but when running Macaulay2 in standard mode (not the webapp), we actually get an error a bit earlier:

i6 : phi2 = rationalMapping(F, A2, {x, z})

--error or time limit reached in conversion of output to net: type 'debugError()' to run it again; will try conversion to string

o6 = new RationalMapping from {map => map(F,A2,{x, z}), cache => CacheTable{...0...}}

o6 : RationalMapping

This is because net(RationalMapping) (the function that tells Macaulay2 how to print a RationalMapping object) calls the following:

i7 : source phi2
stdio:7:1:(3): error: expected a homogeneous ring

Perhaps homogenizing would work? Something like:

i1 : A3 = QQ[x, y, z, w]

o1 = A3

o1 : PolynomialRing

i2 : f = x^3*y - z^3*w + 2*z^2*w^2 + 4*z*w^3 - 8*w^4

      3     3      2 2       3     4
o2 = x y - z w + 2z w  + 4z*w  - 8w

o2 : A3
kschwede commented 1 year ago

Hi, Doug is correct, we were expecting homogeneous rings here. I'm not sure what is going on exactly, but these functions will not behave correctly in non-homogeneous settings. By the way, that map you are constructing looks 3-to-1, and in particular is not birational. I'll do a pull request so that you get a more useful error message if you try to pass a non-homogeneous ring to that constructor. Karl