How to make denominator of a complex expression real?
expr = -I/(2 π (-I g + V0 + G))
z = ComplexExpand @ expr
w = Together /@ z
num = Numerator /@ w
dem = Denominator /@ w[[1]] // Simplify
num/dem
Wrap it up in a function:
complex[expr_] := Block[{w, num, dem},
w = Together /@ ComplexExpand @ expr;
num = Numerator /@ w;
dem = Simplify @ Denominator /@ w[[1]];
num/dem
]
and e.g.
complex[(a + b I)/(c + d I)]
By multiplying both top and bottom by a complex conjugate
$$ {(-i \gamma -(\text{V0}+\Omega ))} $$
(-I \[Gamma] - (V0 + \[CapitalOmega]))
In the numerator, I get $$ {(i \text{V0}-\gamma +i\Omega )} $$
And in the denominator, exactly what you need $$ {-2 \pi(\gamma^2+(\text{V0}+\Omega)^2)} $$
The answer by corey979 has a little problem. The "Numerator" command in "complex[w]" function will be ill-behaved if w have several separated parts after "Together".
Eg.
So that, the "Numerator" cannot extract the desired numerator out.
I haven't check the carefully, but when I used a very complicated w, the simplified form after "Together" are a sum of several fractions, which means "Together" doesn't work well, so that the "Numerator" doesn't work.
So, be sure to check is the result after "Together" and "Numerator".
For a corrected version, I suggest using the following one: