Overview
The algebra of the Complex Numbers is based on the definition of the complex numbers and the corresponding algebra of real numbers.
A generic complex number {% z %} is expressed as
{% z = x+iy %}
Algebraic Definitions
Given two complex numbers, {% z_1 = x_1 + iy_1 %} and {% z_2 = x_2 + iy_2 %}, the following operations are defined:
- Addition
{% z_1 + z_2 = (x_1 + x_2) + i(y_1 + y_2) %}
- Multiplication
{% z_1 \times z_2 = (x_1 x_2 - y_1 y_2) + i(y_1 x_2 + x_1 y_2) %}
Representing Complex Numbers as Vectors
Complex numbers can be represented as an ordered pair
{% z = (x,y) %}
with the corresponding algebraic Properties
{% z_1 + z_2 = (x_1 + x_2,y_1 + y_2) %}
{% z_1 \times z_2 = (x_1 x_2 - y_1 y_2, y_1 x_2 + x_1 y_2) %}
Implementation
The implementation of compex numbers will typically rely on the vector representation as given above. The complex numbers api represents a complex number as an array of two numbers.
For example, the number {% 1 + 2i %} is represented as
let z = [1,2];