function Ch2Example4(N,b)
%
% Solves the ivp y_{n+1}- 10 y_{n} = -(2/3) n - (4/3)
%  y_N=b
% 
%
fprintf('\n')
disp('______________________________________________________________________________________________')
disp('     i        y_n            yclosed         abs error1        abs error2       rel error             ')
disp('______________________________________________________________________________________________')
ye=zeros(1,N+1);
yr=zeros(1,N+1);
yz=zeros(1,N+1);
%ye=(i+1)/6.0 + (b-((n+1.)/6.))*10.0^(i-n);
ye(1,1:N+1)=(1/6)*(1:N+1)+(b-(1/6)*(N+1))*10.^((0:N)-N);
yz=(1/6)*(1:N+1);
%
yr(1,N+1)=b;
for i=N:-1:1
    yN=yr(1,i+1);
    yr(1,i)=(1/10)*(yN+(3/2)*(i-1)+(4/3));
end
%
for i=1:N+1
fprintf(' %5.0f  %15.6e  %15.6e  %15.6e  %15.6e %15.6e\n',i-1,yr(1,i),ye(1,i),yz(1,i),abs(yr(1,i)-yz(1,i)),abs(yr(1,i)-yz(1,i))/abs(yz(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('Recurrence','Closed form',1)
