Описание тега complex-numbers
Questions about complex numbers (numbers in the form of x + y∙i where i² = -1), types to represent them in programming languages, and libraries to manipulate them
The complex numbers extend the real numbers to allow negative numbers to have a square root. Every complex number can be expressed in the form x + y * i where x and y are real numbers and i² = -1; this is called the rectangular form of the number. The rectangular form leads to an interpretation of complex numbers as points on a plane, the same way real numbers are akin to points on a line. If y = 0, the number is a real number; if x = 0, the number is called an imaginary number.
A nonzero complex number has a family of representations in the form r exp(i φ) with r > 0, called the polar representation.
Representation and manipulation in programming languages
Floating point complex numbers
- C: C99 supports
complex
as a type. To use complex numbers,#include <complex.h>
. Many C89 compilers have a similar extension. See also clc FAQ 14.11. - Haskell:
Complex
library in Haskell 98. - Java has no standard complex type; many implementations exist.
- Matlab: Native complex single- and double-precision arrays as well as complex variable precision and symbolic variables via the Symbolic Math Toolbox.
- OCaml:
Complex
module in the standard library. - Python:
complex
is a built-in type.