Consider a heat conduction problem for a homogeneous rod of unit length.
Assume the rod is sufficiently thin and its surface is thermally insulated.
Then the temperature of the rod, \(u=u(x, t)\), satisfies the equation
$$
u_{t}=a u_{x x}+f(x, t)
$$
where \(a=k /(c \rho)\) with \(c\) the specific heat, \(\rho\) the density, \(k\) a
thermal conductivity coefficient, and \(f(x, t)\) a scaled heat source function.
Suppose the temperatures at the two ends of the rod are fixed at 0 , the
initial rod temperature is \(0, a=1\), and \(f(x, t)=x(1-x) \sin \pi t .\) Compute
and plot the temperature at \(t=1\) for several values of \(n_{t}\) and \(n_{x}\)
until the numerical solution at \(x=1 / 2, t=1\) has three ahilized dioits