25 lines
1.2 KiB
Plaintext
25 lines
1.2 KiB
Plaintext
A '''[[wp:Complex number|complex number]]''' is a number which can be written as:
|
|
<big><math>a + b \times i</math></big>
|
|
(sometimes shown as:
|
|
<big><math>b + a \times i</math></big>
|
|
where <big><math>a</math></big> and <big><math>b</math></big> are real numbers, and [[wp:Imaginary_unit|<big><math>i</math></big>]] is <big>√{{overline| -1 }}</big>
|
|
|
|
|
|
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 <big><math>i</math></big>.
|
|
|
|
|
|
;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.
|
|
|
|
<br>
|
|
By definition, the [[wp:complex conjugate|complex conjugate]] of
|
|
<big><math>a + bi</math></big>
|
|
is
|
|
<big><math>a - bi</math></big>
|
|
|
|
<br>
|
|
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.
|
|
<br><br>
|