function Example1a(N)
%
% Solves the bvp y_{n+2}- (9/4)y_{n+1} + (1/2) y_{n} =0
%  y_0=4/3, y_N=0
% 
%
fprintf('\n')
disp('______________________________________________')
disp('i         yclosed         yrec            ')
disp('______________________________________________')
%
ye=zeros(1,N);
yr=zeros(1,N);
A=-(4/3)/(2^(3*N)-1);
B=(4/3)-A;
ye(1,1:N+1)=A*2.^(0:N)+B*(1/4).^(0:N);
%
yr(1,1)=4/3;yr(1,N+1)=0;
rhs=zeros(N-1,1);sol=zeros(N-1,1);
rhs(1,1)=-(1/2)*yr(1,1);
M=zeros(N-1,N-1);
M=gallery('tridiag',N-1,1/2,-9/4,1);
full(M)
sol=M\rhs;
yr(1,2:N)=sol(1:N-1,1);
%
for i=1:N+1
fprintf(' %5.0f  %15.6e %15.6e\n',i-1,ye(1,i),yr(1,i))
end
xx=zeros(1,N+1);
xx(1,1:N+1)=(0:N);
plot(xx,ye,'r*',xx,yr,'b+')
xlabel('n','Fontsize',14);ylabel('y_n','Fontsize',14);
legend('Closed form','Recurrence',1)
