How to express a function in terms of new variable?

I have

In:= g[a_, x_, y_] =
Simplify[Limit[f4[t], t -> Infinity]] +
Sqrt[-1]*Simplify[Limit[f5[t], t -> Infinity]]

Out= ConditionalExpression[(1 + a + a x + a^2 x - a y)/(
3 + 3 a + a^2) + (I (1 + a x + 2 a y + a^2 y))/(
3 + 3 a + a^2), (x | y) \[Element] Reals && a > 0]


Now I want to express the g[t,z] in terms of a new variable

z = x + Sqrt[-1] y;


I was looking for expression like this Perhaps that's the answe to your question

expr=(1 + a + a x + a^2 x - a y)/(3 + 3 a +a^2) + (I (1 + a x + 2 a y + a^2 y))/(3 + 3 a + a^2);
expr /. {x -> Re[z], y -> Im[z]} // FullSimplify
(* ((1 + I) + a + a ((2 + I) + a) z - a Re[z])/(3 + a (3 + a))*)

• Should rather be expr /. {x -> Re[z], y -> Im[z]} // FullSimplify (drop the I for y) – Roman Jun 13 at 8:02
• Why? ComplexExpand[z, z] (*I Im[z] + Re[z]*) – Ulrich Neumann Jun 13 at 8:11
• The OP's definition is the usual z = x + Sqrt[-1] y. So for {Re[z], Im[z]} // ComplexExpand you get {x, y}. These are the usual definitions of $x$ and $y$ being the real and imaginary parts of $z$, and both $x$ and $y$ being real numbers. – Roman Jun 13 at 8:16
• I got it, thanks! – Ulrich Neumann Jun 13 at 8:18
• When you FullSimplify you get the OP's desired form. – Roman Jun 13 at 8:25
exp = ConditionalExpression[(1 + a + a x + a^2 x - a y)/(3 + 3 a +
a^2) + (I (1 + a x + 2 a y + a^2 y))/(3 + 3 a + a^2), (x | y) ∈ Reals && a > 0];

Simplify[exp, z == x + Sqrt[-1] y]


ConditionalExpression[((1 + I) + a + I a y + a ((1 + I) + a) z)/( 3 + 3 a + a^2), (x | y) ∈ Reals && a > 0]

• I want expression devoid of "y" and "x." I have edited the question accordingly. – Kartik Chhajed Jun 13 at 5:51