# Why are Exp[3] and 2 treated differently within Complex?

Why doesn't the last command below split the complex number into its real and imaginary parts?

Complex[2,2]
(* 2 + 2 I *)
Complex[N[Exp[3]], N[Exp[3]]]
(* 20.0855 + 20.0855 I *)
Complex[Exp[3],Exp[3])
(* Complex[E^3,E^3] *)


I understand why this can be very confusing, but essentially

Complex[Exp[3],Exp[3]]


is invalid syntax. Do not do this.

Complex is an atomic type (AtomQ). It is not a compound expression with head Complex and two arguments. It is a fundamental type that is indivisible.

What happens when you evaluate Complex[1,2]? What you type here is indeed a compound expression with head Complex and two integer arguments. However, it evaluates to an atomic integer-based complex immediately.

AtomQ[Complex[1, 2]]
(* True *)

AtomQ[Unevaluated@Complex[1, 2]]
(* False *)


The fundamental complex type can be either integer-based or real-based, and that's it. It cannot contain arbitrary symbolic expressions.

If you put such symbolic expressions into Complex[...], it simply won't evaluate. What you get is a compound expression that is not usable as a complex number. It is not of the atomic Complex type. Im, Re, Abs, ComplexExpand, etc. won't handle it.

z = Complex[1, Sqrt[2]];

AtomQ[z]
(* False *)

{Re[z], Im[z], Abs[z]}
(* {Re[Complex[1, Sqrt[2]]], Im[Complex[1, Sqrt[2]]], Abs[Complex[1, Sqrt[2]]]} *)


The correct way to represent such number is Exp[3] + I*Exp[3] instead. The structure will then be like this:

• Thanks, quite clear. Is there a way to have E^3+E^3 I display as E^3+E^3 I and not as (1+I) E^3? Oct 8, 2016 at 15:56
• +1. The symbol Complex behaves similarly to Rational for the construction of the respective objects. Arguments of the former must be NumberQ and arguments of the latter must be IntegerQ for the construction to take place.
– user31159
Oct 8, 2016 at 16:08
• @FernandoSaldanha You can always do something like With[{re = Re[#], im = Im[#]}, TraditionalForm[HoldForm[re + im I]]] & Oct 8, 2016 at 17:04