5
$\begingroup$

Say, I have the following expressions

f = R[p]
g = S[p]

where R,S are rational functions, and I want to find a polynomial such that

P[f,g]=C(onstant)

For example:

f=p^2 + p
g=p+4

leading to

P(x,y)=y^2-x-7y
g^2-f-7g=-12.

Can Mathematica help me in any way finding the polynomial P, if R,S become more and more complex ( but still rational, of course )?

And, at least, how can I find the answer to the example with Mathematica?

$\endgroup$
2
  • 3
    $\begingroup$ Just to start the ball rolling. The constant can be computed as -Resultant[f,g,p]. $\endgroup$
    – yarchik
    May 12 at 10:26
  • 1
    $\begingroup$ The constant is not unique. P may be multiplied by a constant. And as the constant can be incorporated into P it can always be chosen as zero. $\endgroup$ May 12 at 11:13
11
$\begingroup$

Start by making a list of polynomial terms to choose from: for example, all terms up to third order in $f$ and $g$,

terms = DeleteDuplicates[Times @@@ Tuples[{1, F, G}, 3]]
(*    {1, F, G, F^2, F G, G^2, F^3, F^2 G, F G^2, G^3}    *)

Express these terms as polynomials in $p$, and list their polynomial coefficients (here up to sixth order in $p$):

f = p^2 + p;
g = p + 4;
X = CoefficientList[terms /. {F -> f, G -> g}, p, 7]
(*    {{ 1,  0,  0,  0,  0,  0,  0},
       { 0,  1,  1,  0,  0,  0,  0},
       { 4,  1,  0,  0,  0,  0,  0},
       { 0,  0,  1,  2,  1,  0,  0},
       { 0,  4,  5,  1,  0,  0,  0},
       {16,  8,  1,  0,  0,  0,  0},
       { 0,  0,  0,  1,  3,  3,  1},
       { 0,  0,  4,  9,  6,  1,  0},
       { 0, 16, 24,  9,  1,  0,  0},
       {64, 48, 12,  1,  0,  0,  0}}    *)

Find the null-space of this matrix: the polynomials that combine to zero,

NullSpace[Transpose[X]] . terms
(*    {84 - 7 F - 37 G - F G + G^3,
       12 F - F^2 - 7 F G + F G^2,
       12 - F - 7 G + G^2}             *)

Verify these three solutions:

% /. {F -> f, G -> g} // Expand
(*    {0, 0, 0}    *)

So we have the solutions $$ -f g-7 f+g^3-37 g+84 = 0\\ -f^2+f g^2-7 f g+12 f = 0\\ -f+g^2-7 g+12 = 0 $$

There will be many more solutions if you increase the order of terms in terms. Factoring these solutions will show you the minimal function $P$, which in this case is $P(f,g)=-f+g^2-7 g+12=0$. You can add constants $C$ to this solution at will.

Rational functions

An extension of the above procedure to rational functions is straightforward through extending all functions by the common denominator. As an example,

f = p/(p + 1);
g = p*(p - 1)/(p^3 + 7);
denom = PolynomialLCM @@ Denominator /@ {f, g}
(*    (1 + p) (7 + p^3)    *)

Expanding the rational functions by the denom gives polynomials of order

e = Max@Exponent[{f, g}*denom, p]
(*    4    *)

Use polynomial terms up to fifth order in the result:

maxorder = 5;
terms = DeleteDuplicates[Times @@@ Tuples[{1, F, G}, maxorder]]
(*    {1, F, G, F^2, F G, G^2, F^3, F^2 G, F G^2, G^3, F^4, F^3 G,
       F^2 G^2, F G^3, G^4, F^5, F^4 G, F^3 G^2, F^2 G^3, F G^4, G^5}    *)

Compute the coefficients matrix:

X = CoefficientList[terms*denom^maxorder /. {F -> f, G -> g}, p, e*maxorder + 1]
(*    21x21 matrix with integer coefficients    *)

Pick the null-space solution that has the smallest number of non-zero coefficients:

MinimalBy[NullSpace[Transpose[X]], Total@*Unitize] . terms
(*    {-F + 3 F^2 - 2 F^3 - 7 G + 21 F G - 21 F^2 G + 6 F^3 G}    *)

So we see that $$ 6 f^3 g-21 f^2 g-2 f^3+3 f^2+21 f g-f-7 g = 0 $$

$\endgroup$
1
  • $\begingroup$ Thank you! - What an interesting answer. I need to study it first, of course. After that I might have a, more complicated, follow-up question to post. $\endgroup$ May 12 at 14:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.