function [out]=fprint(int,n,t,u)
%
% Function fprint displays the numerical and exact 
% solutions to the linear PDE problem
%
% Declare global variables
  global ndss;
%
% Return current value of independent variable
% (Matlab requires at least one return argument)
  out=t;
%
% Problem parameters
  xl=0.0;
  xu=1.0;
%
% Print a heading for the solution at t = 0 
  if(t<=0.0)
%
%   Label for ODE integrator
%
%   Fixed step modified Euler 
    if(int==1)
      fprintf('\n\n euler2a integrator\n\n');
% 
%   Variable step modified Euler
    elseif(int==2)
      fprintf('\n\n euler2b integrator\n\n');
%
%   Fixed step classical fourth order RK
    elseif(int==3)
      fprintf('\n\n rkc4a integrator\n\n');
%
%   Variable step classical fourth order RK 
    elseif(int==4)
      fprintf('\n\n rkc4b integrator\n\n');
%
%   Fixed step RK Fehlberg 45 
    elseif(int==5)     
      fprintf('\n\n rkf45a integrator\n\n');
%		
%   Variable step RK Fehlberg 45 
    elseif(int==6)
      fprintf('\n\n rkf45b integrator\n\n');
%
%   Fixed step RK (2,3) embedded pair
    elseif(int==7)     
      fprintf('\n\n ode23a integrator\n\n');
%		
%   Variable step RK (2,3) embedded pair
    elseif(int==8)
      fprintf('\n\n ode23b integrator\n\n');
%
%   Fixed step RK (4,5) embedded pair
    elseif(int==9)     
      fprintf('\n\n ode45a integrator\n\n');
%		
%   Variable step RK (4,5) embedded pair
    elseif(int==10)
      fprintf('\n\n ode45b integrator\n\n');
    end
%
% Heading 
  fprintf(' int = %2d   n = %2d   ndss = %3d\n\n',...
            int,n,ndss);
  fprintf('    t      u(num)    u(exact)          diff\n');
%
% End of t = 0 heading
  end
%
% Numerical and analytical solution output 
%
%   Midpoint value of x 
    x=(xu-xl)/2.0;  
%
%   Analytical solution at midpoint 	
    ue=exp(-pi*pi*t)*sin(pi*x); 
%  	
%   Grid index of midpoint 
    im=round((n+1)/2);
%	
%   Display the numerical and exact solutions, and their difference 
    fprintf('%5.2f %11.6f %11.6f %13.4e\n',t,u(im),ue,u(im)-ue);

