# Complex function to its 2D equivalent

Is there a general way to convert functions that have complex values to ones that use 2D reals? So $f:\mathbb{C}\rightarrow\mathbb{C}$ and $g:\mathbb{R^2}\rightarrow\mathbb{R^2}$ such that if

$$g(c_1,c_2) = \begin{bmatrix}v_1 \\ v_2\end{bmatrix}$$ then $$f(c) = v_1 + v_2i$$

For example, I'd want to convert this function:

$$f(x)=(x+3-2i)\cdot(x-1+3i)^2$$

I was working on an algorithm to look for zeroes in a given region and figured it would be convenient to define test cases as complex polynomials, as they can easily be constructed to have known zeroes. But the algorithm itself is defined as $\mathbb{R^2}\rightarrow\mathbb{R^2}$ and easier that way.

Alternatively, is there a way to convert complex polynomials like that?

So far I've converted before and after each evaluation using

c = complex(v1, v2)
v1 = real(c)
v2 = imag(c)


but this gets a bit tedious and ugly. And after making an actual algorithm, a complex function needs to be evaluated twice for each point if one doesn't want to store the values and more clutter:

f = @(x) (x - (-3+2i)) .* (x - (1-3i)).^2;
% God forbid this ever sees the light of day
g = @(x) [real( f( complex(x(1,:), x(2,:)) ) );
imag( f( complex(x(1,:), x(2,:)) ) )];

• Yes, it is possible but remember that to require that a function of a complex variable be analytic is much more restrictive than require that a function $\mathbb{R^2} \to\mathbb{R^2}$ be differentiable. – Emilio Novati Apr 10 '18 at 21:08
• @EmilioNovati I don't quite follow. I'm afraid I'm not that advanced in functional analysis. What do you mean? Nevertheless, maybe I should've been more clear I actually want to know how to find that solution. – Felix Apr 10 '18 at 21:13

(Too long for a comment.)

It's not entirely clear what the question means to ask. The following works out the given example:

$$f(z)=(z+3-2i)\cdot(z-1+3i)^2$$

Let $\,z=x+iy\,$ with $\,x,y \in \mathbb{R}\,$, then after expanding and regrouping:

\begin{align} (x+iy+3-2i)\cdot(x+iy-1+3i)^2 &= \big(x+3 + (y-2)i\big)\big(x-1+(y+3)i\big)^2 \\[5px] &= \underbrace{x^3 + x^2 - 3 x y^2 - 8 x y - 2 x - y^2 - 16 y - 36}_{\textstyle v_1(x,y)} \\[5px] &\quad+ i \underbrace{(3 x^2 y + 4 x^2 + 2 x y + 16 x - y^3 - 4 y^2 - 2 y - 2)}_{\textstyle v_2(x,y)} \end{align}

It follows that $\,f(z)=v_1\big(\operatorname{Re}(z),\operatorname{Im}(z)\big) + i \, v_2\big(\operatorname{Re}(z),\operatorname{Im}(z)\big)\,$, so $\,g(x,y) = \begin{bmatrix}v_1(x,y) \\ v_2(x,y)\end{bmatrix}\,$ would satisfy the requirements. It is not the case in general that $\,v_1(x,y)=v_1(x)\,$ and $\,v_2(x,y)=v_2(y)\,$.

For an arbitrary non-polynomial $\,f\,$, one would have to define $\,v_1(x,y)= \operatorname{Re}\big(f(x+iy)\big)\,$ and $\,v_2(x,y)= \operatorname{Im}\big(f(x+iy)\big)\,$, but getting closed forms may not necessarily be pretty.

• It's these kinds of things that really make me question my intelligence :D Oh dear. But thank you. And that $g_1 = g_1(x)$ was a brain fart, I ment to include both variables. But then again, naturally the functions would include both. So I guess it was redundant. – Felix Apr 10 '18 at 23:54