# Compute real and imaginary part of parametrized complex rational expression

I would like to compute the real and imaginary part of a complex valued rational function $$Z_b=\frac{1}{\frac{1}{\frac{1}{C_1 \text{i\omega }}+L \text{i\omega }+R}+C_2 \text{i\omega }}$$ that depends on parameters $$R,C_1,C_2,L,\omega$$ which are all real.

$$Z_b$$ is defined in the notebook code below:

Subscript[Z, a] := s*L + 1/(s*Subscript[C, 1]) + R
Zb := 1/(1/Subscript[Z, a] + s*Subscript[C, 2])
Subscript[Z, b] := Zb /. s -> I\[Omega]
$Assumptions = L > 0 && R > 0 && Subscript[C, 1] > 0 && Subscript[C, 2] > 0 && \[Omega] > 0 ComplexExpand[Subscript[Z, b]] Now I am not completely sure which functions I could use for this. I tried using ComplexExpand but that did not seem to give me the desired result and instead simply gave me back the definition of $$Z_b$$. • C[1] etc are reserved symbols. In general, it is better not to begin the names of user variables with capital letters. Commented Nov 9, 2021 at 23:58 • ComplexExpand does not take the option Assumptions so you need to include FullSimplify, i.e., ComplexExpand[ReIm[Subscript[Z, b]]] // FullSimplify Commented Nov 10, 2021 at 0:13 ## 2 Answers You get a much simple form and better overview applying Together some times.$Assumptions =
L > 0 && R > 0 && Subscript[C, 1] > 0 &&
Subscript[C, 2] > 0 && \[Omega] > 0;

Subscript[Z, a] = s*L + 1/(s*Subscript[C, 1]) + R // Together;

Zb = 1/(1/Subscript[Z, a] + s*Subscript[C, 2]) // Together;

Subscript[Z, b] = Zb /. s -> I \[Omega];

ce = ComplexExpand[Through[{Re, Im}[Subscript[Z, b]]],
TargetFunctions -> {Re, Im}] // Simplify

I was able to resolve this issue by adjusting /. s -> I\[Omega] to /. s -> I*\[Omega] and simply calling ComplexExpand.

Subscript[Z, a] := s*L + 1/(s*Subscript[C, 1]) + R
Zb := 1/(1/Subscript[Z, a] + s*Subscript[C, 2])
Subscript[Z, b] := Zb /. s -> I*\[Omega]
ComplexExpand[Subscript[Z, b]]

I then manually copied the real and imaginary part to a new cell where I called Simplify on the expression.