  function ShowHeat()
% Checks out CrankN on the heat equation with source term
%
%    u_t = u_xx + s(x,t)      u(0) = u(1) = 2, u(x,0) = 2+sin(2*pi*x)

n = 101;
deltaT = .0001;
tSteps = 200;
a = 0; b = 1; xVals = linspace(a,b,n)';
tc = 0;
uVals = 2 + sin(2*pi*xVals);
plot(xVals,uVals)
shg
pause(.1)
% In the following, uVals(k) is an approximation of u(xVals(k),tc), k=1:n
for j=1:tSteps
    uVals = CrankN(uVals,a,b,n,tc,deltaT,@s);
    tc = tc + deltaT;
    plot(xVals,uVals)
    axis([0 1 0 4])
    title(sprintf('t = %6.4f',tc),'fontsize',14)
    shg
    pause(.05)
end

function y = s(x,t)
y = 10000*cos(1000*t)^2 * (1+sin(100*pi*(x-.1)^2));
