Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The Legendre–Gauss Pseudospectral Method

This section develops the Legendre–Gauss (LG) pseudospectral method for direct optimal control. The method is particularly important because it shows how Gaussian quadrature can be preserved even though the LG points do not include either endpoint of the interval.

The key ideas are:

Model Optimal-Control Problem

Consider the normalized optimal-control problem

minx(),u()Φ(x(1)),\min_{\boldsymbol{x}(\cdot),\boldsymbol{u}(\cdot)} \Phi\bigl(\boldsymbol{x}(1)\bigr),

subject to

x˙(τ)=f(x(τ),u(τ),τ),τ[1,1],\dot{\boldsymbol{x}}(\tau) = \boldsymbol{f}\bigl(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau),\tau\bigr), \qquad \tau\in[-1,1],

and the initial condition

x(1)=x0.\boldsymbol{x}(-1)=\boldsymbol{x}_0.

The interval is already normalized. A general interval [t0,tf][t_0,t_f] may be mapped to [1,1][-1,1] through an affine transformation.

Location of the LG Points

Let

τ1,τ2,,τN\tau_1,\tau_2,\ldots,\tau_N

be the roots of the Legendre polynomial PN(τ)P_N(\tau).

These points satisfy

1<τ1<τ2<<τN<1.-1<\tau_1<\tau_2<\cdots<\tau_N<1.

Therefore, neither endpoint belongs to the LG quadrature set.

Why the Naive LG Construction Fails

Suppose the state were approximated only at the NN LG points:

X(τ)=i=1NXiLi(τ).\boldsymbol{X}(\tau) = \sum_{i=1}^{N}\boldsymbol{X}_iL_i(\tau).

This polynomial has degree N1N-1.

Its derivative has degree N2N-2.

Collocating the derivative at all NN LG points would again produce an over-collocated system, just as in the LGL formulation. In addition, the initial and final conditions would be enforced at the wrong points.

Thus, the LG method must be constructed differently.

Introduction of Non-Collocated Endpoints

Introduce

τ0=1\tau_0=-1

as a non-collocated initial point.

Also define

τN+1=1\tau_{N+1}=1

as a non-collocated terminal point.

The initial point is included in the state approximation.

The terminal point is not included in the collocation polynomial, but it will later be recovered by Gaussian quadrature.

LG State Approximation

Approximate the state using the initial point and all NN LG points:

X(τ)=i=0NXiLi(τ),\boxed{ \boldsymbol{X}(\tau) = \sum_{i=0}^{N} \boldsymbol{X}_i L_i(\tau), }

where

Li(τ)=j=0jiNττjτiτj.L_i(\tau) = \prod_{\substack{j=0\\j\neq i}}^{N} \frac{\tau-\tau_j}{\tau_i-\tau_j}.

The approximation contains N+1N+1 support points and therefore has degree NN.

At the support points,

X(τj)=Xj,j=0,,N.\boldsymbol{X}(\tau_j)=\boldsymbol{X}_j, \qquad j=0,\ldots,N.

Derivative Approximation

Differentiating,

X˙(τ)=i=0NXiLi(τ).\dot{\boldsymbol{X}}(\tau) = \sum_{i=0}^{N} \boldsymbol{X}_iL_i'(\tau).

Since X(τ)\boldsymbol{X}(\tau) has degree NN, its derivative has degree N1N-1.

A polynomial of degree N1N-1 is uniquely determined by NN conditions.

The LG rule provides exactly NN collocation points.

Thus, unlike the naive construction, the collocation count is now correct.

LG Collocation Equations

Collocate the derivative approximation at the NN LG points:

X˙(τj)=f(Xj,Uj,τj),j=1,,N.\dot{\boldsymbol{X}}(\tau_j) = \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j,\tau_j), \qquad j=1,\ldots,N.

Therefore,

i=0NXiLi(τj)=f(Xj,Uj,τj).\sum_{i=0}^{N} \boldsymbol{X}_iL_i'(\tau_j) = \boldsymbol{f}(\boldsymbol{X}_j,\boldsymbol{U}_j,\tau_j).

Define

Dji=Li(τj),j=1,,N,i=0,,N.D_{ji} = L_i'(\tau_j), \qquad j=1,\ldots,N, \qquad i=0,\ldots,N.

The LG differentiation matrix is

DRN×(N+1).\boxed{ \boldsymbol{D}\in\mathbb{R}^{N\times(N+1)}. }

It is rectangular.

Matrix Form of the Differential Equations

Partition the matrix as

D=[D0D1:N],\boldsymbol{D} = \begin{bmatrix} \boldsymbol{D}_0 & \boldsymbol{D}_{1:N} \end{bmatrix},

where:

Define

X1:N=[X1XN],\boldsymbol{X}_{1:N} = \begin{bmatrix} \boldsymbol{X}_1\\ \vdots\\ \boldsymbol{X}_N \end{bmatrix},

and

F1:N=[f(X1,U1,τ1)f(XN,UN,τN)].\boldsymbol{F}_{1:N} = \begin{bmatrix} \boldsymbol{f}(\boldsymbol{X}_1,\boldsymbol{U}_1,\tau_1)\\ \vdots\\ \boldsymbol{f}(\boldsymbol{X}_N,\boldsymbol{U}_N,\tau_N) \end{bmatrix}.

The collocation equations become

D0X0+D1:NX1:N=F1:N.\boxed{ \boldsymbol{D}_0\boldsymbol{X}_0 + \boldsymbol{D}_{1:N}\boldsymbol{X}_{1:N} = \boldsymbol{F}_{1:N}. }

The initial condition is

X0=x0.\boldsymbol{X}_0=\boldsymbol{x}_0.

Integral Form of the Dynamics

The exact dynamics satisfy

x(τ)=x(1)+1τf(x(s),u(s),s)ds.\boldsymbol{x}(\tau) = \boldsymbol{x}(-1) + \int_{-1}^{\tau} \boldsymbol{f}\bigl(\boldsymbol{x}(s),\boldsymbol{u}(s),s\bigr)\,\mathrm{d} s.

At an LG point τj\tau_j,

x(τj)=x(1)+1τjf(x(s),u(s),s)ds.\boldsymbol{x}(\tau_j) = \boldsymbol{x}(-1) + \int_{-1}^{\tau_j} \boldsymbol{f}\bigl(\boldsymbol{x}(s),\boldsymbol{u}(s),s\bigr)\,\mathrm{d} s.

Approximate each integral using a scaled LG quadrature:

Xj=X0+i=1NAjiFi,j=1,,N.\boxed{ \boldsymbol{X}_j = \boldsymbol{X}_0 + \sum_{i=1}^{N} A_{ji}\boldsymbol{F}_i, \qquad j=1,\ldots,N. }

The coefficients AjiA_{ji} are the integration weights from -1 to τj\tau_j.

In matrix form,

X1:N=1X0+A1:NF1:N.\boxed{ \boldsymbol{X}_{1:N} = \boldsymbol{1}\,\boldsymbol{X}_0 + \boldsymbol{A}_{1:N}\boldsymbol{F}_{1:N}. }

Here,

A1:NRN×N\boldsymbol{A}_{1:N}\in\mathbb{R}^{N\times N}

is the LG integration matrix.

Recovery of the Terminal State

The final point τN+1=1\tau_{N+1}=1 is not a collocation point.

However,

x(1)=x(1)+11f(x(τ),u(τ),τ)dτ.\boldsymbol{x}(1) = \boldsymbol{x}(-1) + \int_{-1}^{1} \boldsymbol{f}\bigl(\boldsymbol{x}(\tau),\boldsymbol{u}(\tau),\tau\bigr)\,\mathrm{d}\tau.

Using the standard LG quadrature weights wiw_i,

XN+1=X0+i=1NwiFi.\boxed{ \boldsymbol{X}_{N+1} = \boldsymbol{X}_0 + \sum_{i=1}^{N} w_i\boldsymbol{F}_i. }

Equivalently,

XN+1=X0+wTF1:N.\boxed{ \boldsymbol{X}_{N+1} = \boldsymbol{X}_0+\boldsymbol{w}^{\mathsf{T}}\boldsymbol{F}_{1:N}. }

The Mayer objective becomes

Φ(XN+1).\Phi(\boldsymbol{X}_{N+1}).

Thus the terminal state is recovered without making τ=1\tau=1 a collocation point.

Equivalence of Differential and Integral Forms

Starting with

D0X0+D1:NX1:N=F1:N,\boldsymbol{D}_0\boldsymbol{X}_0 + \boldsymbol{D}_{1:N}\boldsymbol{X}_{1:N} = \boldsymbol{F}_{1:N},

assume that

D1:N\boldsymbol{D}_{1:N}

is nonsingular.

Then

X1:N=D1:N1D0X0+D1:N1F1:N.\boldsymbol{X}_{1:N} = - \boldsymbol{D}_{1:N}^{-1}\boldsymbol{D}_0\boldsymbol{X}_0 + \boldsymbol{D}_{1:N}^{-1}\boldsymbol{F}_{1:N}.

The critical identities are

D1:N1D0=1,\boxed{ -\boldsymbol{D}_{1:N}^{-1}\boldsymbol{D}_0 = \boldsymbol{1}, }

and

D1:N1=A1:N.\boxed{ \boldsymbol{D}_{1:N}^{-1} = \boldsymbol{A}_{1:N}. }

Therefore,

X1:N=1X0+A1:NF1:N,\boldsymbol{X}_{1:N} = \boldsymbol{1}\,\boldsymbol{X}_0 + \boldsymbol{A}_{1:N}\boldsymbol{F}_{1:N},

which is exactly the integral form.

Why the Initial Point Must Be Isolated

The initial condition acts as the integration constant.

When solving

x˙=f,\dot{\boldsymbol{x}}=\boldsymbol{f},

integration gives

x(τ)=x(1)+1τf(s)ds.\boldsymbol{x}(\tau) = \boldsymbol{x}(-1) + \int_{-1}^{\tau}\boldsymbol{f}(s)\,\mathrm{d} s.

The initial value is not part of the quadrature itself.

It must remain separate from the accumulated integral.

This is why the LG method includes τ0=1\tau_0=-1 in the state approximation but does not collocate the dynamics there.

Comparison with the LGL Method

FeatureLGLLG
Quadrature endpointsBoth includedNeither included
State approximationLGL nodesInitial point plus LG nodes
Differentiation matrixSquareRectangular
Key submatrixSingularNonsingular
Equivalent integral formNot directly availableExactly available
Terminal stateDirect nodeRecovered by quadrature

Complete LG NLP Formulation

A simplified LG transcription is

minX,UΦ(XN+1)subject toD0X0+D1:NX1:NF1:N=0,X0x0=0,XN+1X0wTF1:N=0.\boxed{ \begin{aligned} \min_{\boldsymbol{X},\boldsymbol{U}}\quad & \Phi(\boldsymbol{X}_{N+1}) \\ \text{subject to}\quad & \boldsymbol{D}_0\boldsymbol{X}_0 + \boldsymbol{D}_{1:N}\boldsymbol{X}_{1:N} - \boldsymbol{F}_{1:N} = \boldsymbol{0}, \\ & \boldsymbol{X}_0-\boldsymbol{x}_0=\boldsymbol{0}, \\ & \boldsymbol{X}_{N+1} - \boldsymbol{X}_0 - \boldsymbol{w}^{\mathsf{T}}\boldsymbol{F}_{1:N} = \boldsymbol{0}. \end{aligned} }

Additional endpoint, path, and control constraints may be appended.

Computational Interpretation

The differential form is often computationally preferable because:

However, the integral form is essential for understanding why the method is a valid Gaussian quadrature method.

Remaining Limitation of the LG Method

The control is approximated only at the LG points:

U1,,UN.\boldsymbol{U}_1,\ldots,\boldsymbol{U}_N.

There is no control variable at

τ=1.\tau=-1.

Thus the first available control value occurs at

τ1>1.\tau_1>-1.

This is inconvenient in:

This limitation motivates the Legendre–Gauss–Radau method, which includes one endpoint in the quadrature set.

Generalization to Multiple Mesh Intervals

For a multiple-interval transcription:

  1. divide the normalized horizon into mesh intervals;

  2. map each interval locally to [1,1][-1,1];

  3. apply LG collocation inside each interval;

  4. include the left endpoint of each interval as a non-collocated state point;

  5. recover the right endpoint through quadrature;

  6. impose continuity between neighboring intervals.

This produces an hphp-type pseudospectral method when both interval sizes and polynomial degrees may vary.

Summary

  1. LG points exclude both endpoints.

  2. A naive LG transcription is invalid.

  3. The initial point is added as a non-collocated support point.

  4. The state polynomial has degree NN.

  5. Its derivative has degree N1N-1.

  6. The derivative is collocated at exactly NN LG points.

  7. The LG differentiation matrix is rectangular.

  8. Its square submatrix D1:N\boldsymbol{D}_{1:N} is invertible.

  9. The inverse of this submatrix is the LG integration matrix.

  10. The differential and integral forms are equivalent.

  11. The final state is recovered using standard LG quadrature.

  12. The method is a true Gaussian quadrature integration scheme.

  13. The absence of an initial control value motivates LGR collocation.

Connection. Including one endpoint instead yields LGR, a closely related formulation with practical advantages for initial control and multiple-interval assembly.