function [x,y] = discrete_linear ( n )
%
d1 = ones ( n, 1 );
d2 = ones ( n+1, 1 );
A = diag ( d1, -1 ) - 2 * diag ( d2 ) + diag ( d1, +1 );
%
%  Correct the first and last rows.
%
A(1,1) = 1.0;
A(1,2) = 0.0;
A(n+1,n) = 0.0;
A(n+1,n+1) = 1.0;
%
%  Set up the right hand side vector, correcting the first and last.
%
dx = 1.0 / ( n - 1 );

b = 0.1 * dx^2 * ones ( n+1, 1 );
b(1) = 0.0;
b(n+1) = 1.0;
%
%  Solve.
%
x = dx * [ 0 : n ];
y = A \ b;

