Subsection Creating Rings
Here is a list of various rings, domains and fields you can construct simply.
Integers()
, ZZ
: the integral domain of positive and negative integers,
Integers(n)
: the integers mod A field when is prime, but just a ring for composite
QQ
: the field of rational numbers,
RR
, CC
: the field of real numbers and the field of complex numbers, It is impossible to create every real number inside a computer, so technically these sets do not behave as fields, but only give a good imitiation of the real thing. We say they are inexact rings to make this point.
QuadraticField(n)
: the field formed by combining the rationals with a solution to the polynomial equation The notation in the text is A functional equivalent can be made with the syntax QQ[sqrt(n)]
. Note that n
can be negative.
CyclotomicField(n)
: the field formed by combining the rationals with the solutions to the polynomial equation
QQbar
: the field formed by combining the rationals with the solutions to every polynomial equation with integer coefficients. This is known as a the field of algebraic numbers, denoted as
FiniteField(p)
: for a prime the field of integers
If you print a description of some of the above rings, you will sometimes see a new symbol introduced. Consider the following example:
Here Number Field
describes an object generally formed by combining the rationals with another number (here ). โaโ is a new symbol which behaves as a root of the polynomial We do not say which root, or and as we understand the theory better we will see that this does not really matter.
We can obtain this root as a generator of the number field, and then manipulate it. First squaring root
yields 7. Notice that root
prints as a
. Notice, too, that computations with root
behave as if it was either root of and results print using a
.
This can get a bit confusing, inputing computations with root
and getting output in terms of a
. Fortunately, there is a better way. Consider the following example:
With the syntax F.<b>
we can create the field F
along with specifying a generator b
using a name of our choosing. Then computations can use b
in both input and output as a root of
Here are three new rings that are best created using this new syntax.
F.<a> = FiniteField(p^n)
: We will later have a theorem that tells us that finite fields only exist with orders equal to to a power of a prime. When the power is larger than 1, then we need a generator, here given as a
.
P.<x>=R[]
: the ring of all polynomials in the variable x
, with coefficients from the ring R
. Notice that R
can be any ring, so this is a very general construction that uses one ring to form another. See an example below.
Q.<r,s,t> = QuaternionAlgebra(n, m)
: the rationals combined with indeterminates r
, s
and t
such that and This is a generalization of the quaternions described in this chapter, though over the rationals rather than the reals, so it is an exact ring. Notice that this is one of the few noncommutative rings in Sage. The โusualโ quaternions would be constructed with Q.<I,J,K> = QuaternionAlgebra(-1, -1)
. (Notice that using I
here is not a good choice, because it will then clobber the symbol I
used for complex numbers.)
Syntax specifying names for generators can be used for many of the above rings as well, such as demonstrated above for quadratic fields and below for cyclotomic fields.
Subsection Properties of Rings
The examples below demonstrate how to query certain properties of rings. If you are playing along, be sure to execute the first compute cell to define the various rings involved in the examples.
Exact versus inexact.
Finite versus infinite.
Integral domain?
Field?
Commutative?
Characteristic.
Additive and multiplicative identities print like you would expect, but notice that while they may print identically, they could be different because of the ring they live in.
There is some support for subrings. For example, Q
and S
are extensions of the rationals, while F
is totally distinct from the rationals.
Not every element of a ring may have a multiplicative inverse, in other words, not every element has to be a unit (unless the ring is a field). It would now be good practice to check if an element is a unit before you try computing its inverse.
Subsection Quotient Structure
Ideals are the normal subgroups of rings and allow us to build โquotientsโ โ basically new rings defined on equivalence classes of elements of the original ring. Sage support for ideals is variable. When they can be created, there is not always a lot you can do with them. But they work well in certain very important cases.
The integers, have ideals that are just multiples of a single integer. We can create them with the .ideal()
method or just by wrting a scalar multiple of ZZ
. And then the quotient is isomorphic to a well-understood ring. (Notice that I
is a bad name for an ideal if we want to work with complex numbers later.)
We might normally be more careful about the last statement. The quotient is a set of equivalence classes, each infinite, and certainly not a single integer. But the quotient is isomorphic to so Sage just makes this identification.
Notice that the construction of the quotient ring has created a new generator, converting y
() to ybar
(). We can override this as before with the syntax demonstrated below.
So from a quotient of an infinite ring and an ideal (which is also a ring), we create a field, which is finite. Understanding this construction will be an important theme in the next few chapters. To see how remarkable it is, consider what happens with just one little change.
There are a few methods available which will give us properties of ideals. In particular, we can check for prime and maximal ideals in rings of polynomials. Examine the results above and below in the context of Theorem 16.35.
The fact that M
is a prime ideal is verification of Corollary 16.40.