ReIm¶
Status: Stable
documented, exercised by the test suite and/or worked examples, with no known limitations recorded.
Description¶
ReIm[z] gives {Re[z], Im[z]}, the real and imaginary parts of numeric z as a list; real-valued arguments give {z, 0}.
Examples (4)¶
Every input below was run against the current Mathilda build and its output recorded.
Applications (4)¶
In[1]:= ReIm[3 + 4 I]
Out[1]= {3, 4}
In[2]:= ReIm[(2 + I)^3]
Out[2]= {2, 11}
In[3]:= ReIm[(3 + 4 I)/(1 - 2 I)]
Out[3]= {-1, 2}
In[4]:= ReIm[N[E^(I Pi/4), 20]]
Out[4]= {0.707106781186547524409, 0.707106781186547524395}
Implementation notes¶
builtin_reim returns {Re[z], Im[z]} as a two-element List. It mirrors builtin_re/builtin_im: {f[z], 0} for real-valued head calls (Re/Im/Abs/Arg), {re, im} for a Complex[re, im] literal, {x, 0} for real numeric kinds (Integer/Real/Rational), and {re, im} when complex_decompose yields numeric parts. Returns NULL (unevaluated) for genuinely symbolic input.
Attributes: Listable, NumericFunction, Protected.
References¶
See also: Re, Im, Abs, Sign, Conjugate, Arg, Rational, Complex
- Source:
src/complex.c - Specification:
docs/spec/builtins/arithmetic.md - Tests:
tests/test_bignum_rational_numeric.c - Tests:
tests/test_complexexpand.c - Tests:
tests/test_core.c
Notes & additional examples¶
Notes¶
ReIm[z] is shorthand for {Re[z], Im[z]}; a real-valued argument gives {z, 0}.