Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
| Download

📚 The CoCalc Library - books, templates and other resources

Views: 96107
License: OTHER
Kernel:
%%html <link href="http://mathbook.pugetsound.edu/beta/mathbook-content.css" rel="stylesheet" type="text/css" /> <link href="https://aimath.org/mathbook/mathbook-add-on.css" rel="stylesheet" type="text/css" /> <style>.subtitle {font-size:medium; display:block}</style> <link href="https://fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic" rel="stylesheet" type="text/css" /> <link href="https://fonts.googleapis.com/css?family=Inconsolata:400,700&subset=latin,latin-ext" rel="stylesheet" type="text/css" /><!-- Hide this cell. --> <script> var cell = $(".container .cell").eq(0), ia = cell.find(".input_area") if (cell.find(".toggle-button").length == 0) { ia.after( $('<button class="toggle-button">Toggle hidden code</button>').click( function (){ ia.toggle() } ) ) ia.hide() } </script>

Important: to view this notebook properly you will need to execute the cell above, which assumes you have an Internet connection. It should already be selected, or place your cursor anywhere above to select. Then press the "Run" button in the menu bar above (the right-pointing arrowhead), or press Shift-Enter on your keyboard.

ParseError: KaTeX parse error: \newcommand{\lt} attempting to redefine \lt; use \renewcommand

Section18.5Sage

We have already seen some integral domains and unique factorizations in the previous two chapters. In addition to what we have already seen, Sage has support for some of the topics from this section, but the coverage is limited. Some functions will work for some rings and not others, while some functions are not yet part of Sage. So we will give some examples, but this is far from comprehensive.

SubsectionField of Fractions

Sage is frequently able to construct a field of fractions, or identify a certain field as the field of fractions. For example, the ring of integers and the field of rational numbers are both implemented in Sage, and the integers “know” that the rationals is it's field of fractions.

Q = ZZ.fraction_field(); Q
Q == QQ

In other cases Sage will construct a fraction field, in the spirit of Lemma 18.3. So it is then possible to do basic calculations in the constructed field.

R.<x> = ZZ[] P = R.fraction_field();P
f = P((x^2+3)/(7*x+4)) g = P((4*x^2)/(3*x^2-5*x+4)) h = P((-2*x^3+4*x^2+3)/(x^2+1)) ((f+g)/h).numerator()
((f+g)/h).denominator()

SubsectionPrime Subfields

Corollary 18.7 says every field of characteristic pp has a subfield isomorphic to Zp.{\mathbb Z}_p\text{.} For a finite field, the exact nature of this subfield is not a surprise, but Sage will allow us to extract it easily.

F.<c> = FiniteField(3^5) F.characteristic()
G = F.prime_subfield(); G
G.list()

More generally, the fields mentioned in the conclusions of Corollary 18.6 and Corollary 18.7 are known as the “prime subfield” of the ring containing them. Here is an example of the characteristic zero case.

K.<y>=QuadraticField(-7); K
K.prime_subfield()

In a rough sense, every characteristic zero field contains a copy of the rational numbers (the fraction field of the integers), which can explain Sage's extensive support for rings and fields that extend the integers and the rationals.

SubsectionIntegral Domains

Sage can determine if some rings are integral domains and we can test products in them. However, notions of units, irreducibles or prime elements are not generally supported (outside of what we have seen for polynomials in the previous chapter). Worse, the construction below creates a ring within a larger field and so some functions (such as .is_unit()) pass through and give misleading results. This is because the construction below creates a ring known as an “order in a number field.”

K.<x> = ZZ[sqrt(-3)]; K
K.is_integral_domain()
K.basis()
x
(1+x)*(1-x) == 2*2

The following is a bit misleading, since 4,4\text{,} as an element of Z[3i]{\mathbb Z}[\sqrt{3}i] does not have a multiplicative inverse, though seemingly we can compute one.

four = K(4) four.is_unit()
four^-1

SubsectionPrincipal Ideals

When a ring is a principal ideal domain, such as the integers, or polynomials over a field, Sage works well. Beyond that, support begins to weaken.

T.<x>=ZZ[] T.is_integral_domain()
J = T.ideal(5, x); J
Q = T.quotient(J); Q
J.is_principal()
Q.is_field()