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?


No, the first line is not equivalent to what you claim in the text, I believe: that's one linear system containing a subtraction and not two separate linear systems.

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.

I suspect that's the source of the issue (and, also, possibly, not solving the linear system in the least-squares sense.)

  • $\begingroup$ 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 $\endgroup$ – Gaussian Jan 10 at 14:44
  • $\begingroup$ No, that line computes the solution (in the least-squares sense) of one linear system. I have expanded, I hope this solves the issue. This is just basic linear algebra, in the end. $\endgroup$ – Federico Poloni Jan 10 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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