function v = p01_polynomial_value ( m, n, x )

%*****************************************************************************80
%
%% p01_polynomial_value() evaluates the shifted Legendre polynomials P01(n,x).
%
%  Licensing:
%
%    This code is distributed under the MIT license. 
%
%  Modified:
%
%    15 March 2016
%
%  Author:
%
%    John Burkardt
%
%  Reference:
%
%    Milton Abramowitz, Irene Stegun,
%    Handbook of Mathematical Functions,
%    National Bureau of Standards, 1964,
%    ISBN: 0-486-61272-4,
%    LC: QA47.A34.
%
%    Daniel Zwillinger, editor,
%    CRC Standard Mathematical Tables and Formulae,
%    30th Edition,
%    CRC Press, 1996.
%
%  Input:
%
%    integer M, the number of evaluation points.
%
%    integer N, the highest order polynomial to evaluate.
%    Note that polynomials 0 through N will be evaluated.
%
%    real X(M,1), the evaluation points.
%
%  Output:
%
%    real V(M,1:N+1), the values of the shifted Legendre polynomials 
%    of order 0 through N at the points X.
%
  if ( n < 0 )
    v = [];
    return
  end

  v = zeros ( m, n + 1 );

  v(1:m,1) = 1.0;

  if ( n < 1 )
    return
  end

  v(1:m,2) = 2.0 * x(1:m,1) - 1.0;

  for i = 2 : n
 
    v(1:m,i+1) = ( ( 2 * i - 1 ) * ( 2.0 * x(1:m,1) - 1.0 ) .* v(1:m,i)   ...
                -  (     i - 1 ) *                             v(1:m,i-1) ) ...
                /  (     i     );
 
  end
 
  return
end
