From a8335b0e3547beb01aa4cf91bc1e50f4fc6d069b Mon Sep 17 00:00:00 2001 From: Matthias Zach <85350711+HechtiDerLachs@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:09:17 +0100 Subject: [PATCH] Bugfix for printing of affine schemes (#3437) * Fix printing of of affine schemes. --- .../Schemes/MorphismFromRationalFunctions.jl | 2 +- .../AffineSchemes/Objects/Constructors.jl | 2 +- .../Schemes/AffineSchemes/Objects/Methods.jl | 24 ++++++++++++++----- src/Rings/mpoly-localizations.jl | 2 +- 4 files changed, 21 insertions(+), 9 deletions(-) diff --git a/experimental/Schemes/MorphismFromRationalFunctions.jl b/experimental/Schemes/MorphismFromRationalFunctions.jl index 22187071e7f5..3c7746fc872e 100644 --- a/experimental/Schemes/MorphismFromRationalFunctions.jl +++ b/experimental/Schemes/MorphismFromRationalFunctions.jl @@ -134,7 +134,7 @@ julia> realizations = Oscar.realize_on_patch(Phi, U); julia> realizations[3] Affine scheme morphism - from [(t//s)] AA^1 \ scheme() + from [(t//s)] AA^1 to [(x//z), (y//z)] affine 2-space given by the pullback function (x//z) -> (t//s)^2 diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl index dfd85beb8495..8bb117f648af 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Constructors.jl @@ -513,7 +513,7 @@ Spectrum of localization of multivariate polynomial ring in 3 variables x1, x2, x3 over rational field - at products of (x1,x2) + at products of (x1, x2) ``` """ function hypersurface_complement(X::AbsAffineScheme, f::Vector{<:RingElem}) diff --git a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl index 71ca2d2847c6..ee8e90981a93 100644 --- a/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl +++ b/src/AlgebraicGeometry/Schemes/AffineSchemes/Objects/Methods.jl @@ -76,18 +76,30 @@ function _show(io::IO, X::AbsAffineScheme{<:Any, <:MPolyQuoLocRing{<:Any, <:Any, I = modulus(OO(X)) S = inverted_set(OO(X)) join(io, gens(I), ", ") - print(io, raw") \ scheme(") - join(io, denominators(S), ",") - print(io, ")") + if is_empty(denominators(S)) + print(io, raw")") + elseif isone(length(denominators(S))) + print(io, raw") \ scheme(", first(denominators(S)), ")") + else + print(io, raw") \ scheme((") + join(io, denominators(S), ")*(") + print(io, "))") + end end function _show(io::IO, X::AbsAffineScheme{<:Any, <:MPolyLocRing{<:Any, <:Any, <:Any, <:Any, <:MPolyPowersOfElement}}) io = pretty(io) print(io, LowercaseOff(), "AA^", ngens(OO(X))) S = inverted_set(OO(X)) - print(io, raw" \ scheme(") - join(io, denominators(S), ",") - print(io, ")") + if is_empty(denominators(S)) + # do nothing more + elseif isone(length(denominators(S))) + print(io, raw" \ scheme(", first(denominators(S)), ")") + else + print(io, raw" \ scheme((") + join(io, denominators(S), ")*(") + print(io, "))") + end end ######################################################## diff --git a/src/Rings/mpoly-localizations.jl b/src/Rings/mpoly-localizations.jl index 60ec70c6e97e..38da6198582f 100644 --- a/src/Rings/mpoly-localizations.jl +++ b/src/Rings/mpoly-localizations.jl @@ -125,7 +125,7 @@ function Base.show(io::IO, S::MPolyPowersOfElement) print(io, ItemQuantity(length(denominators(S)), "element")) else print(io, "Products of (") - join(io, denominators(S), ",") + join(io, denominators(S), ", ") print(io, ")") end end