# Solution of complex linear system

In Brubeck, Nakatsukasa, and Trefethen - Vandermonde with Arnoldi (example 3) they solve the following linear system: $$\operatorname{Re}\left(\begin{array}{ccc}1 & \cdots & z_{1}^{n} \\ 1 & \cdots & z_{2}^{n} \\ \vdots & \ddots & \vdots \\ 1 & \cdots & z_{m}^{n}\end{array}\right)\left(\begin{array}{c}a_{0} \\ \vdots \\ a_{n}\end{array}\right)-\operatorname{Im}\left(\begin{array}{ccc}z_{1} & \cdots & z_{1}^{n} \\ z_{2} & \cdots & z_{2}^{n} \\ \vdots & \ddots & \vdots \\ z_{m} & \cdots & z_{m}^{n}\end{array}\right)\left(\begin{array}{c}b_{1} \\ \vdots \\ b_{n}\end{array}\right)\approx\left(\begin{array}{c}f_{1} \\ f_{2} \\ \vdots \\ f_{m}\end{array}\right).$$

$$A=\left(\begin{array}{ccc}1 & \cdots & z_{1}^{n} \\ 1 & \cdots & z_{2}^{n} \\ \vdots & \ddots & \vdots \\ 1 & \cdots & z_{m}^{n}\end{array}\right)$$.

For solving it, they use the following MATLAB code:

c = [real(A) imag(A(:,2:n+1))]\f;
c = c(1:n+1) - 1i*[0; c(n+2:2*n+1)];


The first line is equivalent to creating a vector c=[a,b] where $$\operatorname{Re}(A)a\approx f$$ and $$\operatorname{Im}(A(:,2:n+1))b \approx f$$ and the second one means $$c=a-[0,bi]$$. I was wondering how it can be solved in this way, in fact I reproduced the code of the paper in Mathematica and the results are not the same. Is there any typo in this procedure?

In detail, the matrix of this linear system is obtained by concatenating horizontally M = real(A) and N = imag(A(:,2:n+1)). If you split the unknown into $$c = \begin{bmatrix} a\\-b \end{bmatrix}$$ then this linear system is $$f = \begin{bmatrix}M & N\end{bmatrix} \begin{bmatrix} a\\-b \end{bmatrix} = Ma - Nb,$$ which corresponds to your first formula. But, ultimately, you are solving one linear system with matrix $$\begin{bmatrix} M & N\end{bmatrix}$$. The instruction [real(A) imag(A(:,2:n+1))] stacks matrices one next to the another; it is not a "vectorized" syntax to solve two linear systems with different matrices and the same RHS.
• Thank you for your answer. I have included $\approx$ to indicate the least-squares equalities. Are you saying that '[real(A) imag(A(:,2:n+1))]\f' is a substraction?. I have typed it on MATLAB and, effectively, it is the solution of two linear systems Jan 10 at 14:44