# Simplifying complex fractions

How can I simplify a complex fraction in order to get something of the shape

(a + I b)/(c + I d)?


Note that I would not like Mathematica to further simplify it by multiplying both sides by c - I d.

For example:

R1 + 1/(I w C1 + 1/(R2 + 1/(I w C2)))


When I //Simplify it, only the lower fraction gets simplified. I obtain

R1 + 1/(I C1 w + (C2 w)/(-I + C2 R2 w))

When //Apart

R1 - I/((C1 + C2) w) - ( I C2^2 R2)/((C1 + C2) (-I C1 - I C2 + C1 C2 R2 w))

//ComplexExpand separates the whole expression in real and imaginary parts, as expected.

• Possible duplicate of (32170). – march Sep 17 '15 at 17:25

expr = R1 + 1/(I w C1 + 1/(R2 + 1/(I w C2))) //. {I -> i, -I -> -i}
Collect[Numerator@#, i]/Collect[Denominator@#, i] /. {i^2 -> -1, i -> I} &@Factor@expr


results in

(C1 R1 w + C2 R1 w + C2 R2 w + I (-1 + C1 C2 R1 R2 w^2))/(C1 w + C2 w + I C1 C2 R2 w^2)


See here for some comments about simplifying expressions involving I.

expr = R1 + 1/(I w C1 + 1/(R2 + 1/(I w C2)));


Map either Simplify or FullSimplify onto the real and imaginary components of the expression. They are then treated separately.

Simplify /@ ComplexExpand[expr]

(*  R1 + (C2^2*R2)/(2*C1*C2 + C2^2 +
C1^2*(1 + C2^2*R2^2*w^2)) -
(I*(C1 + C2 + C1*C2^2*R2^2*w^2))/
(w*(2*C1*C2 + C2^2 +
C1^2*(1 + C2^2*R2^2*w^2)))  *)

FullSimplify /@ ComplexExpand[expr, Element[var, Reals]]

(*  R1 + (C2^2*R2)/((C1 + C2)^2 +
C1^2*C2^2*R2^2*w^2) -
(I*(C1 + C2 + C1*C2^2*R2^2*w^2))/
((C1 + C2)^2*w + C1^2*C2^2*R2^2*
w^3)  *)