Ask Your Question

Holden's profile - activity

2018-12-18 21:26:42 -0500 commented answer Roots of multivariable polynomials with respect to one variable?

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.

2018-12-18 13:00:59 -0500 received badge  Good Question (source)
2018-12-17 17:49:58 -0500 received badge  Nice Question (source)
2018-12-17 13:36:26 -0500 commented answer Roots of multivariable polynomials with respect to one variable?

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.

2018-12-17 12:36:18 -0500 received badge  Supporter (source)
2018-12-16 16:32:23 -0500 asked a question Roots of multivariable polynomials with respect to one variable?

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.

2018-03-16 17:16:03 -0500 commented answer Representation as sums of squares built-in function

@slelievre, cool. Thanks.

2016-02-27 08:58:07 -0500 commented answer Representation as sums of squares built-in function

@slelievre, thank you so much. I installed mathematica 10.3(latest issue) and was not able to call mathematica even if I followed all the instructions on how to use mathematica within sage. From what I read around the web, I have to downgrade to version 8 to be able to interface to mathematica from within Sage. Is that true or am I missing something with integrating version 10.3?

2016-02-23 17:59:14 -0500 commented answer calling mathematica 9.0 in sage

@Emmanuel, is there a follow up to your answer? I have Mathematica 10.3 and I have the following error "unable to start mathematica"

2016-02-23 16:20:46 -0500 received badge  Scholar (source)
2016-02-23 16:20:38 -0500 commented answer Representation as sums of squares built-in function

I see. Thanks.

2016-02-22 12:31:24 -0500 received badge  Editor (source)
2016-02-22 12:26:42 -0500 commented answer Representation as sums of squares built-in function

@slelievre, thank you! I have confused my self a lot and I was actually looking for a built in function that outputs r_k(n) which is the number of ways of writing a given number n as a sum of k-squares. For instance r_4(1) = 8. There is SquaresR[] built-in function in Mathematica but I can't interface to it within Sage. Is there such a built-in function in Sage?

2016-02-22 12:04:13 -0500 received badge  Student (source)
2016-02-22 11:58:43 -0500 asked a question Representation as sums of squares built-in function

Is there a Sage implementation of writing a number as a sum of k squares for any k as described in the ticket here: trac.sagemath.org/ticket/16308 ?

Thank you!

Please see my comment below the first answer.