Ask Your Question
3

Roots of multivariable polynomials with respect to one variable?

asked 2018-12-16 23:32:23 +0100

Holden gravatar image

updated 2018-12-17 17:17:25 +0100

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(u_1,x_1,u_2,x_2,u_3,x_3) = \frac{1}{{\left(u_{1} u_{2} u_{3} - x_{1} x_{2} x_{3}\right)} {\left(u_{1} u_{2} u_{3} - 1\right)} {\left(u_{1} u_{2} - x_{1} x_{2}\right)} {\left(u_{1} u_{2} - 1\right)} {\left(u_{1} - x_{1}\right)} {\left(u_{1} - 1\right)}}$

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

Then I will loop through the roots and compute the residue of $f$ w.r.t. $u_1$ 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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
4

answered 2018-12-17 18:07:42 +0100

rburing gravatar image

updated 2018-12-17 19:17:31 +0100

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 $u_2$ may live in a larger field (when there are irreducible factors of degree $\gt 1$ w.r.t $u_2$ 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).

edit flag offensive delete link more

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 ( 2018-12-17 20:36:26 +0100 )edit

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 ( 2018-12-19 04:26:42 +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: 2018-12-16 23:32:23 +0100

Seen: 23,071 times

Last updated: Dec 17 '18