**This is an old revision of the document!**

## Complex numbers

### Entering complex numbers

A complex number can be represented mathematically in rectangular form as $z = x + iy$ or in polar form as $z = re^{i\theta}$. A complex number is entered as a pair of numbers comma or space separated and enclosed in parenthesis. For example, the complex number $5+3i$ would be entered (in rectangular form) as `(5, 3)`

or `(5 3)`

or in polar form ($r,\theta$) as `(5.83, ∡30.96)`

^{1)}. Alternatively, a complex number can be created from two numbers using the command `R→C`

:

`5 3 R→C`

The inverse command to break down a complex number is `C→R`

^{2)}. The real or imaginary parts of a complex number can be returned using the commands `RE`

or `IM`

, respectively. Converting from rectangular to polar representation can be done using the command `→POLAR`

. The inverse conversion, polar to rectangular, is done using the command `→RECT`

. It is also possible to enter complex numbers in different bases, although commands and operations between complex numbers will always return the result in base 10. For example, to enter the above example in base 2:

`#101b #11b R→C`

leads to `(#101b,#11b)`

on the stack, but taking the complex conjugate (`CONJ`

) results in `(5,-3)`

.

System flag -103 formally sets the calculator mode to complex: `-103 SF`

.

### Complex number arithmetic

Many of the functions that operate on regular (non-complex) numbers also operate on complex numbers. These functions include the basic arithmetic functions ($+,-,\times,\div$) along with many of the trigonometry ($\sin, \operatorname{asin}, \cos, \operatorname{acos}, \tan, \operatorname{atan}$) and power functions ($x^2, \sqrt x , e^x, \ln x, 10^x, \log x$).

### Commands for complex numbers

The following table summarizes commands applicable to complex numbers, $z=x+iy=re^{i\theta}$.

Command | Purpose | Example |

`C→R` | Break down complex number to two reals | `(5,3) C→R` yields `(5,3)` `5` `3` |

`R→C` | Combine two numbers to a complex | `5 3 R→C` yields `(5,3)` |

`IM` | Imaginary part of a complex number | `(5,3) IM` yields `3` |

`RE` | Real part of a complex number | `(5,3) RE` yields `5` |

`→POLAR` | Convert from rectangular to polar | `(5,3) →POLAR` yields `(5.831.,∡30.964.°)` |

`→RECT` | Convert from polar to rectangular | `(5.831.,∡30.964.°) →RECT` yields `(5.,3.)` |

`ABS` | $|z|=r=\sqrt{x^2+y^2}$ | `(5,3) ABS` yields `5.831.` |

`ARG` | $\theta = \operatorname{atan}(y/x)$ | `(5,3) ARG` yields `∡30.964.°` |

`SIGN` | $z/|z|$ | `(5,3) SIGN` yields `(0.857.,0.514.)` |

`NEG` | $-z=-x-iy$ | `(5,3) NEG` yields `(-5, -3)` |

`CONJ` | $x-iy$ | `(5,3) CONJ` yields `(5,-3)` |

^{1)}

**AL-RS-6**.

^{2)}