function [t, y] = w(x, I)
% w -- Compute the function w_n(t) = (t - x_0)* ... *w(t - x_n)
%
% SYNOPSIS:
%   [t, y] = w(x, I);
%
% PARAMETERS:
%   x - Prescribed nodes x_i
%       (stored as x(1) through x(n+1) for some `n').
%   I - Interval in which the nodes are defined.  Assumed to be a
%       two-element vector, e.g. I = [-1, 1].
%
%       We also assume
%
%               I(1) <= min(x) < max(x) <= I(2).
% RETURNS:
%   t - Vector of sampling points.  Equally spaced on N=100 subintervals.
%       Thus, NUMEL(t) == N + 1.
%   y - Vector of function values for w_n.
%       y(j) = w_n(t(j))  for  j = 1:numel(t)
%


N = 100;

t = linspace(I(1), I(2), N + 1)';
m = numel(x);

y = t - x(1);
for i = 2:m,
   y = y .* (t - x(i));
end

