Given:
h_i=t_(i+1)-t_i for i=1,...,n-1 where n is a positive integer.
The matrix Q is an n by (n-2) matrix with entries q_(i,j) with i=1,...,n and j=2,...n-1 given by:
q_(j-1,j)=1/h_(j-1)
q_(j,j)=-(1/h_(j-1)+1/h_j)
q_(j+1,j)=1/h_j
q_(i,j)=0 for |i-j|>=2
I want to get a matrix Q. How do i write a program for this matrix in R? Many thanx in advance.