## Description

The field of complex numbers in Sage is denoted by `CC`. The square root of $-1$ is denoted by `I` or `i`. Complex arithmetic works as expected.

## Sage Cell

#### Code

```
z = 2 + 3*I
w = -2 + 5*I
z*w
```

## Options

#### Option

We can use `CC` to create complex numbers from ordered pairs. `CC` is an approximation to the field of complex numbers using floating point numbers.

#### Code

```
z = CC(2,3)
w = CC(-2,5)
z*w
```

#### Option

`real` or `real_part` returns the real part of a complex number. Similarly, `imag` or `imag_part` returns the imaginary part of a complex number.

#### Code

```
z = CC(2,3)
z.real()
```

#### Option

If $z = a + bi$, then $|z| = \sqrt{a^2 + b^2}$ is the absolute value or modulus of $z$. `abs` returns the absolute value or modulus of a complex number.

#### Code

```
z = CC(2,3)
z.abs()
```

#### Option

The argument (angle) of the complex number, normalized so that $-\pi < \theta \leq \pi$ can be calculated using `arg()` or `argument()`.

#### Code

```
z = CC(0,1)
z.arg()
```

#### Option

The conjugate of the complex number $z = a + bi$ is $\overline{z} = a - bi$ and can be computed using the command `conjugate()`.

#### Code

```
z = CC(1,1)
z.conjugate()
```

## Tags

Primary Tags: Complex Analysis

Secondary Tags: Arithmetic

## Related Cells

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

## Attribute

Permalink: http://doc.sagemath.org/html/en/reference/rings_numerical/sage/rings/complex_number.html

Author: T. W. Judson

Date: 02 Aug 2018 19:46

Submitted by: Tom Judson