Processing math: 100%
Ask Your Question
3

Roots of multivariable polynomials with respect to one variable?

asked 6 years ago

Holden gravatar image

updated 6 years ago

This question was previously titled "Finding residues of a huge multivariable rational function."

From my understanding, when computing with huge rational functions, we shouldn't use symbolic variables. However, I don't see how to find roots and residues without symbolic variables. Here is a small scale example of the issue. I have a rational function that looks like below:

f(u1,x1,u2,x2,u3,x3)=1(u1u2u3x1x2x3)(u1u2u31)(u1u2x1x2)(u1u21)(u1x1)(u11)

First I want to solve for u1 in the denominator and find those roots (poles) that have x1 as below.

Then I will loop through the roots and compute the residue of f w.r.t. u1 at those poles.

u1,u2,u3,x1,x2,x3 = var('u1,u2,u3,x1,x2,x3')  #symbolic variables 
f=1/((u1*u2*u3 - x1*x2*x3)*(u1*u2*u3 - 1)*(u1*u2 - x1*x2)*(u1*u2 - 1)*(u1 - x1)*(u1 - 1))
fden=f.denominator() #denominator of f
list1=fden.roots(u1)    #poles of u1
[root for (root, multiplicity) in list1] #list of roots

The output is

[x1*x2*x3/(u2*u3), x1*x2/u2, x1, 1/(u2*u3), 1/u2, 1]

Then we choose those roots that have x1

poles1 = [x1*x2*x3/(u2*u3), x1*x2/u2, x1] #choose those that have x1

Finally, we find the residue of f w.r.t u1 of the rational function at the poles containing x1.

ans1=0
for ff in poles1:
   tmp=f.residue(u1==ff)
   ans1+=tmp     #ans1 is the residue of f w.r.t u1 at all the poles containing x1
ans1

The output is then

1/((u2*u3*x1 - x1*x2*x3)*(u2*u3*x1 - 1)*(u2*x1 - x1*x2)*(u2*x1 - 1)*(x1 - 1)) - 1/((u3*x1*x2 - x1*x2*x3)*(u3*x1*x2 - 1)* (x1*x2 - 1)*u2*(x1 - x1*x2/u2)*(x1*x2/u2 - 1)) + 1/((x1*x2*x3 - 1)*(x1*x2 - x1*x2*x3/u3)*(x1*x2*x3/u3 - 1)*u2*u3*(x1 x1*x2*x3/(u2*u3))*(x1*x2*x3/(u2*u3) - 1))

Then I replace f with ans1 to continue to do the same process w.r.t u2 and poles containing x2 and finally w.r.t u3 and poles containing x3. However, this consumes about 800GB of memory on an HPC when I feed it a larger rational function.

Is there a way to find

  1. roots of multivariable polynomials with respect to one variable?

  2. residue of a rational function avoiding symbolic variables?

Both .roots() and .residue() are not defined for rational functions that are not defined in terms of symbolic variables.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
4

answered 6 years ago

rburing gravatar image

updated 6 years ago

Instead of working with symbolic variables you can work in (fraction fields of) polynomial rings, as follows.

R.<u1,u2,u3,x1,x2,x3> = PolynomialRing(QQ)
f=1/((u1*u2*u3 - x1*x2*x3)*(u1*u2*u3 - 1)*(u1*u2 - x1*x2)*(u1*u2 - 1)*(u1 - x1)*(u1 - 1))
fden=f.denominator() #denominator of f

Division of polynomials automatically yields elements of the fraction field.

You can re-interpret a multivariate polynomial as being a polynomial in one variable, putting the remaining variables in the base ring:

sage: f_u1 = fden.polynomial(u1)
sage: f_u1.parent()
Univariate Polynomial Ring in u1 over Multivariate Polynomial Ring in u2, u3, x1, x2, x3 over Rational Field

But now the base ring is not a field, so it is hard to find roots there. But we can search for roots in the fraction field of the base ring:

sage: f_u1.roots(f_u1.base_ring().fraction_field())
[(1, 1),
 (x1, 1),
 (1/u2, 1),
 (x1*x2/u2, 1),
 (1/(u2*u3), 1),
 (x1*x2*x3/(u2*u3), 1)]

This should be much more efficient than using symbolic variables. Let me know if this works for you.

As for residues, indeed they are not implemented for rational functions. But you can easily implement the formulas yourself. For example, the residue of p(z)/q(z) at a simple pole z=r is p(r)/q(r).

Edit: In the second step, the roots of the denominator with respect to u2 may live in a larger field (when there are irreducible factors of degree >1 w.r.t u2 in the denominator), so you have to add these to your field when searching for roots. Basically you want the splitting field of the denominator. Since the variables are still undetermined it seems you would have to create a function field (extension).

Preview: (hide)
link

Comments

Thank you @rburing. Yes, the roots are instantaneous. I am working on the residues now. I will let you know if I have further questions.

Holden gravatar imageHolden ( 6 years ago )

I wrote down a one liner to define residue

def Res(f,var, pole, multi):
return (1/factorial(multi-1))*limit( diff((var-pole)^multi*f ,var,multi-1), var=pole)

but the limiting part takes a huge amount of memory for a moderately big rational function in several variables. I am looking for other methods now.

Holden gravatar imageHolden ( 6 years ago )

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: 6 years ago

Seen: 23,196 times

Last updated: Dec 17 '18