Comments (2)
Description changed:
---
+++
@@ -1,7 +1,9 @@
-{{{ sage: R.<x,y> = PolynomialRing(ZZ, 2)
+
+```
+sage: R.<x,y> = PolynomialRing(ZZ, 2)
sage: S = R/(x^2 + y^2); S
sage: S.<a,b> = R/(x^2 + y^2)
sage: a^2 + b^2 == 0
<< -- *should* be true or give an error -- will require macaulay2... >>
-}}}
+```
from sage.
Fixed.
# HG changeset patch
# User William Stein <[email protected]>
# Date 1169198371 28800
# Node ID cbda6c27c46e6e36c6c192550b172f79189ce974
# Parent 39c4cda2f4c474719648b289148014737a234682
Trac bug #39 -- fix issues with working with quotients of polynomial rings over ZZ and reduce method for their ideals.
diff -r 39c4cda2f4c4 -r cbda6c27c46e sage/rings/multi_polynomial_ideal.py
--- a/sage/rings/multi_polynomial_ideal.py Fri Jan 19 00:35:22 2007 -0800
+++ b/sage/rings/multi_polynomial_ideal.py Fri Jan 19 01:19:31 2007 -0800
@@ -35,6 +35,20 @@ benchmark and test ideal.
sage: B = I.groebner_basis()
sage: len(B)
45
+
+We compute in a quotient of a polynomial ring over Z/17*Z:
+ sage: R.<x,y> = PolynomialRing(ZZ, 2)
+ sage: S.<a,b> = R.quotient((x^2 + y^2, 17)) # optional -- requires Macaulay2
+ sage: S # optional
+ Quotient of Polynomial Ring in x, y over Integer Ring by the ideal (17, y^2 + x^2)
+ sage: a^2 + b^2 == 0 # optional
+ True
+ sage: a^3 - b^2 # optional
+ -1*b^2 - a*b^2
+ sage: (a+b)^17 # optional
+ b^17 + a*b^16
+ sage: S(17) == 0 # optional
+ True
"""
#*****************************************************************************
@@ -457,7 +471,7 @@ class MPolynomialIdeal_singular_repr:
I.parent().lib('primdec.lib')
r = I.radical()
return S.ideal(r)
-
+
def reduce(self, f):
"""
Reduce an element modulo a standard basis for this ideal.
@@ -481,21 +495,27 @@ class MPolynomialIdeal_singular_repr:
sage: (y^2 - x)^2
y^4 - 2*x*y^2 + x^2
"""
- try:
- try:
- S = self.__singular_groebner_basis.parent()
- except AttributeError:
- self.groebner_basis()
- S = self.__singular_groebner_basis.parent()
-
- f = self.ring()(f)
- g = self.__singular_groebner_basis.parent()(f)
- h = g.reduce(self.__singular_groebner_basis)
- return self.ring()(h)
-
- except TypeError:
-
- return f
+ if self.base_ring() == sage.rings.integer_ring.ZZ:
+ return self._reduce_using_macaulay2(f)
+
+ try:
+ singular = self.__singular_groebner_basis.parent()
+ except AttributeError:
+ self.groebner_basis()
+ singular = self.__singular_groebner_basis.parent()
+
+ f = self.ring()(f)
+ g = singular(f)
+ h = g.reduce(self.__singular_groebner_basis)
+ return self.ring()(h)
+
+ def _reduce_using_macaulay2(self, f):
+ I = self._macaulay2_()
+ M2 = I.parent()
+ R = self.ring()
+ g = M2(R(f))
+ k = M2('%s %% %s'%(g.name(), I.name()))
+ return R(k)
def syzygy_module(self):
r"""
@@ -714,11 +734,6 @@ class MPolynomialIdeal( MPolynomialIdeal
return self._macaulay2_groebner_basis()
elif algorithm == 'magma:GroebnerBasis':
return self._magma_groebner_basis()
- elif algorithm == None:
- if self.ring() == ZZ:
- return self._macaulay2_groebner_basis()
- else:
- return self._singular_groebner_basis()
else:
raise TypeError, "algorithm '%s' unknown"%algorithm
from sage.
Related Issues (20)
- Riemann Matrix just two lines in Sage HOT 1
- CI Docbuild: Banner shows up in Changes
- Deprecation for private and semi-private callables HOT 92
- On Decompositions, Generation Methods and related concepts in the theory of Matching Covered Graphs
- Doctester: Issue a warning when unknown `# optional` / `# needs` tags are used HOT 1
- Zero matrix over an algebra HOT 3
- mpmath.mp.mpf has outdated ``__float__`` dunder
- Random test failure in `geometry/cone_catalog.py` HOT 1
- lex_BFS method of DiGraph is not well-defined (the method could compute ordering that fails doctests) HOT 5
- Sage hangs forever with Steenrod squares and @parallel HOT 2
- using numpy 2.0 HOT 2
- MathJax mj() function used to have correct output but now has wrong output
- `configure`: Refuse installation with `--prefix` in a bad file system
- Enhance sage.tensor to support general rectangular arrays
- GSoC 2024: Meta Ticket for Enhancement in Tensor operations
- Fix broken docker/Dockerfile again HOT 1
- Sage should not blindly link to locally installed `libntl.a` (not compiled with -fPIC by default) HOT 4
- sage archlinux ARM && macOS `nth_root()` have problems HOT 11
- Conda bugs introduced by package update in https://github.com/sagemath/sage/pull/37998
- Installation of `sage_numerical_backends_gurobi` package stalls HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sage.