Function Repository Resource:

OrthogonalPolynomialVandermondeSolve

Source Notebook

Solve an orthogonal polynomial Vandermonde linear system

Contributed by: Jan Mangaldan

ResourceFunction["OrthogonalPolynomialVandermondeSolve"][poly,{a1,a2,},{b1,b2,}]

solves the primal Vandermonde problem V.x==b, where V(a1,a2,) is the orthogonal polynomial Vandermonde matrix with respect to the basis represented by poly.

Details and Options

The argument poly can be any of the following:
"ChebyshevFirst"Chebyshev polynomial of the first kind ChebyshevT[i,x]
"ChebyshevSecond"Chebyshev polynomial of the second kind ChebyshevU[i,x]
"Hermite"Hermite polynomial HermiteH[i,x]
"Laguerre"Laguerre polynomial LaguerreL[i,x]
"Legendre"Legendre polynomial LegendreP[i,x]
{"Gebenbauer",m}Gegenbauer polynomial GegenbauerC[i,m,x]
{"Laguerre",a}associated Laguerre polynomial LaguerreL[i,a,x]
{"Jacobi",a,b}Jacobi polynomial JacobiP[i,a,b,x]
Strings in specifications like "Legendre" and {"Jacobi",a,b} can be replaced with the corresponding symbols, as in LegendreP and {JacobiP,a,b}.
If the argument poly is set to "Monomial", the classical Vandermonde solution is generated.
ResourceFunction["OrthogonalPolynomialVandermondeSolve"][poly,{a1,a2,},{b1,b2,},"Transpose"True] solves the dual Vandermonde problem Transpose[V].x==b.

Examples

Basic Examples (1) 

Solve a Chebyshev–Vandermonde system:

In[1]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"]["ChebyshevFirst", {1, 2, 3, 4}, {4, 10, 56, 370}]
Out[1]=

Scope (2) 

Solve a Jacobi–Vandermonde system with symbolic parameters and vectors:

In[2]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"][{"Jacobi", \[Alpha], \
\[Beta]}, {Subscript[x, 1], Subscript[x, 2]}, {Subscript[y, 1], Subscript[y, 2]}]
Out[2]=

An equivalent specification:

In[3]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"][{JacobiP, \[Alpha], \
\[Beta]}, {Subscript[x, 1], Subscript[x, 2]}, {Subscript[y, 1], Subscript[y, 2]}]
Out[3]=

Solve a Hermite–Vandermonde system with numeric vectors:

In[4]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"]["Hermite", {0., 0.1, 0.5, 1.,
   2.}, {0., 0.3, 0.6, -0.2, 3.}]
Out[4]=

Options (2) 

Transpose (2) 

With "Transpose"False, OrthogonalPolynomialVandermondeSolve solves a primal Vandermonde problem:

In[5]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"]["Laguerre", {x1, x2, x3}, {y1, y2, y3}]
Out[5]=
In[6]:=
% == LinearSolve[
   ResourceFunction["OrthogonalPolynomialVandermondeMatrix"][
    "Laguerre", {x1, x2, x3}], {y1, y2, y3}] // Simplify
Out[6]=

With "Transpose"True, OrthogonalPolynomialVandermondeSolve solves a dual Vandermonde problem:

In[7]:=
ResourceFunction[
 "OrthogonalPolynomialVandermondeSolve"]["Laguerre", {x1, x2, x3}, {y1, y2, y3}, "Transpose" -> True]
Out[7]=
In[8]:=
% == LinearSolve[
   Transpose@
    ResourceFunction["OrthogonalPolynomialVandermondeMatrix"][
     "Laguerre", {x1, x2, x3}], {y1, y2, y3}] // Simplify
Out[8]=

Applications (2) 

Get the Legendre series coefficients of an interpolating polynomial:

In[9]:=
pts = {{0., 0.}, {0.1, 0.3}, {0.5, 0.6}, {1., -0.2}, {2., 3.}};
cc = ResourceFunction["OrthogonalPolynomialVandermondeSolve"][
  "Legendre", pts[[All, 1]], pts[[All, 2]], "Transpose" -> True]
Out[10]=

Use the resource function OrthogonalPolynomialSum to get the corresponding orthogonal polynomial series, and compare with the result of InterpolatingPolynomial:

In[11]:=
{ResourceFunction["OrthogonalPolynomialSum"][cc, "Legendre", x], InterpolatingPolynomial[pts, x]} // Expand
Out[11]=

Properties and Relations (2) 

OrthogonalPolynomialVandermondeSolve is more efficient than using LinearSolve on an orthogonal polynomial Vandermonde system:

In[12]:=
xr = RandomVariate[NormalDistribution[], 12, WorkingPrecision -> 30];
yr = RandomVariate[NormalDistribution[], 12, WorkingPrecision -> 30];
In[13]:=
AbsoluteTiming[
 c1 = ResourceFunction["OrthogonalPolynomialVandermondeSolve"][
    "Hermite", N[xr], N[yr]];]
Out[13]=
In[14]:=
AbsoluteTiming[
 c2 = LinearSolve[
    ResourceFunction["OrthogonalPolynomialVandermondeMatrix"][
     "Hermite", N[xr]], N[yr]];]
Out[14]=

The result of OrthogonalPolynomialVandermondeSolve is also often more accurate:

In[15]:=
cTrue = LinearSolve[
   ResourceFunction["OrthogonalPolynomialVandermondeMatrix"][
    "Hermite", xr], yr];
In[16]:=
Norm[c1 - cTrue, \[Infinity]]
Out[16]=
In[17]:=
Norm[c2 - cTrue, \[Infinity]]
Out[17]=

Version History

  • 1.0.0 – 27 April 2021

Source Metadata

Related Resources

License Information