|
Contents | Previous | Next | Subchapters |
| Syntax |
complex(value)real part, imaginary part) |
| See Also | conj , imag |
complex(value)
If value is complex, the return value is equal to value,
otherwise the real part of the return value is equal to value.
complex(real part, imaginary part)
The return value has real part equal to real part
and imaginary part equal to imaginary part,
where real part and imaginary part
are logical, character,
integer, real or double-precision matrices.
complex(1)
returns
(1,0)
If value is a character matrix,
complex will return the ascii
value of
each element of value. If you enter
complex("mno")
O-Matrix will respond
[ (109,0) , (110,0) , (111,0) ]
If value is a logical matrix,
complex will return 1 for each true element and 0
for each false element. If you enter
complex(true)
O-Matrix will respond
(1,0)
complex(1, 2)
returns
(1,2)
If you enter
complex([1, 2, 3], [4, 5, 6])
O-Matrix will respond
[ (1,4) , (2,5) , (3,6) ]
You can combine scalars with matrices of any dimension
complex([1, 2, 3], 1.)
returns
[ (1,1) , (2,1) , (3,1) ]