Consider the problem of solving
dt2d2y=t
subject to the initial conditions y(0)=dtdy(0)=0 using a discrete approach where y is computed at discrete times, yn=y(tn) where tn=nh(n=−1,0,1,…,N) and 0<h=1/N≪1.
(a) By using Taylor expansions around tn, derive the centred-difference formula
h2yn+1−2yn+yn−1=dt2d2y∣∣∣∣∣t=tn+O(hα)
where the value of α should be found.
(b) Find the general solution of yn+1−2yn+yn−1=0 and show that this is the discrete version of the corresponding general solution to dt2d2y=0.
(c) The fully discretized version of the differential equation (1) is
h2yn+1−2yn+yn−1=nh for n=0,…,N−1
By finding a particular solution first, write down the general solution to the difference equation (2). For the solution which satisfies the discretized initial conditions y0=0 and y−1=y1, find the error in yN in terms of h only.