A boundary value problem is linear iff
for continuous functions p, q, and r.
Linear Shooting Method
Solves a linear BVP by combining solutions to 2 initial value problems.
A unique solution exists if
- p, q, and r are continuous on [a,b]
- q(x)>0 for x∈[a,b]
Superposition Idea
If y1 solves
and y2 solves the homogeneous equation
then y=y1+cy2 solves the ODE for any constant c.
Auxiliary IVPs
Fix
Solve
with order 4 Runge-Kutta.
Combining Solutions
Choose c so that y(b)=β.
Linear Finite-Difference Method
Replace derivatives with centered differences at mesh points and solve the resulting linear system.
Mesh Points
Partition [a,b] into N+1 subintervals of length h=N+1b−a.
Linear Difference Equation
With y(xi)≈wi, w0=α, and wN+1=β,
for i=1,…,N, with truncation error O(h2).
where A is tridiagonal, with
Solve for w with LU decomposition or another linear solver.
If p, q, and r are continuous on [a,b] and q(x)≥0, the linear system has a unique solution whenever h<L2, where L=maxa≤x≤b∣p(x)∣.
Worked Examples
Example 1
Solve y′′=y, 0≤x≤1, y(0)=0, and y(1)=1 with the linear shooting method.
Solution Reveal Hide
p=0, q=1, and r=0.
For the shooting method, solve the auxiliary IVPs
y1′′=y1,y1(0)=0, y1′(0)=0and
y2′′=y2,y2(0)=0, y2′(0)=1The first IVP has the zero solution, so y1(x)=0. The second IVP has the solution y2(x)=sinhx. Therefore,
c=y2(1)1−y1(1)=sinh11−0=0.8509Combining the auxiliary solutions gives
y(x)=y1(x)+cy2(x)=0+sinh1sinhx
Example 2
Solve y′′=y, 0≤x≤1, y(0)=0, and y(1)=1 with the linear finite-difference method for N=3.
Solution Reveal Hide
For the finite-difference method,
h=N+1b−a=3+11−0=0.25,x1=0.25, x2=0.50, x3=0.75Since p=r=0 and q=1,
−wi−1+(2+h2)wi−wi+1=0,2+h2=2+0.252=2.0625Using w0=0 and w4=1 gives
2.0625−10−12.0625−10−12.0625w1w2w3=001The 1st and 3rd equations give
w1=2.0625w2,w3=2.06251+w2Substitute these into the 2nd equation:
−2.0625w2+2.0625w2−2.06251+w2=0(2.0625−2.06252)w2=2.06251⟹w2=0.4437Back-substitution gives
w1=2.06250.4437=0.2151,w3=2.06251+0.4437=0.6999
Example 3
Solve y′′=6x, 0≤x≤1, y(0)=0, y(1)=1 with the linear finite-difference method for N=1.
Solution Reveal Hide
Here p=q=0 and r(x)=6x. Calculate the mesh size and interior point:
h=N+1b−a=1+11−0=0.5,x1=a+h=0.5Evaluate the forcing term at the interior point:
r(x1)=r(0.5)=6(0.5)=3Since p=q=0, the difference equation is
−w0+2w1−w2=−h2r(x1)=−(0.5)2(3)=−0.75Apply the boundary values w0=y(0)=0 and w2=y(1)=1:
−0+2w1−1=−0.752w1=0.25⟹w1=0.125The exact solution is y=x3, so
y(0.5)=(0.5)3=0.125The finite-difference method gives the exact value at the interior point.