is the head used for complex numbers.
Complex
is the head used for complex numbers.
Examples
open all close allBasic Examples (1)
Scope (9)
Enter a purely imaginary number:
4 IEven though there is no real part it has Head Complex:
Head[%]The FullForm of a complex number x+Iy is Complex[x,y]:
FullForm[1 + 2 I]Enter a complex number using the FullForm:
Complex[2, 1]If the imaginary part is exactly zero, then the result is not Complex:
Complex[2, 0]Head[%]You have to use Re and Im to extract parts of Complex numbers:
x = 1 + 2 I;{Re[x], Im[x]}Part does not work:
x[[1]]If either part of a complex number has machine precision, the entire number has machine precision:
2. + I1 + 2.IVerify that the result is indeed a machine number:
MachineNumberQ[%]Enter a complex number with an exact real part and an arbitrary-precision imaginary part:
x = 2`20 + IThe exactness is kept in computations when possible:
I xThis is not, in general, possible:
x ^ 2Enter a complex number with arbitrary-precision real and imaginary parts:
1`20 + 2`30 IThe precision is based on the error in the complex plane:
Precision[%]_Complex can be used to stand for a complex number in a pattern:
MatchQ[1 + 2 I, _Complex]A rule that switches real and imaginary parts:
rule = x_Complex -> Im[x] + I Re[x];f[1 + 2 I, 3 + 4 I, 5] /. rulef[1 + 2 I, 3 + 4 I, 5] /. Complex[r_, i_] :> Complex[i, r]Applications (2)
Define a function over the complexes by using functions defined over the reals:
cosine[x_Complex] := Cos[Re[x]]Cosh[Im[x]] - I Sin[Re[x]]Sinh[Im[x]]cosine[x_Real] := Cos[x]Plot3D[Abs[cosine[x + I y]], {x, -3, 3}, {y, -1, 1}]Multiply all pure imaginary numbers in an expression by a constant:
{(1 + (I x) / Y), (1 - (I x) / Y), 2 I x} /. Complex[0, y_] -> a y INote that the naive replacement Ia I would only multiply occurrences of I===Complex[0,1]:
{(1 + (I x) / Y), (1 - (I x) / Y), 2 I x} /. I -> a IProperties & Relations (5)
1 + 2 INumberQ[%]Complexes are atomic objects with no subexpressions:
AtomQ[1 + 2 I]Use Complexes to indicate assumptions on domain conditions:
Reduce[z Conjugate[z] < 1, z, Complexes]Real and imaginary parts of complex numbers can have different precisions:
3.64`10 + IArithmetic operations will typically mix them:
% ^ 4But note that real and imaginary parts still have different precisions:
Precision /@ ReIm[%]The precision of the whole number lies in between these two precisions:
Precision[%%]Machine-precision evaluation of pure imaginary numbers yields an approximate zero real part:
N[ISqrt[5]]Arbitrary‐precision evaluation yields an exact zero real part:
N[ISqrt[5], 10]Possible Issues (2)
Numbers entered in the form x+Iy only become Complex numbers on evaluation:
SetAttributes[f, HoldAll];
f[x_Complex] := Re[x] - Im[x]f[1 + 2 I]f[Evaluate[1 + 2 I]]The unevaluated form is expressed in terms of Plus and Times:
FullForm[HoldForm[1 + 2 I]]Evaluated complex numbers are atomic objects and do not explicitly contain I:
FullForm[2 + I]MatchQ[2 + I, _ + I]Position[{2 + I, 1 + 2I}, I]Patterns of the form Complex[x_,y_] can be used to match the whole complex number:
MatchQ[2 + I, Complex[_, 1]]Position[{2 + I, 1 + 2I}, Complex[_, 1]]See Also
Complexes Real Re Im ReIm I ComplexExpand Conjugate NumericQ
Function Repository: GaussianIntegerQ
Tech Notes
Related Guides
History
Introduced in 1988 (1.0)
Text
Wolfram Research (1988), Complex, Wolfram Language function, https://reference.wolfram.com/language/ref/Complex.html.
CMS
Wolfram Language. 1988. "Complex." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/Complex.html.
APA
Wolfram Language. (1988). Complex. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Complex.html
BibTeX
@misc{reference.wolfram_2026_complex, author="Wolfram Research", title="{Complex}", year="1988", howpublished="\url{https://reference.wolfram.com/language/ref/Complex.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_complex, organization={Wolfram Research}, title={Complex}, year={1988}, url={https://reference.wolfram.com/language/ref/Complex.html}, note=[Accessed: 12-June-2026]}