Complex Numbers and the Complex Constructor - Maple Help

Online Help

All Products    Maple    MapleSim

Home : Support : Online Help : Mathematics : Numerical Computations : Maple Numerics : Constructors : complex

Complex Numbers and the Complex Constructor

Calling Sequence

Complex(x, y)







(optional) expression



A complex number can take one of two forms: a purely imaginary number or a general complex number .


1.  Purely imaginary numbers are numbers of the form I*y, where y is an integer, rational, or floating-point number and I is the square root of -1.


2.  General complex numbers are numbers of the form x + I*y, where x and y are integers, rationals, or floats. In the general complex number case, if either x or y is a floating-point number, then an automatic conversion takes place, coercing both x and y into type float.


The Complex(x, y) constructor function returns the following types of objects for the indicated values of x and y.


x if x is already of type complex and y is not included in the calling sequence.


a one argument complex number (I*x) if x is an extended numeric and y is not included in the calling sequence.


a two argument complex number if x and y are both extended numerics, and either both or neither x and y are of type float.


a two argument complex number where both arguments are type float if either x or y is of type float.


otherwise, the constructor returns unevaluated.


Under normal circumstances, it is not necessary to call this constructor, as expressions of the form y*I and x + y*I will be properly passed to the complex constructor automatically.


Complex numbers are considered atomic objects in expressions. In particular, map cannot be used to modify the components of a complex number. For example, subs(3=z, 3+4*I+3*x) = 3+4*I+z*x and map(sin, 3+4*I) = sin(3+4*I).

Notes on Zeros and Infinities


A complex number x + 0*I, where x is a real number, is not the same as x itself. Strict adherence to this in the symbolic domain, however, would rapidly lead to large expressions cluttered with such 0s. As a compromise, therefore, Maple uses the following rules:


If x is of type extended_numeric, then x + 0.0*I, x - 0.0*I and x are all represented as distinct objects, as are 0.0 + x*I, -0.0 + x*I and x*I.


If x is not of type extended_numeric, then x + 0*I, x + 0.0*I and x - 0.0*I all evaluate to x, and 0 + x*I, 0.0 + x*I and -0.0 + x*I all evaluate to x*I.


The above rules are applied to expressions inside a procedure body at the time the procedure is executed, not when it is entered.


The complex constructor can be used to prevent the simplification of x + 0.0*I and x - 0.0*I to x (and 0.0 + x*I, -0.0 + x*I to x*I), where x is not of type extended_numeric. For example, Complex(CopySign(1, x), 0.0) remains unevaluated for such x.


There is no obvious way to represent the single point "complex infinity" (denoted here by cx-infinity) with the representation Maple uses for complex numbers (the canonical representation being the polar one, ⅇundefinedI ). However, it is important to have such an object to represent, for example, the values of functions at poles such as GAMMA(-1). Therefore, Maple uses the following convention for this object:


Maple routines interpret any 2-argument complex number, where both arguments are some form of real infinity, as complex infinity.


There are several important consequences of this convention. Primarily, cx-infinity is located in no particular part of the complex plane, and hence we have:


csgn(cx-infinity), signum(cx-infinity), argument(cx-infinity) are all undefined.


1/cx-infinity = cx-0.


Note: Since the exact rational 0 + 0*I simplifies to the exact rational 0, it is not possible to preserve the mathematical properties of the symbolic cx-infinity under inversion transformations.


It does not make sense to ask for the real or imaginary parts of cx-infinity by using Re or Im (but Re and Im do not complain if you do so).


Computationally, 1.0 + 0.0*I, 1.0 - 0.0*I and 1.0 are distinct, but mathematically they are the same. Under ordinary circumstances (where branch cuts are not involved), results of computations using any of these forms of the number 1.0 return mathematically equivalent results. Therefore, Maple uses the following convention:


Computations which do not require the information contained in the sign of the real 0 or imaginary 0 part of a non-0 complex number (that is, computations which do not need to account for a relevant branch cut) return a value which is mathematically independent of the presence or absence of that 0 component and of its sign, if present.























See Also

constant, convert, error, float, I, infinity, integer, limit/complex, protected name: complex, type, type/complex, type/extended_numeric, type/float, type/fraction, type/imaginary, type/infinity, type/nonreal, type/rational

Download Help Document

Was this information helpful?

Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam