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.
y(t) = dy0/k * sin(k*t)You should check both the equation and the initial conditions. (Nothing to hand in.)
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.
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?