2
$\begingroup$

In 12.1.0 for Microsoft Windows (64-bit) (March 14, 2020), writing:

num = 7 (3764 + 3673 Sqrt[2]) x^4 - 12 (19302 + 10727 Sqrt[2]) x^3 y + 756 (-44 + 31 Sqrt[2]) x^2 y^2 + 864 (37 + 51 Sqrt[2]) x y^3 - 5184 (2 + Sqrt[2]) y^4; den = ((7 + 10 Sqrt[2]) x - 6 y) ((9 + 32 Sqrt[2]) x + 12 (1 + Sqrt[2]) y); FullSimplify[num/den^2] FullSimplify[num/den]/den 

I get:

enter image description here

where it's evident that the second expression is more compact than the first. Is there a way to get it automatically? Thanks!

$\endgroup$

3 Answers 3

7
$\begingroup$
num=7 (3764+3673 √2) x^4-12 (19302+10727 √2) x^3 y+756 (-44+31 √2) x^2 y^2+864 (37+51 √2) x y^3-5184 (2+√2) y^4; den=((7+10 √2) x-6 y) ((9+32 √2) x+12 (1+√2) y); MinimalBy[z /. Simplify@First@Solve[Reduce[z==num/den^2, #], z, Method->Rational] & /@ {x, y}, LeafCount] 

$\frac{\left(6-5 \sqrt{2}\right) x-12 \left(\sqrt{2}-2\right) y}{\left(23 \sqrt{2}-55\right) x-12 y}$

Another way

factor = Factor[num/den^2, Extension -> Automatic] With[{expr = (a x + b y)/(c x + d y)}, expr /. RootReduce@SolveAlways[factor == expr, {x, y}]] // FullSimplify 
$\endgroup$
2
  • 1
    $\begingroup$ Cool +1. Any idea how to reduce the coefficients I got? Simplifying the difference of our answers yields zero, but gosh my numbers are huge. $\endgroup$ Commented Dec 21, 2020 at 7:00
  • $\begingroup$ Btw v. 11.3 gives a longer result. $\endgroup$ Commented Dec 21, 2020 at 7:32
2
$\begingroup$

By default FullSimplify and Simplify avoid large numbers through the default complexity function. Use LeafCount instead if you don’t mind the large numbers:

FullSimplify[num/den^2, ComplexityFunction->LeafCount] (* (6432772386615749160*x + 4548621517377519337*Sqrt[2]*x - 42218157353358559728*y - 29852856498186887412*Sqrt[2]*y) / (134971395315929658167*x + 95439426336007826330*Sqrt[2]*x + 72071013851545447140*y + 50961935174866167276*Sqrt[2]*y) *) 
$\endgroup$
0
1
$\begingroup$

This way it simlifies even more (or less)

num/den^2 // Apart // FullSimplify // Factor // FullSimplify 

$$ \frac{7 \left(124944256776+87864579823 \sqrt{2}\right) x-12 \left(476402576068+337753093375 \sqrt{2}\right) y}{\left(691401+441484 \sqrt{2}\right) \left(\left(13669487+10004398 \sqrt{2}\right) x+12 \left(616179+439573 \sqrt{2}\right) y\right)} $$

$\endgroup$
0