# The Spec functor#

AUTHORS:

• William Stein (2006): initial implementation

• Peter Bruin (2014): rewrite Spec as a functor

sage.schemes.generic.spec.Spec(R, S=None)[source]#

Apply the Spec functor to $$R$$.

INPUT:

• R – either a commutative ring or a ring homomorphism

• S – a commutative ring (optional), the base ring

OUTPUT:

• AffineScheme – the affine scheme $$\mathrm{Spec}(R)$$

EXAMPLES:

sage: Spec(QQ)
Spectrum of Rational Field
sage: Spec(PolynomialRing(QQ, 'x'))
Spectrum of Univariate Polynomial Ring in x over Rational Field
sage: Spec(PolynomialRing(QQ, 'x', 3))
Spectrum of Multivariate Polynomial Ring in x0, x1, x2 over Rational Field
sage: X = Spec(PolynomialRing(GF(49,'a'), 3, 'x')); X                           # needs sage.rings.finite_rings
Spectrum of Multivariate Polynomial Ring in x0, x1, x2
over Finite Field in a of size 7^2
sage: TestSuite(X).run()                                                        # needs sage.rings.finite_rings

>>> from sage.all import *
>>> Spec(QQ)
Spectrum of Rational Field
>>> Spec(PolynomialRing(QQ, 'x'))
Spectrum of Univariate Polynomial Ring in x over Rational Field
>>> Spec(PolynomialRing(QQ, 'x', Integer(3)))
Spectrum of Multivariate Polynomial Ring in x0, x1, x2 over Rational Field
>>> X = Spec(PolynomialRing(GF(Integer(49),'a'), Integer(3), 'x')); X                           # needs sage.rings.finite_rings
Spectrum of Multivariate Polynomial Ring in x0, x1, x2
over Finite Field in a of size 7^2
>>> TestSuite(X).run()                                                        # needs sage.rings.finite_rings


Applying Spec twice to the same ring gives identical output (see Issue #17008):

sage: A = Spec(ZZ); B = Spec(ZZ)
sage: A is B
True

>>> from sage.all import *
>>> A = Spec(ZZ); B = Spec(ZZ)
>>> A is B
True


A TypeError is raised if the input is not a commutative ring:

sage: Spec(5)
Traceback (most recent call last):
...
TypeError: x (=5) is not in Category of commutative rings
sage: Spec(FreeAlgebra(QQ, 2, 'x'))                                             # needs sage.combinat sage.modules
Traceback (most recent call last):
...
TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field)
is not in Category of commutative rings

>>> from sage.all import *
>>> Spec(Integer(5))
Traceback (most recent call last):
...
TypeError: x (=5) is not in Category of commutative rings
>>> Spec(FreeAlgebra(QQ, Integer(2), 'x'))                                             # needs sage.combinat sage.modules
Traceback (most recent call last):
...
TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field)
is not in Category of commutative rings

class sage.schemes.generic.spec.SpecFunctor(base_ring=None)[source]#

The Spec functor.