# Which finite difference better approximates $uu'$?

I want to approximate $$uu'$$ with a finite difference. On the one hand, it seems to be $$(uu')_i=u_i\frac{u_{i+1}-u_{i-1}}{2\Delta t}=\frac{u_iu_{i+1}-u_iu_{i-1}}{2\Delta t}$$ On the other hand, $$(uu')_i=\left(\frac{d}{dx}\frac{u^2}{2}\right)_i=\frac{u^2_{i+1}-u^2_{i-1}}{4\Delta x}$$ I might be wrong but I think that they both have truncation error $$\mathcal{O}(\Delta x)^2$$. Which of these finite differences should I use?

• Unfortunately this is going to be somewhat dependent on the context. Do you have a particular problem in mind? Jan 10 at 14:26
• @KyleMandli E.g. Kuramoto-Sivashinsky $u_t=-uu_x-u_{xx}-u_{xxxx}$, $x\in[0,L_x]$, periodic bc but I would like to know how to approach this in general to be able to deal with other non-linear pde Jan 11 at 1:28
• I don’t think both formulas have the same truncation error. In fact, in your first formula you assume that $u$ is constant in the range $[x-\Delta x,x+\Delta x]$ which is not necessarily a good approximation. In fact, this approximation is just a zeroth order approximation. I think better approximation is using trapezoidal rule to take $u$ equal to $\frac{u_{i-1}+u_{i+1}}{2}$ in that range which brings you to your second formula. My final conclusion is that your second formula is more accurate than the first formula and has lower truncation error or its order of accuracy is higher. Jan 11 at 3:23
• Both are second order, but truncation errors will be different. Second one is conservative, use that if you think conservation is important for your problem. Jan 11 at 3:44
• @cfdlab has this right: You have to think about what the term means and then discretize accordingly. Here, you are probably thinking of it as a flux, so you will want to choose a conservative way to discretize. Jan 11 at 16:29