Singular
https://www.singular.uni-kl.de/forum/

factorization and multiplication of ratios of polynomials
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=2977
Page 1 of 1

Author:  tbr [ Fri Feb 18, 2022 6:44 pm ]
Post subject:  factorization and multiplication of ratios of polynomials

I'm trying to use Singular for the following computation:
in the ring of Laurent polynomials in k+4 variables x_1,...,x_k, q1,q2,q3,m
consider polynomials P_1 and P_2, which I provide in factorized form.
My goal is to compute an iterated residue (for which ordering matters)
of the ratio P_1 / P_2 in variables x at (simple) poles expressed in variables q.

First question is how to instruct Singular not to expand the building blocks of P_1 and P_2,
as it takes a long time to factor them back.

Then, at each intermediate step I need to factor the result
(so that cancellations between numerator and denominator are taken care of)
and substitute for the value of the simple pole:
the problem is that I'm not allowed to multiply factorization objects (at least in Sage).

My concrete example is written in Sage, but I'm willing to also use Singular itself if needed.
(This is currently not working for the reason above.)

Code:
def br(x):
    return 1-1/x

def meas():
    # here k and K are just an example
    k = 3
    R = PolynomialRing(ZZ, ['x%d' %p for p in range(k)]+['q1', 'q2', 'q3', 'q4', 'm'], order='invlex')
    R.inject_variables()
    K = 1 + q2 + q2^2 + q3 + q4
    X = R.gens()[:k]
    rho = [p.substitute({q4:(q1*q2*q3)^-1}) for p in K.monomials()]
    rho.reverse()

    chix = prod([ br(X[j]) for j in range(k)])
    chim = prod([ br(X[j]/m) for j in range(k)])
    chiup = prod([ prod([ br(q1*q2*X[i]/X[j]) * br(q1*q3*X[i]/X[j]) * br(q2*q3*X[i]/X[j]) * (br(X[i]/X[j]))^2 for i in range(k) if i > j]) for j in range(k)])
    chiups = prod([ prod([ br(X[i]/(X[j]*q1*q2)) * br(X[i]/(X[j]*q1*q3)) * br(X[i]/(X[j]*q2*q3)) for i in range(k) if i > j]) for j in range(k)])
    chido = prod([ prod([ br(q1*X[i]/X[j]) * br(q2*X[i]/X[j]) * br(q3*X[i]/X[j]) * br(q1*q2*q3*X[i]/X[j]) for i in range(k) if i > j]) for j in range (k)])
    chidos = prod([ prod([ br(X[i]/(X[j]*q1)) * br(X[i]/(X[j]*q2)) * br(X[i]/(X[j]*q3)) * br(X[i]/(X[j]*q1*q2*q3)) for i in range(k) if i > j]) for j in range (k)])
    dx = prod([ X[j] for j in range(k)])

    # this is P_1
    chinum = chim * chiup * chiups
    # this is P_2
    chiden = chix *chido * chidos * dx
    chi = chinum / chiden

    # this is the iterated residue at X=rho
    for xi,rhoi in zip(X,rho):
        chi = (chi*(xi-rhoi)).factor().subs({xi: rhoi})
    return chi.factor()


Thanks.

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/