MTH 538 S25 Homework 4¶

1. Dependence of the solution of an ODE IVP on a parameter¶

A couple of weeks ago, we computed in class the sensitivity of a solution of an ODE IVP to the initial condition by co-solving another (coupled) IVP (the "variational equations"). Now consider the initial value $y_0$ to be fixed, but the differential equation depends on a parameter, $p$: $$ \frac{\partial y(t,p)}{\partial t} = f(y,p), \qquad y(0,p) = y_0 \qquad (1) $$ For simplicity we will consider an autonomous scalar equation depending on a scalar parameter. We want to know the derivative of the solution at time $t$ with respect to the parameter $p$.

(a) Call the derivative we are interested in knowing $v(t,p)$: $$v(t,p) = \frac{\partial y(t,p)}{\partial p}.$$

Determine a differential equation and initial condition for $v(t,p)$ that could be solved along with (1) to obtain $v(t,p)$. Assume as much smoothness as you like.

To avoid confusion or ambiguity, use the notation $ {\partial_i} f( y(t,p), p ) $ to denote the derivative of $f$ with respect to its $i^{th}$ argument ($i\in\{1,2\}$), evaluated at $( y(t,p), p )$; and the notation $$ \frac{\partial}{\partial p} f( y(t,p), p ) $$ for the derivative of the expression $ f( y(t,p), p )$ with respect to $p$.

(b) Specialize your answer for part (a) to the case $f(y,p) = py^3$, and write it the way we would if we were about to code it up for numerical solution.

2. BVP by finite differences¶

Solve the following BVP by the method of finite differences: $$y^{\prime\prime}+20\sin(20x)y^\prime -\frac{6}{x^2}y = 1$$ for $x\in(2,4)$, and $y(2)=1$, $y(4)=8$.

Print your (best) estimate for y(3), and provide some empirical evidence that the maximum error is $O(h^2)$.

3. Off-center finite-difference approximation to y''¶

(a) Is it possible to obtain an approximation to 𝑦′′(0) with error = $𝑂(ℎ^2)$ using 𝑦(0), 𝑦(ℎ), 𝑦(2ℎ)? Either way, support your result with a calculation.

(b) How about with the 4 values 𝑦(0), 𝑦(ℎ), 𝑦(2ℎ), y(3h)?

(c) If yes in (b), how much worse (or better) is the approximation than the 3-point centered one with the same grid spacing?

4. Galerkin method with a 2D basis¶

Ackleh et al. Exercise 10.3.6 (Galerkin approximation)

Extra credit: Extend the basis to $\{ \sin(\pi x),\ \sin(2\pi x), ... , \sin(N\pi x) \}$ and explore how the error depends on $N$. Hint: a useful way to see what's going on as $N$ increases is to plot $N$ times the error, and/or $N^2$ times the error vs. $x$, for various $N$.

5. Galerkin by hand¶

(a) For the BVP from Ackleh at the top of p547, perform a hand-calculation to find the Galerkin approximation to the solution using a single hat function as the basis for the approximation. TYPO WARNING: they mean $r(x)=1+x$, $s(x)=0$, $f(x)=0$.

(b) What is the derivative of the exact solution of this BVP?

(c) Validate the proposition that the Galerkin approximation minimizes the error in the norm $||e||=\int r {e^\prime}^2 + s e^2$, by explicitly minimizing this (using Calc I method) in this case.

(d) Is the norm defined in (c) really a norm for arbitrary integrable functions $r$ and $s$? If so, prove it. If not, elaborate.

In [ ]: