DiscretizedSpaceElement.imag

property DiscretizedSpaceElement.imag

Imaginary part of this element.

Returns
imagDiscretizedSpaceElement

Examples

Get the imaginary part:

>>> discr = uniform_discr(0, 1, 3, dtype=complex)
>>> x = discr.element([5+1j, 3, 2-2j])
>>> x.imag
uniform_discr(0.0, 1.0, 3).element([ 1.,  0., -2.])

Set the imaginary part:

>>> x = discr.element([1 + 1j, 2, 3 - 3j])
>>> zero = discr.real_space.zero()
>>> x.imag = zero
>>> x.imag
uniform_discr(0.0, 1.0, 3).element([ 0.,  0.,  0.])

Other array-like types and broadcasting:

>>> x.imag = 1.0
>>> x.imag
uniform_discr(0.0, 1.0, 3).element([ 1.,  1.,  1.])
>>> x.imag = [2, 3, 4]
>>> x.imag
uniform_discr(0.0, 1.0, 3).element([ 2.,  3.,  4.])