Skip to content

ComplexExpand ​

Split expr into real and imaginary parts, treating every free symbol as real. Provided by @enumeratio/analytic.

✓ checked against that system · ! checked, with disagreements (hover a chip)Wolfram LanguageComplexExpand✓
ComplexExpand(expr)expr, rewritten as Re + i·Im with its symbols assumed real.
Typed signatures
TypePackageApplies
(expression) -> expressionanalyticalways

Domain: Transformations

Details
  • Covers Add, Multiply, Negate, a nonnegative-integer Power, Sin, Cos, Sinh, Cosh, Exp and Abs of a complex argument, a power of a concrete complex base (I^x is eiπx/2e^{i\pi x/2}), the real and imaginary parts of a split, and a list entry by entry. Tan, Tanh, Ln and the other heads have no rule and fall through to "assumed real", which is wrong for them specifically.
  • A concrete numeric argument with no free symbols needs none of this: plain evaluation already gives the same split (see the last example), so this is a no-op there.

Examples

Basic #

sin⁡(x+iy)=sin⁡xcosh⁡y+icos⁡xsinh⁡y\sin(x + iy) = \sin x\cosh y + i\cos x\sinh y

live ↗
InComplexExpand(sin⁡(x+iy))\mathrm{ComplexExpand}(\sin(x+i y))Outicos⁡(x)sinh⁡(y)+sin⁡(x)cosh⁡(y)i\cos(x)\sinh(y)+\sin(x)\cosh(y)

Polar form of a complex exponential

live ↗
InComplexExpand(exp⁡(x+iy))\mathrm{ComplexExpand}(\exp(x+i y))Outisin⁡(y)ex+cos⁡(y)exi\sin(y)e^{x}+\cos(y)e^{x}
live ↗
InComplexExpand(ReIm(cos⁡(ix)))\mathrm{ComplexExpand}(\mathrm{ReIm}(\cos(i^{x})))Out[cos⁡(cos⁡(πx2))cosh⁡(sin⁡(πx2)),−(sin⁡(cos⁡((πx)/2))sinh⁡(sin⁡((πx)/2)))]\bigl\lbrack\cos(\cos(\frac{πx}{2}))\cosh(\sin(\frac{πx}{2})), -(\sin(\cos((πx)/2))\sinh(\sin((πx)/2)))\bigr\rbrack
Scope #
live ↗
InComplexExpand((x+iy)2)\mathrm{ComplexExpand}((x+i y)^2)Outx2−y2+2ixyx^2-y^2+2i xy
live ↗
InComplexExpand(∣x+iy∣)\mathrm{ComplexExpand}(\vert x+i y\vert)Outx2+y2\sqrt{x^2+y^2}

Wolfram leaves eiπ/5e^{i\pi/5} alone until asked; this is the radical form compute-engine's Exp already produces

live ↗
InComplexExpand(exp⁡(iπ5))\mathrm{ComplexExpand}(\exp(\frac{i π}{5}))Out14+54+24i5−5\frac{1}{4}+\frac{\sqrt{5}}{4}+\frac{\sqrt{2}}{4}i\sqrt{5-\sqrt{5}}
live ↗
InComplexExpand(ℜ(ln⁡(sin⁡(exp⁡(2(x+iy))))))\mathrm{ComplexExpand}(\Re(\ln(\sin(\exp(2(x+i y))))))Out12(ln⁡(sin⁡(cos⁡(2y)exp⁡(2x))2cosh⁡(sin⁡(2y)exp⁡(2x))2+cos⁡(cos⁡(2y)exp⁡(2x))2sinh⁡(sin⁡(2y)exp⁡(2x))2))\frac{1}{2}(\ln(\sin(\cos(2y)\exp(2x))^2\cosh(\sin(2y)\exp(2x))^2+\cos(\cos(2y)\exp(2x))^2\sinh(\sin(2y)\exp(2x))^2))
Properties #
live ↗
InComplexExpand(ℜ(sin⁡(x+iy)))\mathrm{ComplexExpand}(\Re(\sin(x+i y)))Outsin⁡(x)cosh⁡(y)\sin(x)\cosh(y)
About
Examples8
Checked againstWolfram Language 8 agree
CrosswalkWolfram Language

See also: ExpToTrig, Re, Im