1 | initial version |

It depends on what kind of complex number you want. Sage provide tons, you do not need numpy, cython or whatever. Here are some examples (these are not the only ones):

With

```
sage: z = 1+2*I
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
```

You get a fast numerical representation of your complex number

With

```
sage: z = 1+2*ComplexIntervalField(1000)(I)
```

You get a certified numerical representation of your complex number with high precision

With

```
sage: z = 1+2*QQbar(I)
```

You get an algebraic (hence exact) representation of your complex number.

2 | No.2 Revision |

It depends on what kind of complex number you want. Sage provide tons, you do not need numpy, cython or whatever. Here are some examples (these are not the only ones):

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex ~~number~~number.

With

```
sage: z = 1+2*ComplexIntervalField(1000)(I)
sage: z.parent()
Complex Interval Field with 1000 bits of precision
```

You get a certified numerical representation of your complex number with high ~~precision~~precision.

With

```
sage: z = 1+2*QQbar(I)
sage: z.parent()
Algebraic Field
```

You get an algebraic (hence exact) representation of your complex number.

With

```
sage: z = 1+2*ZZ[i].basis()[1]
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
```

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

3 | No.3 Revision |

It depends on what kind of complex number you want. Sage provide tons, you do not need numpy, cython or whatever. Here are some examples (these are not the only ones):

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex ~~number.~~number (you should prefer `CDF`

to `CC`

since both have the same precision, but `CDF`

takes the advantage of the CPU floating-point arithmetics).

With

```
sage: z = 1+2*ComplexIntervalField(1000)(I)
sage: z.parent()
Complex Interval Field with 1000 bits of precision
```

You get a certified numerical representation of your complex number with high precision.

With

```
sage: z = 1+2*QQbar(I)
sage: z.parent()
Algebraic Field
```

You get an algebraic (hence exact) representation of your complex number.

With

```
sage: z = 1+2*ZZ[i].basis()[1]
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
```

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

4 | No.4 Revision |

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex number (you should prefer `CDF`

to `CC`

since both have the same precision, but `CDF`

takes the advantage of the CPU floating-point arithmetics).

With

`sage: z = `~~1+2*ComplexIntervalField(1000)(I)
~~1+2*ComplexIntervalField(1000).0
sage: z.parent()
Complex Interval Field with 1000 bits of precision

You get a certified numerical representation of your complex number with high precision.

With

`sage: z = `~~1+2*QQbar(I)
~~1+2*QQbar.0
sage: z.parent()
Algebraic Field

You get an algebraic (hence exact) representation of your complex number.

With

`sage: z = `~~1+2*ZZ[i].basis()[1]
~~1+2*ZZ[i].1
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

5 | No.5 Revision |

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex number (you should prefer `CDF`

to `CC`

since both have the same precision, but `CDF`

takes the advantage of the CPU floating-point ~~arithmetics).~~arithmetics, and the functions you will call from it will use optimized libraries).

With

```
sage: z = 1+2*ComplexIntervalField(1000).0
sage: z.parent()
Complex Interval Field with 1000 bits of precision
```

You get a certified numerical representation of your complex number with high precision.

With

```
sage: z = 1+2*QQbar.0
sage: z.parent()
Algebraic Field
```

You get an algebraic (hence exact) representation of your complex number.

With

```
sage: z = 1+2*ZZ[i].1
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
```

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

6 | No.6 Revision |

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex number (you should prefer `CDF`

to `CC`

since both have the same precision, but `CDF`

takes the advantage of the CPU floating-point arithmetics, and the functions you will call from it will use optimized libraries).

With

```
sage: z = 1+2*ComplexIntervalField(1000).0
sage: z.parent()
Complex Interval Field with 1000 bits of precision
```

You get a certified numerical representation of your complex number with high ~~precision.~~precision (interval arithmetics).

With

```
sage: z = 1+2*QQbar.0
sage: z.parent()
Algebraic Field
```

You get an algebraic (hence exact) representation of your complex ~~number.~~number (but `pi`

does not exist here).

With

```
sage: z = 1+2*ZZ[i].1
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
```

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

7 | No.7 Revision |

With

```
sage: z = 1+2*I
sage: z.parent()
Symbolic Ring
```

You indeed get symbolic representation of a complex number, so you can do symboloc things such as:

```
sage: exp(pi*z).simplify()
e^pi
```

WIth

```
sage: z = 1+2*CDF.0
sage: z.parent()
Complex Double Field
```

You get a fast numerical representation of your complex number (you should prefer `CDF`

~~to ~~over `CC`

since both have the same precision, but `CDF`

takes the advantage of the CPU floating-point arithmetics, and the functions you will call from it will use optimized libraries).

With

```
sage: z = 1+2*ComplexIntervalField(1000).0
sage: z.parent()
Complex Interval Field with 1000 bits of precision
```

You get a certified numerical representation of your complex number with high precision (interval arithmetics).

With

```
sage: z = 1+2*QQbar.0
sage: z.parent()
Algebraic Field
```

You get an algebraic (hence exact) representation of your complex number (but `pi`

does not exist here).

With

```
sage: z = 1+2*ZZ[i].1
sage: z.parent()
Gaussian Integers in Number Field in I with defining polynomial x^2 + 1
```

You get a Gaussian integer.

And so on...

Now, you just have to decide what do you want to do with `z`

to select an appropriate representation.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.