# How to find linear dependences between rational functions

• Assume I have a list of multivariable rational functions
• Assume I know (or Iat least I have good reasons to hope) that there is a linear relation, let say with integer coefficients, between all these rational functions. How can I find it?

For example, let

• C1=1/x
• C2=1/(x+y)
• C3=y/(x*(x+y))

then, it is easy to check that C1-C2-C3=0. However, how to find this relation automatically?

It does not seem that pari lindep can do it (which indeed is quite clear when reading pari doc):

x,y=var('x,y')
C1=1/x
C2=1/(x+y)
C3=y/(x*(x+y))
pari.lindep([C1,C2,C3])


returns

PariError: incorrect type in lindep_Xadic (t_RFRAC)


NB. Any Sagemath solution is welcome, even without using pari!

edit retag close merge delete

Sort by ยป oldest newest most voted

In this simple case (one libear dependance), it is easy to find the expressions of the rational functions to a common denominator and to explore their span.

Running :

reset()
Vars=var("x, y")
C1=1/x
C2=1/(x+y)
C3=y/(x*(x+y))
Sys=[C1, C2, C3]
# Find the LCM of denominators
L=lcm(map(denominator, Sys))
# Numerators of the rational expressions expressed with denominator L
Nums=[u.numerator()*L/u.denominator() for u in Sys]
# Expression of the linear dependance :
Dep=pari.lindep(Nums).sage()
print("Dependance = ", Dep)
# Check
print("Check : ", bool(vector(Dep).dot_product(vector(Nums))==0))


gives :

sage: load('/tmp/sage_shell_modeZ6Ph52/sage_shell_mode_temp.sage')
Dependance =  [1, -1, -1]
Check :  True


Of course, you have to manage the necessary condition of the non-nullity of the common denominator yourself...

HTH,

more

One-liner using pari that deals with denominators:

pari.lindep(Sys/pari.content(Sys)).sage()

( 2024-05-16 05:00:39 +0200 )edit

I didn't know this.

Thank you very much, @Max Alekseyev !

( 2024-05-16 13:10:48 +0200 )edit