Originally Posted by

**bambamm** for a tridiagonal matrix, where the matrix is nxn, the right hand side is: b_i = 6/h^2*(y_i+1-2*y_i+y_i-1), i = 1...n where y_i = cos(i*h), i = 0...n+1 and h = pi/(n+1).

Instead I just wrote the equation as b_i+1 = 6/h^2*(cos((i+2)*h) - 2*cos((i+1)*h) + cos(i*h), where h = pi/(n+1) since it seemed easier to organize.

I want to solve the tridiagonal system and analyze what happens when n increases. But I'm not sure how to do this.

Here's what I have so far:

array=zeros(1,4)

for i=1:4

h=pi/(i+1)

array(i)=h

end

array2=zeros(1,4)

for ii=1:4

d=6./array.^2.*(cos((i+2).*array)-2.*cos((i+1).*array)+cos(i.*array))

array2(ii)=d

end

Please help. Thanks so much!