user
A   **complex number**   is a number which can be written as:

a
+
b
×
i
{\displaystyle {\displaystyle a+b\times i}}
(sometimes shown as:

b
+
a
×
i
{\displaystyle {\displaystyle b+a\times i}}
where   

a
{\displaystyle {\displaystyle a}}
   and   

b
{\displaystyle {\displaystyle b}}
  are real numbers,   and  
i
{\displaystyle {\displaystyle i}}
  is   √ -1 

Typically, complex numbers are represented as a pair of real numbers called the "imaginary part" and "real part",   where the imaginary part is the number to be multiplied by 

i
{\displaystyle {\displaystyle i}}
.

Task

* Show addition, multiplication, negation, and inversion of complex numbers in separate functions. (Subtraction and division operations can be made with pairs of these operations.)
* Print the results for each operation tested.
* *Optional:* Show complex conjugation.

By definition, the   complex conjugate   of

a
+
b
i
{\displaystyle {\displaystyle a+bi}}
is

a
−
b
i
{\displaystyle {\displaystyle a-bi}}

Some languages have complex number libraries available.   If your language does, show the operations.   If your language does not, also show the definition of this type.
assistant
(formerly Perl 6)

**Works with**: Rakudo version 2015.12

```
my $a = 1 + i;
my $b = pi + 1.25i;

.say for $a + $b, $a * $b, -$a, 1 / $a, $a.conj;
.say for $a.abs, $a.sqrt, $a.re, $a.im;

```

Output:

(precision varies with different implementations)

```
4.1415926535897931+2.25i
1.8915926535897931+4.3915926535897931i
-1-1i
0.5-0.5i
1-1i
1.4142135623730951
1.0986841134678098+0.45508986056222733i
1
1

```