2025 Week 9 - Boundary value problems
Overview
The lecture compares three approaches to boundary value problems: shooting with an IVP solver and root finder, collocation using interpolation functions such as cubic splines or radial basis functions, and finite differences on a discretized grid. A rocket must reach 50 m after 5 seconds, illustrating that shooting with RK45 finds an initial velocity of about 34.5 m/s; later examples show how finite-difference equations become sparse linear systems or nonlinear residuals, including a two-dimensional Laplace problem.
Key takeaways
- Shooting turns a boundary value problem into repeated IVP solves plus scalar root finding; for the rocket target of 50 m at 5 seconds, RK45 and a SciPy root finder give an initial velocity of about 34.5 m/s.
- Collocation substitutes an interpolated solution into the differential equation at selected points; cubic splines offer a convenient one-dimensional implementation, while RBFs support irregular multidimensional point layouts.
- Uniform spacing is central to the standard second-order central-difference formulas because it enables Taylor-series error cancellation; irregular grids often make collocation or finite elements more suitable.
- Local finite-difference stencils create sparse systems: a one-dimensional second-derivative operator is tridiagonal, while the two-dimensional five-point Laplacian produces a banded pentadiagonal matrix after flattening the grid.
- Boundary approximations can control the accuracy of the whole scheme: a first-order one-sided Neumann condition can reduce an otherwise second-order discretization, while a ghost-point relation can restore second-order accuracy without losing the tridiagonal structure.
- Finite-difference residuals provide one framework for both linear and nonlinear equations: Newton-Raphson can solve the nonlinear system and reduces to a single step for a linear residual with a constant Jacobian.
Chapters
- An initial value problem starts from known data at one end and advances, often through time; a boundary value problem specifies information at both ends of a domain.
- Boundary conditions may prescribe function values, slopes, or combinations of the two, known as Dirichlet, Neumann, and Robin conditions.
- The lecture introduces shooting, collocation, and finite differences as approaches for satisfying both boundaries.
- Shooting guesses an unknown starting value, solves the resulting IVP to the far boundary, and measures the mismatch there.
- A root finder updates the initial guess until the endpoint condition is satisfied.
- The method reuses existing IVP tools, including adaptive time stepping, RK45, and implicit solvers for stiff problems.
- Shooting is effective for low-dimensional, relatively linear or mildly nonlinear problems, but sensitive endpoint changes can make root finding difficult.
- Oscillatory solutions and multiple roots can cause convergence problems, while higher-dimensional domains make the shooting setup less practical.
- For stiff equations, explicit solvers may need extremely small steps; implicit methods can improve stability at the cost of more computation.
- Ballistics illustrates a low-dimensional problem where shooting can adjust a launch condition to hit a target.
- Real trajectories can include quadratic air drag, wind, waves, and moving ships, making simple closed-form estimates inadequate.
- The lecture describes the method's mathematical formalization after World War II and connects it to growing computer use.
- The example uses altitude y(t), constant gravitational acceleration, initial height y(0) = 0, and target height y(5) = 50 m.
- Because the equation is second order, it is rewritten as a first-order system using vertical velocity v, with y' = v and v' = -g.
- The unknown initial velocity is the shooting parameter.
- The Python implementation solves the IVP from 0 to 5 seconds with RK45 for each candidate initial velocity.
- A SciPy root finder compares the computed endpoint height with the 50 m target.
- Starting from a guess of 1 m/s, the solver finds an initial velocity of about 34.5 m/s in four function evaluations, then verifies the endpoint.
- An IVP solver produces points along a curve, while interpolation constructs a continuous function through selected points.
- Interpolation differs from curve fitting: it passes through the given data, whereas curve fitting can accommodate noisy measurements.
- Collocation uses an interpolated function as the representation of the unknown solution.
- Collocation selects points across the domain, defines an interpolator, and substitutes that function into the differential equation.
- The unknowns may be function values, slopes, or other degrees of freedom determined by the interpolation basis.
- Cubic splines, radial basis functions, and spectral methods are examples; spectral bases can be chosen to suit the physics.
- Collocation can deliver high accuracy with relatively few points and can extend from ODEs to PDEs by differentiating the chosen interpolant.
- Enforcing the equation at all selected points simultaneously produces a system of equations, often a matrix problem.
- Point placement matters: a grid that misses a sharp transient cannot represent it, even if the interpolator is otherwise accurate.
- A cubic-spline BVP solver accepts the differential equation and boundary conditions, then iteratively improves an initial solution guess.
- In the rocket example, successive spline iterations move from a poor initial curve toward the boundary-matching solution.
- The built-in spline solver automates this process, while other collocation bases may require a custom implementation.
- An RBF approximates a function as a weighted sum of kernels centered at data points; Gaussian kernels are one example.
- Differentiating the kernel gives the derivatives needed for a differential equation, and Gaussian kernels remain differentiable at high orders.
- RBFs can handle irregular point locations and extend naturally to multidimensional domains.
- For a two-dimensional Laplace example on a unit square, meshgrid creates coordinates and ravel converts them into a vector of points.
- The method builds a kernel matrix and a matrix for the Laplacian of the kernel, then separates boundary indices from interior indices.
- Boundary values are imposed directly in the system before solving for the RBF weights.
- RBF collocation points need not be regularly spaced, so extra points can be added near a sharp transition without refining the whole domain.
- Points placed too close together can make the matrix ill-conditioned or singular because their rows become nearly dependent.
- RBFs are flexible, but the lecture notes that finite element methods are often preferable for complex adaptive meshes.
- Forward and backward first differences use adjacent values and have first-order accuracy; central difference uses values on both sides and has second-order accuracy on a uniform grid.
- Second-derivative formulas require at least three points, with the central formula using the point itself and its two neighbors.
- Central-difference error cancellation depends on equal spacing, which is why finite-difference schemes typically use uniform grids.
- The rocket's second derivative is replaced at interior nodes by the central formula, producing equations involving neighboring height values.
- With Dirichlet conditions y0 = 0 and yN = 50, the boundary values are imposed directly.
- The resulting one-dimensional system has a tridiagonal coefficient matrix.
- For each interior node, the second derivative contributes the pattern 1, -2, 1 across neighboring heights, scaled by the grid spacing squared.
- The prescribed endpoint heights become the first and last equations, while the interior equations encode acceleration due to gravity.
- Solving the system gives a discretized trajectory from 0 m to 50 m over five seconds.
- Forward and backward differences can use unequal adjacent spacings, but central-difference cancellation and its usual accuracy benefit rely on uniform spacing.
- Adding more points to a derivative stencil can increase matrix bandwidth and computational cost.
- For the examples discussed, reducing a uniform step size is generally a more useful way to improve accuracy than using a wider stencil.
- Moving factors such as 1/h² to the right-hand side keeps the matrix coefficients at a more uniform scale.
- Large differences in matrix-entry magnitudes can worsen roundoff and conditioning; scaling or preconditioning may help when necessary.
- The lecture recommends solving with LU factorization and substitution rather than explicitly forming a matrix inverse.
- A one-dimensional second-derivative stencil creates a tridiagonal, sparse matrix rather than a dense system.
- LU factorization generally preserves much of this sparsity, making it more practical than dense inversion for large systems.
- In multidimensional problems, the same local stencil structure produces a banded sparse matrix.
- A mixed-boundary example applies a Dirichlet condition at one end and a Neumann slope condition at the other.
- A backward first difference can impose the right-end slope, but it is only first-order accurate.
- Combining that boundary approximation with second-order interior central differences limits the overall scheme's accuracy.
- A higher-order one-sided derivative formula can improve the boundary approximation but adds another off-diagonal coefficient and changes the matrix sparsity pattern.
- Alternatively, a central derivative at the boundary can use a fictitious ghost point; a zero-slope condition makes the ghost value equal to its interior counterpart.
- Substituting the ghost-point relation into the interior stencil retains a tridiagonal structure and gives a second-order boundary treatment.
- The lecture compares endpoint results from the first-order backward condition and the second-order ghost-point treatment against the analytic value.
- Refining the step size has a larger effect on the plotted error than changing between the two boundary formulas in the shown example.
- A higher-order formula is not guaranteed to be closer for every finite grid, so accuracy should be checked rather than assumed.
- After replacing derivatives term by term with finite-difference formulas, nonlinear products of neighboring unknowns create a coupled nonlinear system.
- The system is written as a residual vector, with boundary equations at the endpoints and finite-difference equations at interior nodes.
- A Newton-Raphson root finder uses the Jacobian to produce successive linear systems, which can be solved with LU factorization.
- For a linear residual, the Jacobian is constant, so Newton's method can reach the solution in one step from an appropriate formulation.
- The same residual-based code can therefore handle linear and nonlinear finite-difference problems without separate algorithm structures.
- For heat transport, constant conductivity K and source Q give a linear equation, while conductivity that depends on temperature T makes the equation nonlinear.
- On a uniformly spaced two-dimensional grid, the discrete Laplacian combines the four neighboring values with a negative four-times center coefficient.
- Flattening the two-dimensional unknown array produces a sparse pentadiagonal, banded matrix for the interior grid points.
- Finite differences are easiest on structured rectangular grids with equal spacing; irregular geometries, convection-driven stability issues, and difficult boundary conditions can favor finite element or finite volume methods.
Transcript excerpt
0:00 Today we're going to get into boundary value problems. Um, has anybody done question number one from the assignment all the way through to completion including part C? Yeah, I see some people yes, some people are right. Um, I actually cheated you guys a little bit because that question is actually the first method that we're going to talk about with a boundary value problem. Okay, so boundary value problems are a little bit different. Well, if you already did it, then guess what? Now you know the material better. That's it, right? Um, boundary values are a little problem or boundary value problems are a little bit different from the initial value problems because initial versus the boundaries. Boundaries implies you know information on both sides of it. Right? So the
0:47 initial one is typically for time stepping when you would have like your your initial condition and you're stepping forward in time. It doesn't have to be. It could just as easily be something like space for example if we're doing something like oh I don't know shooting ballistics right um typically we have information okay so on both sides of the domain either we would have something like a dishlay condition we would have the function value at one side or the other or we would have some kind of slope information which is noman condition combination of the two which are robin conditions um the easiest way to approach this and extend from the initial value is literally to shoot a solution from one side and try and hit the target on the other side. Um, alternately, and I'm not sure we'll be able to get to this today, uh, what you
1:35 can actually do is dig out your old interpolation methods, right? Because we
This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.
In this course
Related notes
Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Numerical Methods for Engineering.