PHYCS 6730 Lab Exercise: Boundary Value Problems

In this exercise we will be playing with the shooting method for solving boundary value problems.

The executable code you need is in ~p6730/exercises/ode_eigen.

Copy the files and make the code intrk4. It solves the differential equation

     d2y/dt2 = -k2y.
on the interval [0, 1] for y(0) = 0 and a user-specified value of dy(0)/dt = y'(0) = dy0. Formulated this way, the code is actually solving an initial value problem. But we will use it to solve boundary value problems.

Exercise 1 Exact Solution

Show (pencil and paper) that the exact solution is
  y(t) = dy0/k * sin(k*t)
You should check both the equation and the initial conditions. (Nothing to hand in.)

Exercise 2. Inhomogeneous boundary condition

Suppose instead of the initial conditions specified above, we wanted to find the solution to the equation with y(0) = 0 and y(1) = 2 with a particular fixed value of k. Now we have a boundary value problem, because we are placing conditions on the solution at both endpoints. The boundary conditions are called "inhomogenous", if any of the specified values are not zero. Since we said y(1) = 2, this is an inhomogenous boundary value problem.

By hand find the exact solution to this problem for the case k = 3.

Then use the program to find the solution. To do this, you will have to vary the value of y'(0) until you get the correct boundary value at y(1). Since this process is like aiming a cannon until we hit the target, this is called a "shooting" method.

Notice that the ODE itself is linear and homogeneous, so it is really trivial to solve this boundary value problem, once we have any solution. For example, solve it for y'(0) = 1. Then multiply the resulting solution by dy0/k. So shooting is a waste of time in this case.


Exercise 3. Homogeneous boundary condition

Suppose, instead we wanted y(0) = 0 and y(1) = 0. Now the boundary values are all zero, so we have a homogeneous boundary value problem -- in fact, an eigenvalue problem. To get a nontrivial solution, we have to adjust the eigenvalue k.

By hand find the exact solution(s) to this problem. That is, find the values of k that admit nontrivial solutions.

Then use the program to find the solution. In this case you may choose any nonzero value of y'(0) and then fiddle with k until you get y(1) = 0.

It is futile to vary the derivative in this case. Why doesn't the choice of y'(0) affect the eigenvalues?

What is changed if we double the value of y'(0)?

Reformulate this problem so you are solving for the zero of a function of k. What is the function, and how is it evaluated for a given k?