I am working to reproduce results from a paper [links directly to page 17, equations 3.4 on some browsers] on a finite-volume method reconstruction method called WENO which I'm using in one dimension. Part of the method involves calculating a so-called smoothness indicator $\beta$ for cell average values $\bar{u}_i$ in a stencil which consists of a small number of cells, in my case three. For uniform meshes the paper gives explicit formulae for $\beta$ in terms of the cell average values. For example, a result they give for a stencil three cells wide is,
$$\beta_1 = \frac{13}{12}\left(\bar{u}_{i - 2} - 2\bar{u}_{i - 1} + \bar{u}_i\right)^2 + \frac{1}{4}\left(\bar{u}_{i-2} - 4\bar{u}_{i - 1} + 3\bar{u}_i\right)^2$$
The other formulae they give for various shifts of stencils of three cells all have this same form, albeit with different coefficients for the cell average terms within the parentheses. [Does this form have a name? If so, I'd like to improve the question title.]
The software I have written, which uses the computer algebra system Sympy to perform the necessary calculus to get to this point, produces the following expression which is equivalent to the above, and so correct,
$$\beta_1 = \frac{10}{3}{\bar{u}_i}^2 - \frac{31}{3}\bar{u}_{i}\bar{u}_{i-1} + \frac{11}{3}\bar{u}_{i}\bar{u}_{i-2} + \frac{25}{3}{\bar{u}_{i-1}}^2 - \frac{19}{3}\bar{u}_{i-1}\bar{u}_{i-2} + \frac{4}{3}{\bar{u}_{i-2}}^2$$
What method or steps can I follow to rearrange my result to the one given in the paper? Ideally I'm looking for a method with generalises to the other equations in the paper which have a similar structure.
In the case that the weights are all non-negative, the coefficient matrix $A$ of the quadratic form is positive semi-definite. For instance, if we consider $3\beta_1$ in your case, it's easy to check $$ A = \begin{pmatrix} 10 & -31/2 & 11/2 \\ -31/2 & 25 & -9/2 \\ 11/2 & -9/2 & 4 \\ \end{pmatrix} $$ has eigenvalues of $39\pm3\sqrt{39}$ and $0$, thus it's positive semi-definite.
There are numerous ways to get the decomposition (or square root) of $A$, i.e., if one has $A=B^TB$, then $B\bar{u}$ gives each square term.
I don't know Sympy, but one famous method is Cholesky decomposition, which Sympy likely has an implementation. Below is one such decomposition (by using Wolfram Alpha): $$3\beta_1=\frac{1}{40}(20\bar{u}_i-31\bar{u}_{i-1}+11\bar{u}_{i-2})^2+\frac{39}{40}(\bar{u}_{i-1}-\bar{u}_{i-2})^2$$