My problem is very simple. From two different functions $f_1$ and $f_2$, I create two multivariate polynomials.
Because of theoretical reasons those two functions (evaluated with the same input $x$) should send the same output.
Now when I want to check this I always get false. The reason is the following I declare $P_1=f_1(x)$ and $P_2=f_2(x)$ and when I see the polynomials $P_1$ and $P_2$ they are actually equal but the first one has integer coefficients and the second one has rational coefficients (when the coefficient is $2$ in the first one, in the second the coefficient will be $2.$).
Here is the question, how can I formally check that I have found the same polynomial in both cases? I think this would involve to convert the coefficients of the first one into rational but I am not able to find in the help of Mathematica how to do it, and then to check equality with $P_1===P_2$.
Rational
. IntegerQ[2.] is False; IntegerQ[2/1] is True (evaluates to 2). $\endgroup$Rationalize
. $\endgroup$