({{, (RefLink[ReIm, paclet:ref/ReIm])[z] 
gives the list {(RefLink[Re, paclet:ref/Re])[z],(RefLink[Im, paclet:ref/Im])[z]} of the number z.}})

OpenersNotesSection(Spacer1)Details

(RefLink[ReIm, paclet:ref/ReIm]) automatically threads over lists.

OpenersPrimaryExamplesSection(Spacer1)Examples  (21)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

The real and imaginary parts of a complex number:

ReIm[5+12I]

Real numbers are a special kind of complex number:

ReIm[3]

(RefLink[ReIm, paclet:ref/ReIm])[list] gives a list of ordered pairs:

ReIm[{I,-1,-I,1}]

OpenersExampleSection1(Spacer1)Scope  (5)

(RefLink[ReIm, paclet:ref/ReIm]) accepts all number types:

ReIm[-3]

ReIm[(3/5)]

ReIm[1.5`5]

ReIm[1.5-3.2I]

(RefLink[ReIm, paclet:ref/ReIm]) works with symbolic representations of numbers:

ReIm[((-17)^(1/4))]

ReIm[Exp[2 I Pi/3]]

ReIm[Gamma[-1/2]]

Purely symbolic expressions can be partially simplified:

ReIm[z]

ReIm[2z]

ReIm[w+z]

(RefLink[ReIm, paclet:ref/ReIm]) supports nested lists and ragged arrays:

ReIm[{a,{b,c}}]

ReIm[{{1,-1,0},{0,1}}]

(RefLink[ReIm, paclet:ref/ReIm]) works with (RefLink[SparseArray, paclet:ref/SparseArray]) and (RefLink[StructuredArray, paclet:ref/StructuredArray]) objects:

ReIm[SparseArray[{{1}->I,{3}->a,{4}->-Pi},{5}]]

arr=SymmetrizedArray[{{1,1,2}->1,{1,2,2}->3I},{2,2,2},{{3,1,2},Exp[2 I Pi/3]}]

ReIm[arr]

OpenersExampleSection3(Spacer1)Applications  (3)

Use (RefLink[ReIm, paclet:ref/ReIm]) with (RefLink[ListPlot, paclet:ref/ListPlot]) to visualize numbers in the complex plane:

ListPlot[ReIm[{I,E, -1-2I, (Sqrt[-I])}],PlotStyle->PointSize[Large]]

Use (RefLink[ReIm, paclet:ref/ReIm]) with (RefLink[ParametricPlot, paclet:ref/ParametricPlot]) to visualize complex-valued functions on the reals:

ParametricPlot[ReIm[(((-2))^x)],{x,0,4}]

Use (RefLink[ReIm, paclet:ref/ReIm]) together with (RefLink[Epilog, paclet:ref/Epilog]) to pick out points in a complex-plane plot:

JuliaSetPlot[-1,Epilog->{AbsolutePointSize[6],White,Point[ReIm[{I/2,-I/2,1,-1}]]}]

OpenersExampleSection4(Spacer1)Properties & Relations  (9)

(RefLink[ReIm, paclet:ref/ReIm]) increases the depth of an array by one, adding a new inner dimension of length 2:

mat= RandomReal[1,{4,3}];

ArrayDepth[mat]

ArrayDepth[ReIm[mat]]

Dimensions[mat]

Dimensions[ReIm[mat]]

(RefLink[ReIm, paclet:ref/ReIm])[array] gives an array of {re,im} pairs:

ReIm[PauliMatrix[2]]

This can be turned into a pair {(RefLink[Re, paclet:ref/Re])[array],(RefLink[Im, paclet:ref/Im])[array]} using (RefLink[Transpose, paclet:ref/Transpose]):

Transpose[ReIm[PauliMatrix[2]], RotateLeft[{1,2,3}]]

(RefLink[ComplexExpand, paclet:ref/ComplexExpand]) assumes variables to be real:

ComplexExpand[ReIm[r Exp[I θ]]]

In general, variables are assumed to be complex, which may prevent simplification:

ReIm[r Exp[I θ]]

Use (RefLink[Simplify, paclet:ref/Simplify]) and (RefLink[FullSimplify, paclet:ref/FullSimplify]) to simplify the results of (RefLink[ReIm, paclet:ref/ReIm]):

ReIm[2x+I]

Simplify[%,x>3]

FullSimplify[Norm[ReIm[z]]==Abs[z]]

(RefLink[ReIm, paclet:ref/ReIm]) converts complex numbers to {x,y} pairs:

ReIm[I]

(RefLink[FromPolarCoordinates, paclet:ref/FromPolarCoordinates]) converts pairs of real-valued polar coordinates to {x,y} pairs:

FromPolarCoordinates[{1,Pi/2}]

(RefLink[ReIm, paclet:ref/ReIm]) can be viewed as the composition of (RefLink[AbsArg, paclet:ref/AbsArg]) and (RefLink[FromPolarCoordinates, paclet:ref/FromPolarCoordinates]):

ReIm[3+4I]===FromPolarCoordinates[AbsArg[3+4I]]

(RefLink[ReIm, paclet:ref/ReIm]) converts complex numbers to {x,y} pairs:

ReIm[5 Exp[3 Pi I /4] ]

(RefLink[AngleVector, paclet:ref/AngleVector]) converts pairs of reals to {x,y} pairs:

AngleVector[{5, 3Pi/4}]

(RefLink[ReImPlot, paclet:ref/ReImPlot]) plots the real and imaginary parts of a function:

{Plot[ReIm[ArcSin[x]],{x,-3,3}],
ReImPlot[ArcSin[x],{x,-3,3}]}

Use (RefLink[ComplexListPlot, paclet:ref/ComplexListPlot]) to plot complex numbers using their real and imaginary parts:

data=RandomComplex[{-10-10I,10+10I},100];

ComplexListPlot[data]

ListPlot[ReIm[data]]

OpenersExampleSection5(Spacer1)Possible Issues  (1)

Substituting a list l for z in the output of (RefLink[ReIm, paclet:ref/ReIm])[z] is different from directly evaluating (RefLink[ReIm, paclet:ref/ReIm])[l]:

ReIm[{I,-I,0}]

ReIm[z] /. z->{I,-I,0}

For any array, the two results are related by a transposition of the inner and outer levels:

arr = RandomComplex[{-1-I,1+I}, {3,3,3}];
ReIm[arr] === Transpose[(ReIm[z] /. z->arr ), RotateRight@ Range [ ArrayDepth[arr]+ 1]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[Re, paclet:ref/Re])  ▪  (RefLink[Im, paclet:ref/Im])  ▪  (RefLink[ComplexExpand, paclet:ref/ComplexExpand])  ▪  (RefLink[Complex, paclet:ref/Complex])  ▪  (RefLink[FromPolarCoordinates, paclet:ref/FromPolarCoordinates])  ▪  (RefLink[AbsArg, paclet:ref/AbsArg])  ▪  (RefLink[ReImPlot, paclet:ref/ReImPlot])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Complex Numbers, paclet:guide/ComplexNumbers])}, {▪(RefLinkPlain[Representation of Numbers, paclet:guide/RepresentationOfNumbers])}, {▪(RefLinkPlain[Functions of Complex Variables, paclet:guide/FunctionsOfComplexVariables])}, {▪(RefLinkPlain[Angles and Polar Coordinates, paclet:guide/AnglesAndPolarCoordinates])}})}})