Truncation Error For Explicit Scheme

The book defines the truncation error as simply the taylor series of what you get when you substitute the solution u[x,t] into the numerical scheme. Here is the result for the explicit scheme.

Series[
((u[x, t + Δt] - u[x, t])/Δ)t - α ((u[x - Δx, t] - 2  u[x, t] + u[x + Δx, t])/Δ)(x^2), 
{Δt, 0,  3}, 
{Δx, 0, 
        3}
]

Note that at least one of these terms simplifies because of the heat equation.

Series[
((u[x, t + Δt] - u[x, t])/Δ)t - α ((u[x - Δx, t] - 2  u[x, t] + u[x + Δx, t])/Δ)(x^2), 
{Δt, 0,  3}, 
{Δx, 0, 
          3}
]/.{
D[u[x, t], 
            t] ->  α D[u[x, t], x, 
              x]
}

Truncation Error For Implicit Scheme

The computation is pretty similar for the implicit scheme.

Series[
((u[x, t + Δt] - u[x, t])/Δ)t - α ((u[x - Δx, t + Δt] - 2  u[x, t + Δt] + u[x + Δx, t + Δt])/Δ)(x^2), 
{Δt, 0,  
          3}, 
{Δx, 0, 
          3}
] /. {
D[u[x, t], 
            t] ->  α D[u[x, t], x, 
              x]
}

Truncation Error For the θ Scheme

The computation is pretty similar for the implicit scheme.

Simplify[
Series[
((u[x, t + Δt] - u[x, t])/Δ)t - α (θ ((u[x - Δx, t + Δt] - 2  u[x, t + Δt] + u[x + Δx, t + Δt])/Δ)(x^2) + 
(1 - θ) ((u[x - Δx, t] - 2  u[x, t] + u[x + Δx, t])/Δ)(x^2)), 
{Δt, 0,  
            3}, 
{Δx, 0, 
            3}
] /. {
D[u[x, t], 
              t] ->  α D[u[x, t], x, 
                x]
}
]