Additive Nonlinear Operator
Approximation
The linear algebra concepts arising from study of linear mappings
between vector spaces ,
, are
widely applicable to nonlinear functions also. The study of nonlinear
approximation starts with the simplest case of approximation of a
function with scalar values and arguments,
through additive corrections.
1.Function spaces
An immediate application of the linear algebra framework is to construct
vector spaces of real functions , with , and the
addition and scaling operations induced from ,
Comparing with the real vector space in which the analogous operation is ,
or componentwise
the key difference that arises is the dimension of the set of vectors.
Finite-dimensional vectors within
can be regarded as functions defined on a finite set , with .
The elements of are however functions
defined on , a set with cardinality
,
with the
cardinality of the naturals . This leads
to a review of the concept of a basis for this infinite-dimensional
case.
1.1.Infinite dimensional basis set
In the finite dimensional case
constituted a basis if any vector
could be expressed uniquely as a linear combination of the column
vectors of
While the above finite sum is well defined, there is no consistent
definition of an infinite sum of vectors. As a simple example, in the
vector space of real numbers , any finite sum of reals is well
defined, for instance
but the limit
cannot be determined. This leads to the necessity of seeking
finite-dimensional linear combinations to span a vector space
. First, define linear independence of
an infinite (possibly uncountable) set of vectors , where
is some indexing set.
Definition. The vector set is linearly
independent if the only
scalars, ,
that satisfy
|
(1) |
are ,
,…,.
The important aspect of the above definition is that all finite vector
subsets are linearly independent. The same approach is applied in the
definition of a spanning set.
Definition. Vectors within the set span
, stated as , if for
any
there exist
scalars, ,
such that
|
(2) |
This now allows a generally-applicable definition of basis and
dimension.
Definition. The vector set is a basis for
vector space if
-
is linearly independent;
-
.
Definition. The dimension of a vector space
is the cardinality of a basis set
, .
The use of finite sums to define linear independence and bases is not
overly restrictive since it can be proven that every vector space has
a basis. The proof of this theorem is based on Zorn's lemma from set
theory, and asserts exsitence of a basis, but no constructive procedure.
The difficulty in practical construction of bases for infinite
dimensional vector spaces is ascertained through basic examples.
Example. .
As a generalization of , consider the vector space of real
sequences
represented as a vectors with a countably infinite number of components
. Linear
combinations are defined by
Let denote the
vector of all zeros except the
position. In ,
the identity matrix was a basis, but this
does not generalize to ;
for example the vector cannot
be obtained by finite linear combination of the
vectors. In fact, there is no countable set of vectors that spans .
Example. . The vector space of polynomials on the real line has an easily
constructed basis, namely the set of the monomials
an infinite set with the cardinality as the naturals .
1.2.Alternatives to the concept of a
basis
The difficulty in ascribing significance to an infinite sum of vectors
can be resolved by endowing the vector space with additional structure,
in particular a way to define convergence of the partial sums
to a limit .
Fourier series.
One approach is the introduction of an inner product
and the associated norm .
A considerable advantage of this approach is that it not only allows
infinite linear combinations, but also definition of orthonormal
spanning sets. An example is the vector space of continuous functions
defined on with the inner product
and norm .
An orthonormal spanning set for
is given by
Vector spaces with an inner product are known as Hilbert spaces.
Taylor series.
Convergence of infinite sums can be determined through a norm, without
the need of an inner product. An example is the space of real-analytic
functions with the inf-norm
for which a spanning set is given by the monomials , and the infinite exapnsion
is convergent, with coefficients given by the Taylor series
Note that orthogonality of the spanning set cannot be established,
absent an inner product.
1.3.Common function spaces
Several function spaces find widespread application in scientific
computation. An overview is provided in Table 1.
|
bounded functions |
|
|
|
continuous functions |
|
with continuous derivatives up to |
|
with compact support |
|
and compact support |
|
that vanish at infinity |
|
smooth functions |
|
with finite -norm |
|
Sobolev space, with norm |
|
|
|
|
|
|
Table 1. Common vector spaces of
functions
|
2.Interpolation
The interpolation problem seeks the representation of a function known only through a sample data set ,
by an approximant , obtained through combination of
elements from some family of computable functions, . The
approximant is an interpolant of
if
or passes through the known poles of the function .
The objective is to use thus determined to approximate the
function at other points. Assuming ,
evaluation of at is an interpolation, while
evaluation at
or ,
is an extrapolation. The basic problems arising in interpolation
are:
-
choice of the family from which to build the approximant ;
-
choice of the combination technique;
-
estimation of the error of the approximation given some knowledge of
.
Algorithms for interpolation of real
functions can readily be extended to more complicated objects, e.g.,
interpolation of matrix representations of operators. Implementation
is aided by programming language polymorphism as in Julia.
Define a Julia package for function approximation, to be stored on
GitHub. First, define git environment variables.
Shell] |
git config --global user.name "SorinMitran" |
Shell] |
git config --global user.email "mitran@unc.edu" |
Next, define the package directory.
∴ |
home=unsafe_string(ccall(:getenv, Cstring, (Cstring,), "HOME")); |
∴ |
pkgdir = home * "/courses/MATH661/packages"; |
Define a package template
∴ |
tmpl=Template(;
user="SorinMitran", dir=pkgdir,
plugins = [ License(; name="MPL"),
Git(; manifest=true, ssh=true),
GitHubActions(; x86=true),
Codecov(),
Documenter{GitHubActions}(),
Develop(),
],
); |
∴ |
tmpl("Interpolation661"); |
[ Info: Running prehooks
[ Info: Running hooks
Activating environment at
‘~/courses/MATH661/packages/Interpolation661/Project.toml‘
Updating registry at
‘~/.julia/registries/General‘
No Changes to
‘~/web/courses/MATH661/packages/Interpolation661/Project.toml‘
No Changes to
‘~/web/courses/MATH661/packages/Interpolation661/Manifest.toml‘
Precompiling project…
[32m ✓ [39mInterpolation661
1 dependency successfully precompiled in 1
seconds
Activating environment at
‘~/.julia/environments/v1.6/Project.toml‘
Activating new environment at
‘~/courses/MATH661/packages/Interpolation661/docs/Project.toml‘
Resolving package versions…
Installed IOCapture
───────────
v0.2.2
Installed ANSIColoredPrinters ─
v0.0.1
Installed Parsers
─────────────
v2.1.0
Installed DocStringExtensions ─
v0.8.6
Installed Documenter
──────────
v0.27.10
Updating
‘~/web/courses/MATH661/packages/Interpolation661/docs/Project.toml‘
[e30172f5] + Documenter v0.27.10
Updating
‘~/web/courses/MATH661/packages/Interpolation661/docs/Manifest.toml‘
[a4c015fc] + ANSIColoredPrinters
v0.0.1
[ffbed154] + DocStringExtensions
v0.8.6
[e30172f5] + Documenter v0.27.10
[b5f81e59] + IOCapture v0.2.2
[682c06a0] + JSON v0.21.2
[69de0a69] + Parsers v2.1.0
[2a0f44e3] + Base64
[ade2ca70] + Dates
[b77e0a4c] + InteractiveUtils
[76f85450] + LibGit2
[56ddb016] + Logging
[d6f4376e] + Markdown
[a63ad114] + Mmap
[ca575930] + NetworkOptions
[de0858da] + Printf
[3fa0cd96] + REPL
[9a3f8284] + Random
[ea8e919c] + SHA
[9e88b42a] + Serialization
[6462fe0b] + Sockets
[8dfed614] + Test
[4ec0a83e] + Unicode
Precompiling project…
[32m ✓ [39m[90mIOCapture[39m
[32m ✓
[39m[90mANSIColoredPrinters[39m
[32m ✓
[39m[90mDocStringExtensions[39m
[33m ✓ [39m[90mParsers[39m
[33m ✓ [39m[90mJSON[39m
[32m ✓ [39mDocumenter
6 dependencies successfully precompiled in
5 seconds
[33m2[39m dependencies precompiled but
different versions are currently loaded. Restart julia to
access the new versions
Resolving package versions…
Updating
‘~/web/courses/MATH661/packages/Interpolation661/docs/Project.toml‘
[c8cb1979] + Interpolation661 v0.1.0
‘..‘
Updating
‘~/web/courses/MATH661/packages/Interpolation661/docs/Manifest.toml‘
[c8cb1979] + Interpolation661 v0.1.0
‘..‘
Activating environment at
‘~/.julia/environments/v1.6/Project.toml‘
[ Info: Running posthooks
Resolving package versions…
Updating
‘~/.julia/environments/v1.6/Project.toml‘
[c8cb1979] + Interpolation661 v0.1.0
‘~/courses/MATH661/packages/Interpolation661‘
Updating
‘~/.julia/environments/v1.6/Manifest.toml‘
[c8cb1979] + Interpolation661 v0.1.0
‘~/courses/MATH661/packages/Interpolation661‘
[ Info: New package is at
/home/mitran/courses/MATH661/packages/Interpolation661
2.1.Additive corrections
As to be expected, a widely used combination technique is linear
combination,
The idea is to capture the nonlinearity of through the
functions , while
maintaining the framework of linear combinations. Sampling of at the poles
of a data set , constructs the vectors
which gathered together into a matrix leads to the formulation of the
interpolation problem as
|
(3) |
Before choosing some specific function set ,
some general observations are useful.
-
The function values ,
are directly incorporated into the interpolation problem (3).
Any estimate of the error at other points requires additional
information on . Such information can
be furnished by bounds on the function values, or knowledge of its
derivatives for example.
-
A solution to (3) exists if .
Economical interpolations would use
functions in the set , hopefully
.
2.2.Polynomial interpolation
Monomial form of interpolating polynomial.
As noted above, the vector space of polynomials has an
easily constructed basis, that of the monomials
which shall be organized as a row vector of functions
With denoting the
first
monomials
a polynomial of degree is the linear
combination
Let
denote the matrix obtained from evaluation of the first
monomials at the sample points ,
The above notation conveys that a finite-dimensional matrix
is obtained from evaluation of the row vector of the monomial basis
function ,
at the column vector of sample points .
The interpolation condition leads to the
linear system
|
(4) |
For a solution to exist for arbitrary ,
must be of full rank, hence , in which case
becomes the Vandermonde matrix
known to be ill-conditioned. Since is
square and of full rank, (4) has a unique solution.
Finding the polynomial coefficients by solving the above linear system
requires operations. Evaluation of the monomial
form is economically accomplished in operations
through Horner's scheme
|
(5) |
 |
|
Figure 1. Monomial basis over interval
|
∴ |
n=6; x=range(-π,π,length=n+1); y=sin.(x); |
∴ |
t=range(-π,π,length=10*n); |
∴ |
M=ones(length(t),length(x)); |
∴ |
for j=2:n+1
M[:,j] = t.^(j-1)
end |
∴ |
for j=1:n+1
plot(t,M[:,j])
end |
∴ |
xlabel("t"); ylabel("m(j,t)"); grid("on"); title("Monomial basis"); |
∴ |
imdir=home*"/courses/MATH661/images/"; |
∴ |
savefig(imdir*"L18MonomialBasis.eps") |
Algorithm (Horner's scheme)
Input:
Output:
∴ |
function Horner(t,a)
n=length(a)-1; p=a[n+1]
for k=n:-1:1
p=a[k]+p*t
end
return p
end; |
∴ |
p2(t)=3*t^2-2*t+1; ap2=[1 -2 3]; |
∴ |
t=-3:3; [p2.(t) Horner.(t,Ref(ap2))] |
|
(6) |
Lagrange form of interpolating polynomial.
It is possible to reduce the operation count to find the interpolating
polynomial by carrying out an
decomposition of the monomial matrix ,
Let denote another set of
basis functions that evaluates to the identity matrix at the sample
points , such that ,
For arbitrary , the relationship
describes a linear mapping between the monomials and the
functions, a
mapping which is invertible since
is of full rank
Note that organization of bases as row vectors of functions leads to
linear mappings expressed through right factors.
The
factorization of the Vandermonde matrix can be determined
analytically, as exemplified for
by
In[37]:= |
V[n_]:=Table[Subscript[x, i]^j,{i, 0, n},{j, 0, n}];
n=3; n1=n+1; M=V[n] |
In[13]:= |
LU=Simplify[LUDecomposition[M]][[1]] |
In[14]:= |
L=Table[ If[i<j,LU[[j,i]], If[i==j, 1, 0]],{j,1,n1},{i,1,n1}] |
In[15]:= |
U=Table[ If[i>=j,LU[[j,i]], 0],{j,1,n1},{i,1,n1}] |
Both factors can be inverted
analytically, e.g., for ,
In[19]:= |
Linv=Simplify[Inverse[L]] |
In[20]:= |
Uinv=Simplify[Inverse[U]] |
The functions that result for
can be generalized as
known as the Lagrange basis set, where the prime on the product
symbol skips the index .
Note that each member of the basis is a polynomial of degree .
In[23]:= |
Simplify[{1,t,t^2,t^3}.Uinv.Linv] |
By construction, through the condition ,
a Lagrange basis function evaluated at a sample point is
A polynomial of degree is expressed as a
linear combinations of the Lagrange basis functions by
The interpolant of data is determined through the conditions
i.e., the linear combination coefficients are simply the sampled
function values .
|
(7) |
Determining the linear combination coefficients may be without cost, but
evaluation of the Lagrange form (7) of the interpolating
polynomial requires operations, significantly more costly
than the operations required by Horner's scheme
(5)
Algorithm (Lagrange evaluation)
Output:
if
then
∴ |
function Lagrange(t,x,y)
n=length(x)-1; p=0
for i=1:n+1
w=1
for j=1:n+1
if (i!=j) w=w*(t-x[j])/(x[i]-x[j]); end
end
p = p + w*y[i]
end
return p
end; |
∴ |
t=-3:3; [p2.(t) Lagrange.(t,Ref(x),Ref(y))] |
|
(8) |
 |
|
Figure 2. Lagrange basis for
for over interval
|
∴ |
n=6; x=range(-π,π,length=n+1); y=sin.(x); |
∴ |
t=range(-π,π,length=10*n); |
∴ |
M=ones(length(t),length(x)); |
∴ |
function lagrange(j,t,x,y)
n=length(x)-1; l=1
for i=1:n+1
if (i!=j) l = l*(t-x[i])/(x[j]-x[i]); end
end
return l
end; |
∴ |
for j=1:n+1
M[:,j] = lagrange.(j,t,Ref(x),Ref(y))
end |
∴ |
for j=1:n+1
plot(t,M[:,j])
end |
∴ |
xlabel("t"); ylabel("l(i,t)"); grid("on"); title("Lagrange basis"); |
∴ |
imdir=home*"/courses/MATH661/images/"; |
∴ |
savefig(imdir*"L18LagrangeBasis.eps") |
A reformulation of the Lagrange basis can however reduce the operation
count. Let , and rewrite as
with the weights
depending only on the function sample arguments ,
but not on the function values .
The interpolating polynomial is now
Interpolation of the function
would give
and taking the ratio yields
known as the barycentric Lagrange formula (by analogy to computation of
a center of mass). Evaluation of the weights
costs operations, but can be done once for
any set of . The
evaluation of now becomes an
process, comparable in cost to Horner's scheme.
Algorithm (Barycentric Lagrange evaluation)
Output:
; ;
∴ |
function BaryLagrange(t,x,y)
n=length(x)-1; w=ones(size(x));
for i=1:n+1
w[i]=1
for j=1:n+1
if (i!=j) w[i]=w[i]/(x[i]-x[j]); end
end
end
q=r=0
for i=1:n+1
d=t-x[i]
if d≈0 return y[i]; end
s=w[i]/d; q=q+y[i]*s; r=r+s
end
return q/r
end; |
∴ |
t=-3:3; [p2.(t) BaryLagrange.(t,Ref(x),Ref(y))] |
|
(10) |
Newton form of interpolating polynomial.
Inverting only one factor of the
mapping yields yet another basis set
The first four basis polynomials are
with ,
and in general
for .
In[22]:= |
Simplify[{1,x,x^2,x^3}.Uinv] |
Computation of the scaling factors would require operations, but can be avoided by
redefining the basis set as , with ,
and
known as the Newton basis. As usual, the coefficients
of the linear combination of Newton polynomials
are determined from the interpolation conditions .
The resulting linear system is of triangular form,
and readily solved by forward substitution.
The first few coefficients are
In[24]:= |
d2=(y2-(x2-x0)(y1-y0)/(x1-x0)-y0)/(x2-x0)/(x2-x1) |
In[25]:= |
dd2=((y2-y1)/(x2-x1)-(y1-y0)/(x1-x0))/(x2-x0) |
In[26]:= |
Simplify[dd2-d2] |
The forward substitution is efficiently expressed through the definition
of divided differences
or in general, the
divided difference
given in terms of the divided differences. The forward substitution
computations are conveniently organized in a table, useful both for hand
computation and also for code implementation.
|
|
Table 2. Table of divided differences. The
Newton basis coefficients are
the diagonal terms.
|
Algorithm (Forward substitution, Newton
coefficients)
∴ |
function DivDif(x,y)
n=length(x)-1; d=copy(y)
for i=2:n+1
for j=n+1:-1:i
d[j] = (d[j]-d[j-1])/(x[j]-x[j-i+1])
end
end
return d
end; |
∴ |
p2(t)=3*t^2-2*t+1; x=[-2 0 2]; y=p2.(x); d=DivDif(x,y) |
The above algorithm requires only operations,
and the Newton form of the interpolating polynomial
can also be evaluated in operations
Algorithm (Newton polynomial evaluation)
Input:
Output:
∴ |
function Newton(t,x,d)
n=length(x)-1; p=d[1]; r=1
for k=2:n+1
r = r*(t-x[k-1])
p = p + d[k]*r
end
return p
end; |
∴ |
p2(t)=3*t^2-2*t+1; x=[-2 0 2]; y=p2.(x); d=DivDif(x,y); |
∴ |
t=-3:3; [p2.(t) Newton.(t,Ref(x),Ref(d))] |
|
(12) |
 |
|
Figure 3. Newton basis for
for over interval
|
∴ |
n=6; x=range(-π,π,length=n+1); y=sin.(x); |
∴ |
t=range(-π,π,length=10*n); |
∴ |
M=ones(length(t),length(x)); |
∴ |
function newton(j,t,x,y)
n=length(x)-1; nj=1
for i=1:j-1
nj = nj*(t-x[i])
end
return nj
end; |
∴ |
for j=1:n+1
M[:,j] = newton.(j,t,Ref(x),Ref(y))
end |
∴ |
for j=1:n+1
plot(t,M[:,j])
end |
∴ |
xlabel("t"); ylabel("l(i,t)"); grid("on"); title("Newton basis"); |
∴ |
imdir=home*"/courses/MATH661/images/"; |
∴ |
savefig(imdir*"L18NewtonBasis.eps") |