function pval = paraval ( xdata, ydata, xval )

%*****************************************************************************80
%
%% PARAVAL evaluates the piecewise parabolic interpolant to data at a point.
%
%  Licensing:
%
%    This code is distributed under the GNU LGPL license.
%
%  Modified:
%
%    16 July 2011
%
%  Author:
%
%    John Burkardt
%
%  Parameters:
%
%    Input, real XDATA(3), three X values.
%
%    Input, real YDATA(3), the value of F(X) at the X values.
%
%    Input, real XVAL(), points at which the parabolic interpolant
%    to the data is desired.
%
%    Output, real PVAL(), the value of the parabolic interpolant at XVAL.
%

%
%  Determine the coefficients of the parabolic approximation.
%
  c = ydata(1);

  b = ( ydata(2) - ydata(1) ) ./ ( xdata(2) - xdata(1) );

  a = ( ( ydata(3) - ydata(2) ) ./ ( xdata(3) - xdata(2) )...
      - ( ydata(2) - ydata(1) ) ./ ( xdata(2) - xdata(1) ) ) ...
     ./ ( xdata(3) - xdata(1) );
%
%  Evaluate the parabola at XVAL.
%
  pval = ( a   .* ( xval - xdata(2) ) ...
         + b ) .* ( xval - xdata(1) ) ...
         + c ;

  return
end

