% Program 0.1 Nested multiplication
% (Modified from textbook version)
%
% Evaluates a polynomial from nested form using Horner's method
%
% Input: degree d of polynomial,
%        array of d + 1 coefficients (constant term first),
%        x-coordinate x at which to evaluate
% 
% Output: value y of polynomial at x
% 
% Note: This is a simplified version of the nest function.  In
%       this version, no accommodation for "base points" is made.
%
function y = simpleNest(d, c, x)
  y = c(d + 1);
  for i = d : -1 : 1
    % process each of the coefficients: c(d), c(d - 1), ..., c(1)
    y = y .* x + c(i);
  end
end