# 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)

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
Spectrum of Multivariate Polynomial Ring in x0, x1, x2 over Finite Field in a of size 7^2
sage: TestSuite(X).run()


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

sage: A = Spec(ZZ); B = Spec(ZZ)
sage: 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'))
Traceback (most recent call last):
...
TypeError: x (=Free Algebra on 2 generators (x0, x1) over Rational Field) is not in Category of commutative rings


TESTS:

sage: X = Spec(ZZ)
sage: X
Spectrum of Integer Ring
sage: X.base_scheme()
Spectrum of Integer Ring
sage: X.base_ring()
Integer Ring
sage: X.dimension()
1
sage: Spec(QQ,QQ).base_scheme()
Spectrum of Rational Field
sage: Spec(RDF,QQ).base_scheme()
Spectrum of Rational Field

class sage.schemes.generic.spec.SpecFunctor(base_ring=None)

The Spec functor.

Schemes

#### Next topic

Scheme obtained by gluing two other schemes