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.

Exercises

  1. Legendre polynomials and orthogonality

    The Legendre polynomials satisfy

    (n+1)Pn+1(τ)=(2n+1)τPn(τ)nPn1(τ),(n+1)P_{n+1}(\tau) = (2n+1)\tau P_n(\tau) - nP_{n-1}(\tau),

    with

    P0(τ)=1,P1(τ)=τ.P_0(\tau)=1, \qquad P_1(\tau)=\tau.

    (a) Use the recurrence relation to derive P2(τ)P_2(\tau), P3(τ)P_3(\tau), and P4(τ)P_4(\tau).

    (b) Verify directly that

    11P3(τ)Pj(τ)dτ=0,j=0,1,2.\int_{-1}^{1} P_3(\tau)P_j(\tau)\,\mathrm{d}\tau = 0, \qquad j=0,1,2.

    (c) Verify that

    11P32(τ)dτ=27.\int_{-1}^{1} P_3^2(\tau)\,\mathrm{d}\tau = \frac{2}{7}.

    (d) Explain why every polynomial of degree at most 2 is orthogonal to P3P_3.

  2. Lagrange interpolation and differentiation

    Consider the support points

    τ1=1,τ2=0,τ3=1.\tau_1=-1, \qquad \tau_2=0, \qquad \tau_3=1.

    (a) Construct the three Lagrange basis polynomials Li(τ)L_i(\tau).

    (b) Verify the interpolation property

    Li(τj)=δij.L_i(\tau_j)=\delta_{ij}.

    (c) Construct the interpolation polynomial for

    g(τ)=τ2+2τ1g(\tau)=\tau^2+2\tau-1

    using only the values g(τi)g(\tau_i), and show that the polynomial is recovered exactly.

    (d) Construct the differentiation matrix

    Dji=Li(τj).D_{ji}=L_i'(\tau_j).

    (e) Verify that

    D1=0.\boldsymbol{D}\boldsymbol{1} = \boldsymbol{0}.

    (f) Use D\boldsymbol{D} to recover g(τi)g'(\tau_i) exactly.

  3. Three-point Legendre–Gauss quadrature

    For N=3N=3, the LG points are the roots of P3(τ)P_3(\tau).

    (a) Determine the three LG points.

    (b) Using symmetry and exact integration of 1, τ2\tau^2, and τ4\tau^4, derive the three quadrature weights.

    (c) Verify that the resulting rule integrates every monomial τk\tau^k, k=0,,5k=0,\ldots,5, exactly.

    (d) Evaluate the quadrature error for

    g(τ)=τ6.g(\tau)=\tau^6.

    (e) Explain why this result is consistent with the LG exactness degree 2N12N-1.

  4. Proof of Legendre–Gauss exactness

    Let g(τ)g(\tau) be a polynomial of degree at most 2N12N-1.

    (a) Show that it can be written as

    g(τ)=PN(τ)q(τ)+r(τ),g(\tau) = P_N(\tau)q(\tau)+r(\tau),

    where qq and rr have degree at most N1N-1.

    (b) Use Legendre orthogonality to show that

    11PN(τ)q(τ)dτ=0.\int_{-1}^{1} P_N(\tau)q(\tau)\,\mathrm{d}\tau = 0.

    (c) Show that the LG quadrature contribution from PN(τ)q(τ)P_N(\tau)q(\tau) is also zero.

    (d) Prove that the quadrature integrates r(τ)r(\tau) exactly.

    (e) Conclude that NN-point LG quadrature is exact for every polynomial of degree at most 2N12N-1.

  5. Low-order LGL construction and singularity

    Consider the N=4N=4 LGL grid.

    (a) Starting from the roots of P3(τ)P_3'(\tau), derive the four LGL points.

    (b) Compute the four LGL quadrature weights.

    (c) Construct the Lagrange basis polynomials associated with the four points.

    (d) Construct the 4×44\times4 differentiation matrix

    Dji=Li(τj).D_{ji}=L_i'(\tau_j).

    (e) Verify that

    D1=0.\boldsymbol{D}\boldsymbol{1} = \boldsymbol{0}.

    (f) Conclude that D\boldsymbol{D} is singular.

    (g) Relate the singularity to the fact that the state polynomial has degree N1N-1, whereas its derivative has degree N2N-2.

  6. Legendre–Gauss differential and integral forms

    Let τ1,,τN\tau_1,\ldots,\tau_N be the LG points and introduce the non-collocated initial point

    τ0=1.\tau_0=-1.

    Approximate the state by

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

    (a) Show that the state polynomial has degree at most NN.

    (b) Show that its derivative has degree at most N1N-1.

    (c) Derive the rectangular differentiation equations

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

    (d) Assuming D1:N\boldsymbol{D}_{1:N} is invertible, derive

    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}.

    (e) Explain why D1:N1\boldsymbol{D}_{1:N}^{-1} acts as an integration matrix.

    (f) Derive the terminal-state recovery equation

    XN+1=X0+wTF1:N.\boldsymbol{X}_{N+1} = \boldsymbol{X}_0 + \boldsymbol{w}^{\mathsf T} \boldsymbol{F}_{1:N}.
  7. Explicit two-point LG differentiation matrix

    Use N=2N=2 LG points,

    τ1=13,τ2=13,\tau_1=-\frac{1}{\sqrt{3}}, \qquad \tau_2=\frac{1}{\sqrt{3}},

    together with the initial support point τ0=1\tau_0=-1.

    (a) Construct the three Lagrange basis polynomials.

    (b) Construct the 2×32\times3 LG differentiation matrix evaluated at τ1\tau_1 and τ2\tau_2.

    (c) Partition it as

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

    (d) Verify that D1:2\boldsymbol{D}_{1:2} is nonsingular.

    (e) Compute D1:21\boldsymbol{D}_{1:2}^{-1}.

    (f) For

    F(τ)=1+τ,X(1)=X0,F(\tau)=1+\tau, \qquad X(-1)=X_0,

    recover X(τ1)X(\tau_1), X(τ2)X(\tau_2), and X(1)X(1), and compare them with the exact integral of FF.

  8. Legendre–Gauss–Radau differential and integral forms

    Let τ1,,τN\tau_1,\ldots,\tau_N be left-LGR collocation points, where

    τ1=1,τN<1,\tau_1=-1, \qquad \tau_N<1,

    and introduce the non-collocated terminal support point

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

    Approximate the state by

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

    (a) Determine the degree of the state polynomial.

    (b) Determine the degree of its derivative.

    (c) Show that collocation at the NN LGR points gives

    D1X1+D2:N+1X2:N+1=F1:N.\boldsymbol{D}_1\boldsymbol{X}_1 + \boldsymbol{D}_{2:N+1}\boldsymbol{X}_{2:N+1} = \boldsymbol{F}_{1:N}.

    (d) Assuming D2:N+1\boldsymbol{D}_{2:N+1} is invertible, derive the corresponding integral form.

    (e) Explain why the terminal state is directly included in the state polynomial but is not a collocation value.

    (f) Explain why the LGR scheme provides a control value at the initial time, whereas the LG scheme does not.

  9. Comparison of LG, LGR, and LGL

    For each of the LG, LGR, and LGL methods using NN quadrature points, determine:

    (a) which endpoints are included among the collocation points;

    (b) the polynomial defining the collocation points;

    (c) the exact polynomial degree of the quadrature rule;

    (d) the degree of the state interpolant used in the corresponding pseudospectral construction;

    (e) the degree of the derivative polynomial;

    (f) whether the state differentiation matrix is square or rectangular;

    (g) whether an ordinary inverse or an invertible square submatrix exists;

    (h) how the terminal state is represented.

    Then, for N=6N=6, compute the exactness degree of all three quadrature rules and determine which methods are guaranteed to integrate τ10\tau^{10} exactly.

  10. Complete LGR pseudospectral transcription

    On the normalized interval [1,1][-1,1], consider

    minx(),u()  J=12x2(1)+1211(x2(τ)+u2(τ))dτ,\min_{x(\cdot),u(\cdot)} \; J = \frac{1}{2}x^2(1) + \frac{1}{2} \int_{-1}^{1} \left( x^2(\tau)+u^2(\tau) \right)\,\mathrm{d}\tau,

    subject to

    x˙(τ)=x(τ)+u(τ),x(1)=x0.\dot{x}(\tau) = -x(\tau)+u(\tau), \qquad x(-1)=x_0.

    Use NN left-LGR collocation points and the non-collocated terminal point τN+1=1\tau_{N+1}=1.

    (a) Define all state and control decision variables.

    (b) Write the LGR state interpolation polynomial.

    (c) Construct the collocation equations in matrix form.

    (d) Write the Gaussian-quadrature approximation of the integral cost.

    (e) Write the complete finite-dimensional objective.

    (f) Write the initial boundary constraint.

    (g) Assemble the complete nonlinear program.

    (h) Determine the number of scalar decision variables and equality constraints.

    (i) Explain where the terminal state enters the NLP even though τ=1\tau=1 is not a collocation point.