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.
If so, your next step might to look for a Python Sum Of Squares Solver ?
– Chris F Carroll Sep 12 '21 at 15:49Simplify /@ depressPolynomial[ 10/3 x^2 - 31/3 x y + 11/3 x z + 25/3 y^2 - 19/3 y z + 4/3 z^2, z]yields $\frac{1}{48} (11 x-19 y+8 z)^2+\frac{13}{16} (x-y)^2$. Usingzoryinstead yields a different sum of squares. So the form is not unique, but it might get you started. – march Sep 12 '21 at 16:13