function a = wrmc(xmax,N);
%WRMC    This program computes the Collocation approximation for f(x), where
%
%             f'(x) - f(x) = 0,   f(0) = 1
%
%        on the interval [0,xmax]. The approximate solution is 
%             
%             g(x) = 1 + a(1) x + a(2) x^2 + ... a(N) x^N.
%
%        a = wrmc(xmax,N) returns the vector a with xmax and N as inputs.
%

%        Ellen McGrattan, 1-12-95

b    = ones(N,1);
E    = zeros(N);
E(:,1) = b;
C    = eye(N) + diag(2:N,-1);
z    = [0:xmax/(N-1):xmax]';
X    = (z*b').^(b*[1:N]);
A    = X*C'+E;
a    = -A\b;
A,b
