2
$\begingroup$

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$.

$\endgroup$
2
  • $\begingroup$ C[1] etc are reserved symbols. In general, it is better not to begin the names of user variables with capital letters. $\endgroup$
    – bbgodfrey
    Nov 9, 2021 at 23:58
  • 1
    $\begingroup$ ComplexExpand does not take the option Assumptions so you need to include FullSimplify, i.e., ComplexExpand[ReIm[Subscript[Z, b]]] // FullSimplify $\endgroup$
    – Bob Hanlon
    Nov 10, 2021 at 0:13

2 Answers 2

3
$\begingroup$

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

enter image description here

$\endgroup$
2
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.