## Description

The basic rings in Sage are the integers (called `ZZ`), the rationals (called `QQ`), the reals (called `RR`), and the complex numbers (called `CC`). We can define polynomial rings over each of these fields; however, a polynomial defined over the rational numbers is different than a polynomial defined over the real numbers. For example, the polynomial $p(x) = x^2 - 2$ factors over the real numbers but not the rationals. The polynomial $q(x) = x^2 + 2$ factors over the complex numbers but not the real numbers. If we declare polynomial rings `ratpoly.<t> = PolynomialRing(QQ)`, `realpoly.<w> = PolynomialRing(RR)`, and `complexpoly.<z> = PolynomialRing(CC)`, polynomials will factor differently in each case. The names `ratpoly`, `realpoly`, and `complexpoly` are not important, but the variables `t`, `w`, and `z` are important. The polynomial $t^2 - 2$ will not factor but the polynomial $w^2 - 2$ will.

## Sage Cell

#### Code

```
ratpoly.<t> = PolynomialRing(QQ)
factor(t^2-1)
ratpoly.<t> = PolynomialRing(QQ)
factor(t^2-2)
```

## Options

#### Option

Factoring over the real numbers.

#### Code

```
realpoly.<w> = PolynomialRing(RR)
factor(w^2 - 2)
```

#### Option

Factoring over the complex numbers. Note that `I` represents the square root of $-1$.

#### Code

```
complexpoly.<z> = PolynomialRing(CC)
factor(z^2 + 2)
```

## Tags

Primary Tags: abstract algebra

Secondary Tags: rings, factoring, polynomials

## Related Cells

Any related cells go here. Provide a link to the page containing the information about the cell.

## Attribute

Permalink:

Author: T. W. Judson

Date: 01 Aug 2018 00:17

Submitted by: Tom Judson