nlcpy.real

nlcpy.real(val)

Returns the real part of the complex argument.

Parameters
valarray_like

Input arrays or scalars.

Returns
outndarray

The real component of the complex argument. If val is real, the type of val is used for the output. If val has complex elements, the returned type is float. If val is a scalar, this function returns the result as a 0-dimention array.

See also

imag

Returns the imaginary part of the complex argument.

angle

Returns the angle of the complex argument.

Examples

>>> import nlcpy as vp
>>> a = vp.array([1+2j, 3+4j, 5+6j])
>>> a.real
array([1., 3., 5.])
>>> a.real = 9
>>> a
array([9.+2.j, 9.+4.j, 9.+6.j])
>>> a.real = vp.array([9, 8, 7])
>>> a
array([9.+2.j, 8.+4.j, 7.+6.j])
>>> vp.real(1 + 1j)
array(1.)