Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

complex

Creates an complex number.

Syntax

  • cpx = complex(a)
  • cpx = complex(a, b)

Input argument

  • a - a variable: real part
  • b - a variable: imaginary part

Output argument

  • cplx - result of a + b*i

Description

complex returns a complex value from real arguments.

With only one input argument, complex returns a complex value a + 0*i.

Example

z = complex(3, 2)
z2 = complex(Inf, Inf)
z3 = Inf + Inf * i

See also

real, imag.

History

VersionDescription
1.0.0initial version

Author

Allan CORNET