Well this is the equation:
$$-ru_{i+1}^{n+1} + (1+2r)u_i^{n+1} - ru^{n+1}_{i-1} = ru^n_{i+1} + (1-2r)u_i^n + ru^n_{i-1}.$$
Where
$$r=\frac{\sqrt{2} \Delta t}{2(\Delta x)^2}$$
And that equation can be seen as a matrix problem ##Au=b##. But I don't know how to convert the equation to a matrix...
Homework Statement
Solve the time dependent 1D heat equation using the Crank-Nicolson method.
The conditions are a interval of length L=1, initial distribution of temperature is u(x,0) = 2-1.5x+sin(pi*x) and the temperature in the ends of the interval are u(0,t) = 2; u(1,t) = 0.5.
Homework...