I want to simplify a polynomial in variable $x$ with integer coefficients by substitution $x\to{x}/d$ so that the coefficients become smallest possible integers.
Input:
pol = 80 - 96 x - 432 x^2;
co = Abs[CoefficientList[pol, x][[2 ;; -1]]]
d = Sqrt[GCD[co[[1]]^2,Times @@ (Power @@@ Select[FactorInteger[co[[2]]], #[[2]] > 1 &])]]
pol /. x -> x/d
Clear[pol, d]
Output:
12
80 - 8 x - 3 x^2
In the case above the biggest divisor is $d=12$ and by substitution $x\to{x}/12$ we get $80 - 8 x - 3 x^2$ from original $80 - 96 x - 432 x^2$.
I think my code is quite cumbersome. Can you come up with a better/simpler/shorter/more transparent code?
PS: My code works only for quadratic polynomial, but I know how to amend it to work for any polynomial, so do not concentrate on the fact that it works only for quadratic polynomial at the moment.
EDIT: I have just noticed that it does not work properly even for all quadratic polynomials.
pol/GCD @@ CoefficientList[pol, x] // Simplify
returns5 - 6 x - 27 x^2
. $\endgroup$