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. Global and local time transformations

    The physical time interval is

    t[t0,tf],t\in[t_0,t_f],

    and the global transformed coordinate is

    s[1,1].s\in[-1,1].

    The transformed domain is divided into KK mesh intervals,

    1=s0<s1<<sK=1.-1=s_0<s_1<\cdots<s_K=1.

    For interval kk, introduce a local coordinate

    τ[1,1]\tau\in[-1,1]

    that maps to

    s[sk1,sk].s\in[s_{k-1},s_k].

    (a) Derive the global affine transformations s(t)s(t) and t(s)t(s).

    (b) Derive the local affine transformations s(k)(τ)s^{(k)}(\tau) and τ(k)(s)\tau^{(k)}(s).

    (c) Derive the combined map t(k)(τ)t^{(k)}(\tau).

    (d) Show that

    dtdτ=tft04(sksk1).\frac{\mathrm{d}t}{\mathrm{d}\tau} = \frac{t_f-t_0}{4} \left( s_k-s_{k-1} \right).

    (e) Derive

    t(k)(τ)t0,t(k)(τ)tf.\frac{\partial t^{(k)}(\tau)}{\partial t_0}, \qquad \frac{\partial t^{(k)}(\tau)}{\partial t_f}.

    (f) For fixed mesh points, verify that these two derivatives sum to one.

  2. Local multiple-interval LGR transcription

    On interval kk, let

    τ1(k),,τNk(k)\tau_1^{(k)},\ldots,\tau_{N_k}^{(k)}

    be the left-LGR collocation points, and let

    τNk+1(k)=1\tau_{N_k+1}^{(k)}=1

    be the noncollocated terminal state point.

    Consider

    x˙=f(x,u,t).\dot{\boldsymbol{x}} = \boldsymbol{f} \left( \boldsymbol{x}, \boldsymbol{u}, t \right).

    (a) Write the local state interpolation polynomial.

    (b) Construct the local differentiation matrix

    D(k)RNk×(Nk+1).\boldsymbol{D}^{(k)} \in \mathbb{R}^{N_k\times(N_k+1)}.

    (c) Derive the local collocation equations

    D(k)X(k)=tft04(sksk1)F(k).\boldsymbol{D}^{(k)} \boldsymbol{X}^{(k)} = \frac{t_f-t_0}{4} \left( s_k-s_{k-1} \right) \boldsymbol{F}^{(k)}.

    (d) State where the control variables are defined.

    (e) Explain why the right endpoint of interval kk has a state value but no control value belonging to interval kk.

    (f) Derive the state-continuity condition between intervals kk and k+1k+1.

    (g) Compare explicit continuity constraints with the shared-interface-state formulation.

  3. Counting variables and points on a nonuniform mesh

    Consider

    K=4,N1=3,N2=5,N3=4,N4=6.K=4, \qquad N_1=3, \quad N_2=5, \quad N_3=4, \quad N_4=6.

    (a) Compute the total number of collocation points.

    (b) Compute the total number of unique state points when shared interface variables are used.

    (c) Compute the total number of control points.

    (d) For nxn_x states and nun_u controls, derive the number of scalar state and control decision variables.

    (e) Add npn_p static parameters and free t0,tft_0,t_f, and derive the complete decision-vector dimension.

    (f) Determine the number of scalar defect equations.

    (g) If separate interface-state variables are retained, determine the number of additional state variables and continuity equations.

    (h) Verify that the two interface formulations have the same number of degrees of freedom.

  4. Global assembly of the multiple-interval differentiation matrix

    Consider two mesh intervals with polynomial degrees N1N_1 and N2N_2.

    (a) Write the two local matrices

    D(1)RN1×(N1+1),D(2)RN2×(N2+1).\boldsymbol{D}^{(1)} \in \mathbb{R}^{N_1\times(N_1+1)}, \qquad \boldsymbol{D}^{(2)} \in \mathbb{R}^{N_2\times(N_2+1)}.

    (b) Assemble the global differentiation matrix using a shared state at the interface.

    (c) Show that its dimensions are

    (N1+N2)×(N1+N2+1).(N_1+N_2) \times (N_1+N_2+1).

    (d) Identify the column shared by the two local blocks.

    (e) Generalize the construction to KK intervals.

    (f) Show that, with

    N=k=1KNk,N=\sum_{k=1}^{K}N_k,

    the global matrix satisfies

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

    (g) Explain why the matrix remains sparse as the number of intervals increases.

    (h) Derive the global collocation equations in compact matrix form.

  5. Composite quadrature and endpoint-time derivatives

    Consider the Bolza objective

    J=Φ(x(t0),t0,x(tf),tf)+t0tfL(x,u,t)dt.J = \Phi \left( \boldsymbol{x}(t_0), t_0, \boldsymbol{x}(t_f), t_f \right) + \int_{t_0}^{t_f} L \left( \boldsymbol{x}, \boldsymbol{u}, t \right) \,\mathrm{d}t.

    For interval kk, let wi(k)w_i^{(k)} be the LGR quadrature weights.

    (a) Derive the composite quadrature approximation

    Jh=Φ+tft04k=1K(sksk1)i=1Nkwi(k)Li(k).J_h = \Phi + \frac{t_f-t_0}{4} \sum_{k=1}^{K} \left( s_k-s_{k-1} \right) \sum_{i=1}^{N_k} w_i^{(k)} L_i^{(k)}.

    (b) Show that each local quadrature contribution is scaled by the physical duration of its mesh interval.

    (c) Derive the nodal physical-time vector.

    (d) Derive the derivatives of every nodal time with respect to t0t_0 and tft_f.

    (e) Derive Jh/tf\partial J_h/\partial t_f when LL depends explicitly on time.

    (f) Derive Jh/t0\partial J_h/\partial t_0.

    (g) Identify the terms arising from the scale factor, the Mayer term, and the explicit time dependence of LL.

  6. Global NLP structure and Jacobian sparsity

    Consider a multiple-interval LGR transcription with NN total collocation points, nxn_x states, nun_u controls, and nbn_b endpoint equality constraints.

    (a) Define a complete global decision vector.

    (b) Write the global defect vector.

    (c) Add the endpoint constraints.

    (d) Add a path-constraint vector imposed at all collocation points.

    (e) Derive the number of scalar defect equations.

    (f) Describe which state and control blocks can appear in one local defect row.

    (g) Explain why defects from nonadjacent mesh intervals have zero direct derivatives with respect to one another’s local variables.

    (h) Sketch the block sparsity pattern of the equality-constraint Jacobian.

    (i) Explain how free t0t_0, free tft_f, and static parameters create globally coupled columns without destroying the predominantly sparse structure.

  7. Interpolation-and-integration error estimator

    On mesh interval kk, the original LGR approximation uses NkN_k collocation points. Construct an enriched LGR grid with

    Mk=Nk+1M_k=N_k+1

    collocation points.

    (a) Construct the state interpolation matrix I(k)\boldsymbol{I}^{(k)}.

    (b) Derive the interpolation-based enriched state estimate

    Y(k)=I(k)X(k).\boldsymbol{Y}^{(k)} = \boldsymbol{I}^{(k)} \boldsymbol{X}^{(k)}.

    (c) Explain why the state reconstruction is unique but the control reconstruction is not.

    (d) Define a piecewise-linear reconstruction of the control on the enriched grid.

    (e) Evaluate the dynamics on the enriched grid.

    (f) Using the enriched integration matrix B(k)\boldsymbol{B}^{(k)}, derive the dynamics-based estimate

    Z2:Mk+1(k)=1(Y1(k))T+tft04(sksk1)B(k)Fe(k).\boldsymbol{Z}^{(k)}_{2:M_k+1} = \boldsymbol{1} \left( \boldsymbol{Y}^{(k)}_1 \right)^{\mathsf T} + \frac{t_f-t_0}{4} \left( s_k-s_{k-1} \right) \boldsymbol{B}^{(k)} \boldsymbol{F}^{e(k)}.

    (g) Define a pointwise absolute error.

    (h) Define an interval-wise relative error indicator eke_k.

    (i) State the mesh-acceptance condition for a prescribed tolerance ϵ\epsilon.

  8. Choosing between hh- and pp-refinement

    Let

    δj(k)\delta_j^{(k)}

    denote the pointwise error samples on interval kk, and let eke_k be the maximum interval error.

    (a) Define a localized-error metric based on the fraction of total error concentrated near the largest-error point.

    (b) Explain why localized error suggests a switch, boundary layer, discontinuity, or sharp transition.

    (c) Explain why distributed error on a smooth interval suggests increasing polynomial degree.

    (d) Formulate a decision rule that selects hh-refinement for localized error and pp-refinement for distributed error.

    (e) Modify the rule to enforce a maximum polynomial degree NmaxN_{\max}.

    (f) State safeguards that prevent creation of excessively short mesh intervals.

    (g) Explain why pure pp-refinement may perform poorly near a bang–bang switching point.

    (h) Explain why pure hh-refinement may be unnecessarily expensive in a smooth region.

  9. Warm starting after mesh refinement

    Suppose interval kk is refined in one of the following ways:

    p-refinement:NkNk+ΔN,\text{$p$-refinement:} \qquad N_k\rightarrow N_k+\Delta N,

    or

    h-refinement:[sk1,sk][sk1,sm][sm,sk].\text{$h$-refinement:} \qquad [s_{k-1},s_k] \rightarrow [s_{k-1},s_m] \cup [s_m,s_k].

    (a) Derive how the old state polynomial is evaluated at the new state nodes for pp-refinement.

    (b) Derive how it is evaluated on both child intervals for hh-refinement.

    (c) Describe how to initialize new control values.

    (d) Show how shared interface-state values should be assigned after an interval split.

    (e) Explain how static parameters and endpoint times are transferred.

    (f) State why warm starting normally reduces the number of NLP iterations.

    (g) Identify circumstances in which interpolation of the previous solution may provide a poor warm start.

  10. Complete adaptive hphp-refinement algorithm

    Formulate a complete adaptive solution procedure for a multiple-interval LGR transcription.

    Your algorithm must include:

    (a) construction of an initial mesh and polynomial-degree vector;

    (b) solution of the NLP;

    (c) reconstruction of state and control trajectories;

    (d) construction of enriched grids;

    (e) computation of interval error indicators;

    (f) acceptance of intervals satisfying

    ekϵ;e_k\leq\epsilon;

    (g) selection of hh- or pp-refinement for rejected intervals;

    (h) enforcement of NmaxN_{\max}, minimum interval length, and maximum refinement iterations;

    (i) warm starting of the refined NLP;

    (j) stopping criteria based on error, feasibility, and stagnation;

    (k) a refinement-history table containing iteration number, number of intervals, total collocation points, maximum error, objective value, and NLP status;

    (l) verification by independent re-simulation and dense-grid checking of path constraints.

    Finally, explain why over-refinement can increase computational cost and conditioning difficulty without materially improving the engineering conclusion.