I asked this question: https://stackoverflow.com/questions/48623972/heat-equation-calculation-gets-unstable-for-different-differentiation-matrices on stackoverflow concerning the calculation of a 1-dimensional heat equation: $$\partial_t u=\partial_x^2u$$ I wanted to compare the different approaches $$\partial_tu=\partial_x^2u$$ and $$\partial_tu=\partial_x\left(\partial_xu\right)$$ Both approaches should be solved using the RK4-method. Now I noticed that, while the first approach gives me the correct solution, the second one does not, it rather fluctuates strongly at the borders (for images refer to the question above). Thus I was wondering if both approaches are mathematically equal (they should, according to my understanding), or if there is a difference?
The used stencils (from the cited question):
For the second-order derivation operator I am using the central difference method from $x_{-2}$ to $x_{2}$, resulting in the equation
$$\partial_x^2f(x)=\frac{-f_{-2}+16f_{-1}-30f_0+16f_1-f_2}{12h^2}$$
and forward- respective backwards differentiation at the boundaries.
For the first-order derivation operator I used the same range, resulting in $$\partial_xf(x)=\frac{f_{-2}-8f_{-1}+8f_1-f_2}{12h}$$ and also forward- respective backwards differentiation at the boundaries.