Ask Your Question
0

How to find linear dependences between rational functions

asked 2024-05-15 14:22:16 +0100

Emm gravatar image
  • 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 flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2024-05-15 16:40:41 +0100

Emmanuel Charpentier gravatar image

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,

edit flag offensive delete link more

Comments

One-liner using pari that deals with denominators:

pari.lindep(Sys/pari.content(Sys)).sage()
Max Alekseyev gravatar imageMax Alekseyev ( 2024-05-16 05:00:39 +0100 )edit

I didn't know this.

Thank you very much, @Max Alekseyev !

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2024-05-16 13:10:48 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-05-15 14:22:16 +0100

Seen: 185 times

Last updated: May 15