Integration of absolute functions If we have $\int \vert x^2-xx_i-x_jx+x_ix_j\vert^3 \rm dx,$ where $x_i$ and $x_j$ are real numbers, how to solve the integral properly?
 A: $x_i$ and $x_j$ are just constants. So you really have $$\int |x^2 - bx + c|^3 dx$$ for some constant $b, c$. Now $y = x^2 - bx + c$ is a parabola that opens upward. Depending on $c$, this parabola either lies entirely above the $x$-axis or else dives below before rising above it again. Find the two roots of $x^2- bx + c = 0$. If the roots are not real or if they are real, but are the same ($b^2 = 4c$), then $x^2 -bx + c$ is always non-negative, and so the absolute value makes no change, and you really have $$\int (x^2 - bx + c)^3 dx$$ which is just a 6th degree polynomial that can be integrated easily.
On the other hand, if $x^2 - bx + c = 0$ has two real roots $\alpha, \beta$ with $\alpha < \beta$, then $x^2 - bx + c \ge 0$ when $x \in (-\infty, \alpha] \cup  [\beta, \infty)$, and $x^2 - bx + c < 0$ when $x \in (\alpha, \beta)$.
Define $$F(x) = \begin{cases} \int_\alpha^x (x^2 - bx + c)^3 dx& x \le \alpha\\\int_\alpha^x (-(x^2 - bx + c))^3 dx & \alpha < x < \beta\\\int_\beta^x (x^2 - bx + c)^3 dx + \int_\alpha^\beta (-(x^2 - bx + c))^3 dx  & \beta \le x\end{cases}$$
Then $$\int |x^2 - bx + c|^3 dx = F(x) + C$$
Edit: 
When I wrote the original, I just noted that the interior expression was a quadratic in $x$, and gave my answer in terms of that. It wasn't until later that I realized that the quadratic was in fact $(x - x_i)(x - x_j)$, which simplifies the analysis. Since you are given real roots $x_i, x_j$, you can jump right to the end and let $\alpha=\min\{x_i, x_j\}, \beta = \max\{x_i,x_j\}$
