# Substitution of expressions using Groebner basis

I know this topic came up numerous times (most of the results are detailed in the comments of this link Is there a way to to substitute for symbols, simplify, and back-substitute?). However, I have made several attempts, notably on the technique adapted by Daniel Lichtblau using Groebner basis. Despite that, I find that the expression is way too long and hence multiple, separate succession of substitution process needs to be made in order to simplify my overall equation. I will not attempt to copy and paste the original expression (for it is far too long and uneconomical) but I will show my steps

I have the following expression denom and I'd like to solve for the roots in terms ofω

denom = (4 g2^4 (Γ - 2 I ω) + g1^2 κ2^2 (κ1 - 2 I ω) + g2^2 (4 g1^2 + (Γ - 2 I ω) (κ1 - 2 I ω)) (κ2 - 2 I ω))
ωroots = ω /. (Solve[denom == 0, ω, Cubics -> True])


I now wish to find the complex conjugate of ωroots (there are three roots in total)

conjdenom = FullSimplify[ComplexExpand[denom] /. {I -> -I}]
conjωroots = ω /. (Solve[conjdenom == 0, ω, Cubics -> True]);


I define another expression, num, which I will use in a moment followed by another expression originating from the roots, called newdenom

num = 1/16 Γ ((4 g2^2 + κ1 κ2)^2 + 4 (-8 g2^2 + κ1^2 + κ2^2) ω^2 + 16 ω^4)
newdenom = (conjωroots[[1]] - ωroots[[2]])*(conjωroots[[1]] - ωroots[[3]])*(conjωroots[[1]] - ωroots[[1]])*(conjωroots[[1]] - conjωroots[[2]])*(conjωroots[[1]] - conjωroots[[3]])


I am now ready to make my final expression

finalexpr = 2*π*I*((num/newdenom) /. {ω -> conjωroots[[1]]})


Upon printing finalexpr, one can see a really long and nasty expression. However, there are recurring terms that occur throughout the expression. Notably, I could do the following substitution

Simplify[finalexpr, {Δ1 == -2304 g1^2 g2^6 Γ + 4608 g2^8 Γ + 128 g2^6 Γ^3 - 2304 g1^2 g2^6 κ1 - 2304 g2^8 κ1 - 192 g2^6 Γ^2 κ1 - 192 g2^6 Γ κ1^2 + 128 g2^6 κ1^3 + 4608 g1^2 g2^6 κ2 - 2304 g2^8 κ2 - 192 g2^6 Γ^2 κ2 + 768 g2^6 Γ κ1 κ2 - 192 g2^6 κ1^2 κ2 - 576 g1^2 g2^4 Γ κ2^2 - 192 g2^6 Γ κ2^2 + 1152 g1^2 g2^4 κ1 κ2^2 - 192 g2^6 κ1 κ2^2 - 576 g1^2 g2^4 κ2^3 + 128 g2^6 κ2^3, Δ2 == 2^(2/3)*(-16 (g2^2 Γ + g2^2 κ1 + g2^2 κ2)^2 + 48 g2^2 (4 g1^2 g2^2 + 4 g2^4 + g2^2 Γ κ1 + g2^2 Γ κ2 + g2^2 κ1 κ2 + g1^2 κ2^2))}]


Since Δ1 and Δ2 seems to be recurring expressions that shows up in finalexpr. However, doing this is computationally expensive (it took forever and didn't even finish simplifying). So I took a page out of Dan Lichtblau's method using Groebner basis:

Δ1 = -2304 g1^2 g2^6 Γ + 4608 g2^8 Γ + 128 g2^6 Γ^3 - 2304 g1^2 g2^6 κ1 - 2304 g2^8 κ1 - 192 g2^6 Γ^2 κ1 - 192 g2^6 Γ κ1^2 + 128 g2^6 κ1^3 + 4608 g1^2 g2^6 κ2 - 2304 g2^8 κ2 - 192 g2^6 Γ^2 κ2 + 768 g2^6 Γ κ1 κ2 - 192 g2^6 κ1^2 κ2 - 576 g1^2 g2^4 Γ κ2^2 - 192 g2^6 Γ κ2^2 + 1152 g1^2 g2^4 κ1 κ2^2 - 192 g2^6 κ1 κ2^2 - 576 g1^2 g2^4 κ2^3 + 128 g2^6 κ2^3;
Δ2 = 2^(2/3)*(-16 (g2^2 Γ + g2^2 κ1 + g2^2 κ2)^2 + 48 g2^2 (4 g1^2 g2^2 + 4 g2^4 + g2^2 Γ κ1 + g2^2 Γ κ2 + g2^2 κ1 κ2 + g1^2 κ2^2));
repExprs = {delt1 - Δ1, delt2 - Δ2};
repBasis = GroebnerBasis[repExprs, Variables[finalexpr]];


And finding the canonicalized form of the expression

PolynomialReduce[finalexpr, repBasis, Variables[finalexpr]][[2]]


Does not return a simplified expression as a function of delt1 and delt2. I believe the substitution is absolutely valid given how they recur throughout finalexpr. I am open to other variants of the substitution expressions Δ1 and Δ2 or other methods of simplification but it is possible to simplify the expression for sure (based on my past experience with a similar problem).

Thanks

Edit 1: For a bigger picture, here's what I'm really attempting to do. I have the following function, say test

test = (2 g2^2 Sqrt[Γ] (4 g2^2 + (κ1 - 2 I ω) (κ2 - 2 I ω)))/(4 g2^4 (Γ - 2 I ω) + g1^2 κ2^2 (κ1 - 2 I ω) + g2^2 (4 g1^2 + (Γ - 2 I ω) (κ1 - 2 I ω)) (κ2 - 2 I ω))


and I am attempting to integrate the the norm of test, namely test*Conjugate[test] from -∞ to ∞ as a function of ω. What I was showing above was basically a shortcut way of doing it using contour integrals and cauchy's integral theorem. I hope this piece of information is useful and hopefully helps with the problem.

Edit 2: Upon printing finalexpr, there is a recurring expression that is always of the form, say (x+Sqrt[x^2 + y^3])^(1/3) where x and yconsists of long expressions

• (1) If z* denotes the complex conjugate of z, then if z is a root to f=0, we'll have z* as a root to f*=0. So it is not necessary to redo the Solve. (2) It is not clear why there is an asymmetry wherein only the first conjugate root is subtracted from all others and this set of values multiplied together. Is the goal to have some discriminant-like computation? Maybe if the underlying goal were explained it would be easier to offer suggestions. – Daniel Lichtblau Apr 5 at 17:40
• @DanielLichtblau I doubt it will be of use but basically I'm trying to do an integral over a quantity. I will update the main text. – kowalski Apr 5 at 17:41
• Is the idea to do a partial fractions decomposition with respect to the variable omega? – Daniel Lichtblau Apr 5 at 18:42
• No, although that would be doable, you will just have to integrate each partial fraction separately (I'm not sure how useful that might be). I was actually trying to factor the denominator into products of roots of \[omega] and then, using Cauchy's integral formula to evaluate the 3 of the poles (out of a total 6 since there's 3 from the denominator of test and 3 from Conjugate[test]). The complex roots happen to be my conjwroots whereas wroots are the regular roots. num is nothing but the Absolute value of the numerator of test – kowalski Apr 5 at 18:54
• When you do complex conjugation by ComplexExpand[denom] /. {I -> -I} you live dangerously. In your case it works, but in other cases it won't (for example if denom = 2 + 3 I). Better to do ComplexExpand[Conjugate[denom]] to be safe. – Roman Apr 6 at 9:25