# <complex>

**Visual Studio .NET 2003**

Defines the container template class complex and its supporting templates.

#include <complex>

#### Remarks

A complex number is an ordered pair of real numbers. In purely geometrical terms, the complex plane is the real, two-dimensional plane. The special qualities of the complex plane that distinguish it from the real plane are due to its having an additional algebraic structure. This algebraic structure has two fundamental operations:

- Addition defined as (
*a, b*) + (*c, d*) = (*a + c, b + d)* - Multiplication defined as (
*a,*b) * (*c, d*) = (*ac - bd, ad + bc*)

The set of complex numbers with the operations of complex addition and complex multiplication are a field in the standard algebraic sense:

- The operations of addition and multiplication are commutative and associative and multiplication distributes over addition exactly as it does with real addition and multiplication on the field of real numbers.
- The complex number (
*0, 0*) is the additive identity and (*1, 0*) is the multiplicative identity. - The additive inverse for a complex number (
*a, b*) is (*-a, -b*), and the multiplicative inverse for all such complex numbers except (*0, 0*) is(

*a*/(*a*^{2}+*b*^{2}), -*b*/(*a*^{2}+*b*^{2})

By representing a complex number *z = (a, b)* in the form *z = a + bi*, where *i*^{2}* = *-1, the rules for the algebra of the set of real numbers can be applied the set of complex numbers and to their components. For example:

(1 + 2*i*) * (2 + 3*i*) = 1*(2 + 3*i*) + 2*i**(2 + 3*i*) = (2 + 3*i*) + (2*i* + 6*i*^{2})

= (2 –6) + (3 + 2)*i* = -4 + 5*i*

The system of complex numbers is a field, but it is not an ordered field. There is no ordering of the complex numbers as there is for the field or real numbers and its subsets, so inequalities cannot be applied to complex numbers as they are to real numbers which is an ordered field.

There are three common forms of representing a complex number *z*:

- Cartesian:
*z = a + bi* - Polar:
*z = r*(cos*+*isin) - Exponential:
*z = r **exp()

The terms used in these standard representations of a complex number are referred to as follows:

- The real Cartesian component or real part
*a*. - The imaginary Cartesian component or imaginary part
*b*. - The modulus or absolute value of a complex number ρ.
- The argument or phase angle .

Unless otherwise specified, functions that can return multiple values are required to return a principal value for their arguments greater than –pi and less than or equal to +pi to keep them single valued. All angles need to be expressed in radians, where there are 2 pi radians (360 degrees) in a circle.

#### See Also

<complex> Members | Header Files | Thread Safety in the Standard C++ Library