This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

Confluent Vandermonde with Arnoldi

Qiang Niu   Hui Zhang   Youzhou Zhou
School of Mathematics and Physics, Xi’an Jiaotong-Liverpool University, Ren’ai Rd. 111, Suzhou 215123, China
Corresponding author. Emails: {qiang.niu, hui.zhang, youzhou.zhou@xjtlu.edu.cn}
Abstract

In this note, we extend the Vandermonde with Arnoldi method recently advocated by P. D. Brubeck, Y. Nakatsukasa and L. N. Trefethen [SIAM Review, 63 (2021) 405-415] to dealing with the confluent Vandermonde matrix. To apply the Arnoldi process, it is critical to find a Krylov subspace which generates the column space of the confluent Vandermonde matrix. A theorem is established for such Krylov subspaces for any order derivatives. This enables us to compute the derivatives of high degree polynomials to high precision. It also makes many applications involving derivatives possible, as illustrated by numerical examples. We note that one of the approaches orthogonalizes only the function values and is equivalent to the formula given by P. D. Brubeck and L. N. Trefethen [SIAM J. Sci. Comput., 44 (2022) A1205–A1226]. The other approach orthogonalizes the Hermite data. About which approach is preferable to another, we made the comparison, and the result is problem dependent.

Keywords   Hermite interpolation, Vandermonde, confluent, Krylov subspace, Arnoldi

MSC 2020   65D15, 65F15, 65N25, 65N35

1 Introduction.

The recent work [1] presents a linear algebra method for the polynomial interpolation and fitting on arbitrary grids. It does not need the prior knowledge of a well-conditioned polynomial basis, and works easily on two intervals and subsets of complex plane, for example. The method starts with the ill-conditioned Vandermonde system

k=0nxjkck=f(xj),j=1,,m\sum_{k=0}^{n}x_{j}^{k}c_{k}=f(x_{j}),\quad j=1,\ldots,m

such that f(x)k=0nxkckf(x)\approx\sum_{k=0}^{n}x^{k}c_{k}, and transforms it into a much more well-conditioned system

k=0nqjkdk=f(xj),j=1,,m\sum_{k=0}^{n}q_{jk}d_{k}=f(x_{j}),\quad j=1,\ldots,m

such that f(sj)k=0nwjkdkf(s_{j})\approx\sum_{k=0}^{n}w_{jk}d_{k}. In matrix form, the Vandermonde system V𝐜=𝐟V\mathbf{c}=\mathbf{f}, i.e.,

(1x1x12x1n1x2x22x2n1xmxm2xmn)(c0c1cn)=(f(x1)f(x2)f(xm))\begin{pmatrix}1&x_{1}&x_{1}^{2}&\cdots&x_{1}^{n}\\ 1&x_{2}&x_{2}^{2}&\cdots&x_{2}^{n}\\ \vdots&\vdots&\vdots&\cdots&\vdots\\ 1&x_{m}&x_{m}^{2}&\cdots&x_{m}^{n}\end{pmatrix}\begin{pmatrix}c_{0}\\ c_{1}\\ \vdots\\ c_{n}\end{pmatrix}=\begin{pmatrix}f(x_{1})\\ f(x_{2})\\ \vdots\\ f(x_{m})\end{pmatrix}

is transformed into Q𝐝=𝐟Q\mathbf{d}=\mathbf{f} where Q=(qjk)Q=(q_{jk}) is a matrix and 𝐝=(dk)\mathbf{d}=(d_{k}) is a column vector, and the approximation at sjs_{j}, j=1,,Mj=1,\ldots,M is evaluated as (f(sj))W𝐝(f(s_{j}))\approx W\mathbf{d} where W=(wjk)W=(w_{jk}). The columns of QQ form an orthogonal basis of the column space of VV. To construct QQ, it is noted that ColV\mathrm{Col}\,V is just the Krylov subspace span{𝐞,X𝐞,X2𝐞,,Xn𝐞}\mathrm{span}\{\mathbf{e},X\mathbf{e},X^{2}\mathbf{e},\ldots,X^{n}\mathbf{e}\} with X=diag(x1,x2,,xm)X=\mathrm{diag}(x_{1},x_{2},\ldots,x_{m}), 𝐞=(1,,1)T\mathbf{e}=(1,\ldots,1)^{T}. So, the Arnoldi process for the Krylov subspace is exploited to generate the columns of QQ as well as a Hessenberg matrix HH such that XQ=QHXQ_{-}=QH (here QQ_{-} is obtained by deleting the last column of QQ). The evaluation matrix WW has the first column all one’s and is constructed column by column such that SW=WHSW_{-}=WH, where S=diag(s1,,sM)S=\mathrm{diag}(s_{1},\ldots,s_{M}) and WW_{-} is WW without the (n+1)(n+1)-th column.

Now, we would like to employ the same idea for the Hermite interpolation and fitting. We start with the confluent Vandermonde system

k=0nxjkck=f(xj),k=0nkxjk1ck=f(xj),j=1,,m\sum_{k=0}^{n}x_{j}^{k}c_{k}=f(x_{j}),\quad\sum_{k=0}^{n}kx_{j}^{k-1}c_{k}=f^{\prime}(x_{j}),\quad j=1,\ldots,m

or in matrix form (with VV as before)

(VV)𝐜=(𝐟𝐟),V=(012x13x12nx1n1012x23x22nx2n1012xm3xm2nxmn1),𝐟=(f(x1)f(x2)f(xm)).\begin{pmatrix}V\\ V_{{}^{\prime}}\end{pmatrix}\mathbf{c}=\begin{pmatrix}\mathbf{f_{\phantom{{}^{\prime}}}}\\ \mathbf{f}_{{}^{\prime}}\end{pmatrix},\quad V_{{}^{\prime}}=\begin{pmatrix}0&1&2x_{1}&3x_{1}^{2}&\ldots&nx_{1}^{n-1}\\ 0&1&2x_{2}&3x_{2}^{2}&\ldots&nx_{2}^{n-1}\\ \vdots&\vdots&\vdots&\cdots&\vdots\\ 0&1&2x_{m}&3x_{m}^{2}&\ldots&nx_{m}^{n-1}\end{pmatrix},\quad\mathbf{f}_{{}^{\prime}}=\begin{pmatrix}f^{\prime}(x_{1})\\ f^{\prime}(x_{2})\\ \vdots\\ f^{\prime}(x_{m})\end{pmatrix}.

We notice that the column space of [V;V][V;V_{{}^{\prime}}] (semicolon means as in MATLAB) is a Krylov subspace:

(VV)=((𝐞𝟎),(XOIX)(𝐞𝟎),(XOIX)2(𝐞𝟎),,(XOIX)n(𝐞𝟎)).\begin{pmatrix}V\\ V_{{}^{\prime}}\end{pmatrix}=\left(\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\end{pmatrix},\;\;\begin{pmatrix}X&O\\ I&X\end{pmatrix}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\end{pmatrix},\;\;\begin{pmatrix}X&O\\ I&X\end{pmatrix}^{2}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\end{pmatrix},\;\;\ldots,\begin{pmatrix}X&O\\ I&X\end{pmatrix}^{n}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\end{pmatrix}\right).

So, the Arnoldi process applies and can be used to generate a matrix QQ with orthogonal columns and a Hessenberg matrix HH. Then, the evaluation matrix WW can be constructed with

the first column (𝐞𝟎),(SOIS)W=WH.\text{the first column }\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\end{pmatrix},\quad\begin{pmatrix}S&O\\ I&S\end{pmatrix}W_{-}=WH.

Following [1], we give the MATLAB codes for the method of confluent Vandermonde with Arnoldi.

     function [d,H] = polyfitAh(x,f,fp,n)
     m = size(x,1); Q = zeros(2*m,n+1); Q(1:m,1) = 1; H = zeros(n+1,n);
     for k = 1:n
         q = [x.*Q(1:m,k); Q(1:m,k)+x.*Q(m+1:2*m,k)];
         for j = 1:k
             H(j,k) = Q(:,j)’*q/m; q = q - H(j,k)*Q(:,j);
         end
         H(k+1,k) = norm(q)/sqrt(m); Q(:,k+1) = q/H(k+1,k);
     end
     d = Q\[f;fp];

     function [y,yp] = polyvalAh(d, H, s)
     M = size(s,1);  n = size(d,1)-1; W = zeros(2*M,n+1); W(1:M,1) = 1;
     for k = 1:n
         w = [s.*W(1:M,k); W(1:M,k)+s.*W(M+1:2*M,k)];
         for j = 1:k
             w = w - H(j,k)*W(:,j);
         end
         W(:,k+1) = w/H(k+1,k);
     end
     y = W*d;  yp = y(M+1:2*M,:);  y = y(1:M,:);

To compare, we give also the naive method of confluent Vandermonde without Arnoldi.

     function c = polyfith(x,f,fp,n)
     A = x.^(0:n); o = zeros(size(x)); D = diag(1:n); A = [A; o A(:,1:n)*D]; c = A\[f;fp];

     function [y,yp] = polyvalh(c,s)
     n = length(c)-1;  B = s.^(0:n);  y = B*c;
     o = zeros(size(s));  D = diag(1:n);  yp = [o B(:,1:n)*D]*c;

Other than the Hermite scenario for both fitting and evaluation, we can also fit only the function values using polyfitA (or polyfit) from [1] but evaluates the function values and derivatives using polyvalAh (or polyvalh) here. This scenario is more interesting if the data of derivatives are not available for fitting. In other words, we construct first a discrete orthogonal basis for the function values by polyfitA and then the derivative matrix W(M+1:2*M,:) under the same basis by polyvalAh. We notice that an equivalent formula for doing this has been given in [2], which we should detail in the Discussion section. There is a third possibility: one can still construct a discrete orthogonal basis for the Hermite data, but fit only the function values, and then construct the derivative evaluation matrix under that basis; however we found no advantage of it. The fourth possibility is to use the function values orthogonalized basis for Hermite fitting and evaluation, which we found performs equally well as using the Hermite data orthogonalized basis for Examples 1–2 in the following sections. We will see also for the other examples the comparison results of Hermite and function values orthogonalized bases.

Both the fitting and evaluation can be generalized to high-order derivatives. For example, let V′′V_{{}^{\prime\prime}} be the second-order derivative matrix under the standard basis. We have

(VVV′′)=((𝐞𝟎𝟎),(XOOIXOO2IX)(𝐞𝟎𝟎),(XOOIXOO2IX)2(𝐞𝟎𝟎),,(XOOIXOO2IX)n(𝐞𝟎𝟎)).\begin{pmatrix}V\\ V_{{}^{\prime}}\\ V_{{}^{\prime\prime}}\end{pmatrix}=\left(\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\\ \mathbf{0}\end{pmatrix},\;\;\begin{pmatrix}X&O&O\\ I&X&O\\ O&2I&X\end{pmatrix}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\\ \mathbf{0}\end{pmatrix},\;\;\begin{pmatrix}X&O&O\\ I&X&O\\ O&2I&X\end{pmatrix}^{2}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\\ \mathbf{0}\end{pmatrix},\;\;\ldots,\begin{pmatrix}X&O&O\\ I&X&O\\ O&2I&X\end{pmatrix}^{n}\begin{pmatrix}\mathbf{e}\\ \mathbf{0}\\ \mathbf{0}\end{pmatrix}\right).

It may be worthwhile to state the general case as follows.

Theorem 1.

Let VV be the Vandermonde matrix and V()V_{(\ell)} be the \ellth order derivative matrix corresponding to VV. Then, the matrix [V;V(1);V(2);;V()][V;V_{(1)};V_{(2)};\ldots;V_{(\ell)}] has the (k+1)(k+1)th column exactly equal to

(XOOIXO2IOOOIX)k(𝐞𝟎𝟎𝟎).\begin{pmatrix}X&O&\cdots&\cdots&O\\ I&X&\ddots&\vdots&\vdots\\ O&2I&\ddots&\ddots&\vdots\\ \vdots&\ddots&\ddots&\ddots&O\\ O&\cdots&O&\ell I&X\end{pmatrix}^{k}\begin{pmatrix}\mathbf{e}\vphantom{X}\\ \mathbf{0}\vphantom{\ddots}\\ \vdots\vphantom{X}\\ \mathbf{0}\vphantom{\ddots}\\ \mathbf{0}\vphantom{X}\end{pmatrix}.

2 Example 1: interpolation in Chebyshev points.

This example is used in [1] for the Lagrange interpolation. Now we interpolate the function f(x)=1/(1+25x2)f(x)=1/(1+25x^{2}) and its derivative simultaneously (polyfitAh+polyvalAh) by a degree nn (odd) polynomial in m=(n+1)/2m=(n+1)/2 Chebyshev points xj=cos((mj)π/(m1))x_{j}=\cos((m-j)\pi/(m-1)), 1jm1\leq j\leq m. We also do the Lagrange interpolation in n+1n+1 points as in [1] and evaluate the derivative as proposed here (polyfitA+polyvalAh). The results are shown in Figure 1. We see that with Arnoldi both ff and ff^{\prime} can be approximated to high accuracy with the exponential convergence rate, while without Arnoldi the method is prone to round-off errors as n>50n>50. The derivative evaluation enabled by the confluent Vandermonde with Arnoldi (polyvalAh) works equally well for the Hermite and Lagrange interpolation. Throughout the paper, the function norm is the maximum norm computed on a very fine grid.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 1: Hermite (solid lines/points) and Lagrange (dashed lines/circles) interpolation of f(x)=1/(1+25x2)f(x)=1/(1+25x^{2}) on Chebyshev grids of [1,1][-1,1] by the confluent Vandermonde without (left column) and with (right column) Arnoldi.

3 Example 2: least-squares fitting on two intervals.

For the function f(x)=|x|f(x)=\sqrt{|x|} on [1,1/3][1/5,1][-1,-1/3]\cup[1/5,1], we sample the function values (and its derivatives for the Hermite version) on every interval with equally spaced points, and fit by least-squares these data with a degree nn polynomials. The number of sampling points mm on each interval is chosen as m=5(n+1)m=5(n+1) for the Hermite version and m=10(n+1)m=10(n+1) for the Lagrange version. The results are shown in Figure 2.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 2: Least-squares fitting of f(x)=|x|f(x)=\sqrt{|x|} on [1,1/3][1/5,1][-1,-1/3]\cup[1/5,1] (dashed lines/circles) and simultaneously its derivatives (solid lines/points) in equally spaced points by the confluent Vandermonde without (left column) and with (right column) Arnoldi.

4 Example 3: Hermite Fourier extension.

This example is used in [1] for approximation of f(x)=1/(109x)f(x)=1/(10-9x) on [1,1][-1,1] by the Fourier series on the larger interval [2,2][-2,2]. Now we consider both the function values and its derivatives:

f(x)Re(k=0neikπx/2ck),2πf(x)Im(k=0nkeikπx/2ck).f(x)\approx\mathrm{Re}\left(\sum_{k=0}^{n}\mathrm{e}^{\mathrm{i}k\pi x/2}c_{k}\right),\quad-\frac{2}{\pi}f^{\prime}(x)\approx\mathrm{Im}\left(\sum_{k=0}^{n}k\mathrm{e}^{\mathrm{i}k\pi x/2}c_{k}\right).

Following [1], this is realized with z:=eiπx/2z:=\mathrm{e}^{\mathrm{i}\pi x/2}, ck=ak+ibkc_{k}=a_{k}+\mathrm{i}b_{k} (ak,bka_{k},b_{k}\in\mathbb{R}) and

f(x)k=0n(RezkakImzkbk),2πf(x)k=0n(Im(kzk)ak+Re(kzk)bk).f(x)\approx\sum_{k=0}^{n}(\mathrm{Re}z^{k}a_{k}-\mathrm{Im}z^{k}b_{k}),\quad-\frac{2}{\pi}f^{\prime}(x)\approx\sum_{k=0}^{n}\left(\mathrm{Im}(kz^{k})a_{k}+\mathrm{Re}(kz^{k})b_{k}\right).

The last line of polyfith is changed to

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

where fp stores the scaled derivatives 2πf(xj)-\frac{2}{\pi}f^{\prime}(x_{j}). Similar changes should be made also in polyfitAh but with QQ instead of AA. In polyvalh and polyvalAh, now we take the real part for y and imaginary part for yp. Note again that the output yp stores the scaled derivatives 2πp(sj)-\frac{2}{\pi}p^{\prime}(s_{j}). Following [1], 500 Chebyshev points on [1,1][-1,1] are used for the Hermite fitting. The results are shown in Figure 3. The Lagrange fitting is not present in the figure since the derivative evaluation for it gave totally wrong results.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 3: Fourier extension of f(x)=1/(109x)f(x)=1/(10-9x) and simultaneously its derivatives on Chebyshev grids of [1,1][-1,1] by the truncated Fourier series on [2,2][-2,2] using the confluent Vandermonde without (left column) and with (right column) Arnoldi. Bottom right: Hermite (dots) vs function values (circles) orthogonalized bases.

5 Example 4: Laplace equation and Dirichlet-to-Neumann map.

Given a domain Ω2\Omega\subset\mathbb{R}^{2} with boundary Ω\partial\Omega and a function f:Ωf:\partial\Omega\to\mathbb{R}, the Dirichlet-to-Neumann map TT involves first solving the Laplace equation Δu=0-\Delta u=0 in Ω\Omega, u=fu=f on Ω\partial\Omega and then evaluating the outer normal derivative 𝝂u=:Tf\partial_{\boldsymbol{\nu}}u=:Tf on Ω\partial\Omega. By identifying (x,y)2(x,y)\in\mathbb{R}^{2} and z=x+iyz=x+\mathrm{i}y\in\mathbb{C}, uu can be viewed as the real part of an analytic function hh in the complex plane, so that Δu=0-\Delta u=0 is automatically satisfied. Following [1], we approximate h(z)h(z) by a polynomial k=0nckzk\sum_{k=0}^{n}c_{k}z^{k}. Let ck=ak+ibkc_{k}=a_{k}+\mathrm{i}b_{k} (aka_{k}, bkb_{k} \in\mathbb{R}). Then, u(z)k=0n(RezkakImzkbk)u(z)\approx\sum_{k=0}^{n}(\mathrm{Re}z^{k}a_{k}-\mathrm{Im}z^{k}b_{k}). To compute TfTf, we need only to fit the boundary condition u=fu=f on Ω\partial\Omega and then evaluate 𝝂u=Re(ν(z)h(z))\partial_{\boldsymbol{\nu}}u=\mathrm{Re}(\nu(z)h^{\prime}(z)) (since h(z)=xuiyuh^{\prime}(z)=\partial_{x}u-\mathrm{i}\partial_{y}u and ν(z)=ν1(z)+iν2(z)\nu(z)=\nu_{1}(z)+\mathrm{i}\nu_{2}(z) corresponds to the unit outer normal 𝝂=(ν1,ν2)\boldsymbol{\nu}=(\nu_{1},\nu_{2}) on Ω\partial\Omega), or more precisely

𝝂u=k=1n(ν1(z)Rezk1kν2(z)Imzk1k)akk=1n(ν2(z)Rezk1k+ν1(z)Imzk1k)bk.\partial_{\boldsymbol{\nu}}u=\sum_{k=1}^{n}(\nu_{1}(z)\mathrm{Re}z^{k-1}k-\nu_{2}(z)\mathrm{Im}z^{k-1}k)a_{k}-\sum_{k=1}^{n}(\nu_{2}(z)\mathrm{Re}z^{k-1}k+\nu_{1}(z)\mathrm{Im}z^{k-1}k)b_{k}.

A concrete example is demonstrated in Figure 4, where m=10nm=10n points with the argument of zΩz\in\partial\Omega equally spaced are used for the fitting. We see that the Hermite orthogonalized basis leads to a bit more accurate results than the function values orthogonalized basis does.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 4: Dirichlet-to-Neumann map of the Dirichlet data f(z)=Re(log(0.8+z))2f(z)=\mathrm{Re}\,(\log(0.8+z))^{2} at zΩ={eit(0.7+0.25cos(4t2)+0.05cos(8t4)):0t=argz2π}z\in\partial\Omega=\{\mathrm{e}^{\mathrm{i}t}(0.7+0.25\cos(4t-2)+0.05\cos(8t-4)):0\leq t=\arg z\leq 2\pi\} by the confluent Vandermonde without (left column) and with (right column) Arnoldi. Bottom-right: Hermite (dots) vs function values (circles) orthogonalized bases.

6 Example 5: Steklov eigenvalue problem in an ellipse.

This is a continuation of the previous section. We look for the eigenvalue λ\lambda of TT and the assoicated eigenfunction f:Ωf:\partial\Omega\to\mathbb{R} such that Tf=λfTf=\lambda f. In other words, we want the real part uu of an analytic function in Ω\Omega to satisfy 𝝂u=λu\partial_{\boldsymbol{\nu}}u=\lambda u on Ω\partial\Omega. Let QQ be the matrix from the Arnoldi process on the confluent Vandermonde matrix; see the Introduction section. We partition the 2m2m rows of QQ in half: Q=(Q0;Q1)Q=(Q_{0};Q_{1}) with Q0Q_{0} containing the first mm rows that represents the sampling of basis function values and Q1Q_{1} representing the sampling of derivatives of basis functions. Let the matrices be separated into real parts and imaginary parts: Q0=Q0,r+iQ0,iQ_{0}=Q_{0,r}+\mathrm{i}Q_{0,i}, Q1=Q1,r+iQ1,iQ_{1}=Q_{1,r}+\mathrm{i}Q_{1,i}, and ν1\nu_{1}, ν2\nu_{2} be diagonal matrices containing the sampled values of the unit outer normal of Ω\partial\Omega. Then, the discrete Steklov eigenvalue problem is to find 𝐚n+1\mathbf{a}\in\mathbb{R}^{n+1}, 𝐛=(0,b1,,bn)T\mathbf{b}=(0,b_{1},\ldots,b_{n})^{T} and λ\lambda\in\mathbb{R} such that

(ν1Q1,rν2Q1,i)𝐚(ν1Q1,i+ν2Q1,r)𝐛=λ(Q0,r𝐚Q0,i𝐛),(\nu_{1}Q_{1,r}-\nu_{2}Q_{1,i})\mathbf{a}-(\nu_{1}Q_{1,i}+\nu_{2}Q_{1,r})\mathbf{b}=\lambda(Q_{0,r}\mathbf{a}-Q_{0,i}\mathbf{b}),

denoted by Qν𝜷=λQ00𝜷Q_{\nu}\boldsymbol{\beta}=\lambda Q_{00}\boldsymbol{\beta} with 𝜷=(𝐚;𝐛^)\boldsymbol{\beta}=(\mathbf{a};-\hat{\mathbf{b}}) (𝐛^=(b1,,bn)T\hat{\mathbf{b}}=(b_{1},\ldots,b_{n})^{T}), which is a rectangular eigenvalue problem when m>2n+1m>2n+1. Following [6], we first do the economic QR decomposition Q00=Q~00R~00Q_{00}=\tilde{Q}_{00}\tilde{R}_{00}, then multiply the eigenvalue equation with Q~00\tilde{Q}_{00}^{*} to get Q~00Qν𝜷=λR~00𝜷\tilde{Q}_{00}^{*}Q_{\nu}\boldsymbol{\beta}=\lambda\tilde{R}_{00}\boldsymbol{\beta}, which is a generalized eigenvalue problem of square matrices and can be solved by the standard method (using the MATLAB command eig). For the solved example, see Figure 5. The m=10n+1m=10n+1 points are sampled at equally spaced elliptic angle coordinates. The benchmark solution uses n=400n=400.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 5: Laplace Steklov eigenvalue problem in the ellipse z=cost+i15sintz=\cos t+\mathrm{i}\frac{1}{5}\sin t by the confluent Vandermonde without (left column) and with (right column) Arnoldi. Top: the kkth eigenfunction pkp_{k} (pk=1\|p_{k}\|=1), k=20,40k=20,40, for the eigenvalues 0=λ1λk0=\lambda_{1}\leq\ldots\leq\lambda_{k}\leq\ldots. Bottom: errors of p20p_{20}, λ20\lambda_{20} (-, \cdot) and p40p_{40}, λ40\lambda_{40} (--, \circ). Bottom right: Hermite vs function values (in black) orthogonalized bases.

7 Example 6: sloshing modes on top of a cup.

This example is taken from [8]. The domain is Ω=(0,1)2\Omega=(0,1)^{2}. On the left, right and bottom sides, the homogeneous Neumann condition 𝝂u=0\partial_{\boldsymbol{\nu}}u=0 is imposed, while on the top side is the eigenvalue equation 𝝂u=λu\partial_{\boldsymbol{\nu}}u=\lambda u. The analytic solution is λn=nπtanh(nπ)\lambda_{n}=n\pi\tanh(n\pi), un=cos(nπx)sinh(nπy)u_{n}=\cos(n\pi x)\sinh(n\pi y); see [8]. Let I:uuI:u\mapsto u be the identity operator on the top side and O:u0uO:u\mapsto 0u be the zero operator on the other sides. Define BB on Ω\partial\Omega piecewise equal to II and OO. Then, we can write the boundary equation uniformly as 𝝂u=λBu\partial_{\boldsymbol{\nu}}u=\lambda Bu on Ω\partial\Omega. Using the notation from the previous section, the discrete rectangular eigenvalue problem becomes Qν𝜷=λBQ00𝜷Q_{\nu}\boldsymbol{\beta}=\lambda BQ_{00}\boldsymbol{\beta}. Now, testing the equation with the column space basis of BQ00BQ_{00} as before is not a good idea because BQ00BQ_{00} is rank deficient. Note that the two sides of the equation live in the sum of the column spaces of QνQ_{\nu} and BQ00BQ_{00}. So, we follow [5] to do the economic SVD: (Qν,BQ00)=USV(Q_{\nu},BQ_{00})=USV^{*}, but we keep the first 2n+12n+1 columns of UU as U^\hat{U} to match the length of 𝜷\boldsymbol{\beta}, then multiply the eigenvalue equation with U^\hat{U}^{*} to get U^Qν𝜷=U^BQ00𝜷\hat{U}^{*}Q_{\nu}\boldsymbol{\beta}=\hat{U}^{*}BQ_{00}\boldsymbol{\beta}. The results are shown in Figure 6. On each side of the square, we used 20(n+1)20(n+1) Chebyshev points of the first kind for discretization of the boundary equation. From the bottom right, we can see that the function values orthogonalized basis leads to instability. Convergence of the eigenfunctions from the method with Hermite Arnoldi basis slowers down after some nn, which could be fixed with more sampling points. For example, for n=60n=60 and 100(n+1)100(n+1) points per side, we got the errors 2.4×10142.4\times 10^{-14}, 1.2×10131.2\times 10^{-13} for p5p_{5}, p10p_{10}.

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 6: Sloshing modes on the top side of a square cup by the confluent Vandermonde without (left column) and with (right column) Arnoldi. Top: the kkth eigenfunction pkp_{k} (pk=1\|p_{k}\|=1), k=5,10k=5,10, for the eigenvalues 0=λ1λk0=\lambda_{1}\leq\ldots\leq\lambda_{k}\leq\ldots. Bottom: errors of the 5th (-, \cdot) and 10th (--, \circ) eigenfunctions/eigenvalues. Bottom right: Hermite vs function values (in black) orthogonalized bases.

8 Example 7: indefinite integral on two intervals.

We want to find a polynomial approximation of f(x)dxp(x)+C\int f(x)\mathrm{d}x\approx p(x)+C, CC is a general constant. For example, if g(x)=axu(t)dtg(x)=\int_{a}^{x}u(t)~{}\mathrm{d}t, we have g(x)=f(x)g^{\prime}(x)=f(x), g(a)=0g(a)=0, the simplest differential equation with a point value condition. The goal is to find p(x)g(x)p(x)\approx g(x). The implementation is mostly the same as polyfitAh but the function header and the last line: function [d, H] = polyfitAih(x,f,n) and d = Q(m+1:2*m,2:n+1)\f; d = [0; d]; alternatively, one can orthogonalize only the function values and from the resulting Hessenberg matrix generate the derivative matrix. The solved example is shown in Figure 7. From the bottom right, we can see that, for both the Hermite Arnoldi basis and the function values Arnoldi basis, the error of pp can grow with nn in some range but still decreases to 101510^{-15} afterwards. Such transient instability does not appear for f(x)=1/(1+25x2)f(x)=1/(1+25x^{2}) on the Chebyshev grids of [1,1][-1,1].

Refer to caption
Refer to caption
Refer to caption
Refer to caption
Figure 7: Polynomial indefinite integral of f(x)=signxf(x)=\mathrm{sign}\ x on equidistant grids of [1,1/10][1/10,1][-1,-1/10]\cup[1/10,1] by the confluent Vandermonde without (left column) and with (right column) Arnoldi. Bottom right: Hermite (dots) vs function values (circles) orthogonalized bases.

9 Discussion.

This work is greatly inspired by the fascinating paper Vandermonde with Arnoldi [1] by Brubeck, Nakatsukasa and Trefethen. We saw a door open to the well-conditioned bases of polynomial spaces on arbitrary grids, and to many interesting applications, e.g., the lightning solvers [2, 3, 9, 10]. In the spirit of Chebfun [4], it is natural then to consider differential, integral and other operations of polynomials under the Arnoldi basis. Under the standard basis, the differential operation or Hermite interpolation leads to the confluent Vandermonde matrix, which is ill-conditioned [7]. The Arnoldi process can come to the rescue. However, it is not so straightforward to apply the method from [1]. The key idea behind the new method is the discovery of a connection of the confluent Vandermonde matrix to a Krylov subspace. This enables us to represent and compute the derivatives in a stable way. Two approaches are proposed to accomplish this task. One is constructing the basis for the column space of the confluent Vandermonde matrix directly by the Confluent Vandermonde with Arnoldi method based on the confluent Krylov subspace that we discovered. Another approach is using the basis generated by Vandermonde with Arnoldi and constructing the derivative matrix of the basis by exploiting the confluent Krylov subspace. With the new functionality of computing derivatives, we are able to do the Hermite interpolation/evaluation to high precision, to accomodate the Neumann/Robin boundary conditions, to compute the Dirichlet-to-Neumann map and its eigenmodes, and to do the indefinite integral.

We realized just upon finalizing this note that a formula of the derivative matrix has been given in [9, 2]. It is based on the recursive relation of the polynomial basis from Vandermonde with Arnoldi. Recall that the Arnoldi process produces the basis matrix QQ and the Hessenberg matrix HH that satisfy XQ=QHXQ_{-}=QH. If we imagine that the number of rows of XX and QQ goes to infinity, then we would get the polynomial recursion xpk(x)=j=1kpj(x)hjk+pk+1(x)hk+1,kxp_{k}(x)=\sum_{j=1}^{k}p_{j}(x)h_{jk}+p_{k+1}(x)h_{k+1,k} or pk+1(x)=(xpk(x)j=1kpj(x)hjk)/hk+1,kp_{k+1}(x)=(xp_{k}(x)-\sum_{j=1}^{k}p_{j}(x)h_{jk})/h_{k+1,k}. Taking derivative gives pk+1(x)=(pk(x)+xpk(x)j=1kpj(x)hjk)/hk+1,kp_{k+1}^{\prime}(x)=(p_{k}(x)+xp_{k}^{\prime}(x)-\sum_{j=1}^{k}p_{j}^{\prime}(x)h_{jk})/h_{k+1,k}. It can be seen that our second approach (e.g. polyfitA + polyvalAh) is equivalent to this formula.

Comparison of the Hermite orthogonalized basis and the function values orthogonalized basis has been made on each example. It is found that they perform equally well for the Hermite interpolation/evaluation task. But the function values orthogonalized basis is unstable for the example of sloshing modes, while the Hermite orthogonalized basis works stably. We also observed instability of both the approaches for the Fourier extension example and the indefinite integral example. A theoretical understanding of the comparison results and the instability phenomena could be interesting.

References

  • [1] Pablo D Brubeck, Yuji Nakatsukasa, and Lloyd N Trefethen. Vandermonde with Arnoldi. SIAM Review, 63(2):405–415, 2021.
  • [2] Pablo D Brubeck and Lloyd N Trefethen. Lightning Stokes solver. SIAM Journal on Scientific Computing, 44(3):A1205–A1226, 2022.
  • [3] Stefano Costa and Lloyd N Trefethen. AAA-least squares rational approximation and solution of Laplace problems. arXiv preprint arXiv:2107.01574, 2021.
  • [4] Tobin A Driscoll, Nicholas Hale, and Lloyd N Trefethen. Chebfun Guide. Pafnuty Publications, Oxford, 2014.
  • [5] Behnam Hashemi and Yuji Nakatsukasa. Least-squares spectral methods for ODE eigenvalue problems. arXiv preprint arXiv:2109.05384, 2021.
  • [6] Behnam Hashemi, Yuji Nakatsukasa, and Lloyd N Trefethen. Rectangular eigenvalue problems. arXiv preprint arXiv:2112.13698, 2021.
  • [7] Nicholas J Higham. Stability analysis of algorithms for solving confluent Vandermonde-like systems. SIAM Journal on Matrix Analysis and Applications, 11(1):23–41, 1990.
  • [8] David Mora, Gonzalo Rivera, and Rodolfo Rodríguez. A virtual element method for the Steklov eigenvalue problem. Mathematical Models and Methods in Applied Sciences, 25(08):1421–1445, 2015.
  • [9] Yuji Nakatsukasa and Lloyd N Trefethen. Reciprocal-log approximation and planar PDE solvers. SIAM Journal on Numerical Analysis, 59(6):2801–2822, 2021.
  • [10] Lloyd N Trefethen. Numerical conformal mapping with rational functions. Computational Methods and Function Theory, 20(3):369–387, 2020.