ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 02 Sep 2020 23:41:22 +0200Rewriting linear combination of Groebner basis in terms of original termshttps://ask.sagemath.org/question/53267/rewriting-linear-combination-of-groebner-basis-in-terms-of-original-terms/ Let assume I have an ideal given by
x,y,z = QQ['x,y,z'].gens()
I = ideal(f1,f2,f3)
B = I.groebner_basis()
where f1,f2,f3 are just polynomials in variables x,y,z. Let's say B=(g1,g2).
Let's assume I happen to take a polynomial,h, that is in my ideal I. Then doing polynomial division, I can write
h=h1*g1+h2*g2
Basically I can write h as a linear combination of the elements in my Groebner basis. Is there a function that converts a linear combination in terms of Groebner to linear combination of terms in my ideal I? i.e.I can write
h=q1*f1+q2*f2+q3*f3
whatupmattWed, 02 Sep 2020 23:41:22 +0200https://ask.sagemath.org/question/53267/Polynomial Long Division with Variable Coefficientshttps://ask.sagemath.org/question/38187/polynomial-long-division-with-variable-coefficients/I want to divide the following polynomial (in terms of $t$) with coefficients in terms of $\lambda$.
$$(\lambda^6 - 5\lambda^4 + 6\lambda^2 - 1)t^5 + (\lambda^5 - 4\lambda^3 + 3\lambda^2)t^6$$
by $$ \lambda t^2 -\lambda^2 t + \lambda$$
The resulting quotient will include a fractional component (the numerator's
degree will be strictly less than the denominator's degree).
This is what a quotient and remainder, added together, might look like:
$$ t(\frac{2\lambda^8 - 9 \lambda^6 + 2 \lambda^5 + 6 \lambda^4 - 4\lambda^2}{\lambda}) + t^3(\frac{2\lambda^6 - 9\lambda^4 + 3\lambda^3 + 6\lambda^2 -1 }{\lambda}) + \frac{t(\lambda^4 - 2\lambda) + (\lambda^3 - 4\lambda^2)}{\lambda t^2 - \lambda^2 t + \lambda}$$
*I have tried the following thus far* Any suggestions? The code below "does not work", because it outputs a quotient whose degree is greater than the degree of the dividend. Here $y$ takes the place of $\lambda$
and $x$ takes the place of $t$.
The quotient is:
-2*x^8 - x^4*y^4 + 2.0*x^6 - 3.0*x^5 - 1.0*x^4 - (2*x^5 + x^3)*y^3 + (-2*x^6 + 2.0*x^4 - x^2)*y^2 + (-2*x^7 +
4.0*x^5 + 1.0*x^3 - x)*y - 1
The remainder is:
-x^5 + (2*x^10 + 3.0*x^7 - 1.0*x^6 + 3.0*x^5 + 1.0*x^4 + x^2 + 1)*y
The code:
from sympy import Function, rsolve_poly, Symbol, rsolve, rsolve_hyper, oo
from sympy.abc import n
x = var('x')
y = var('y')
P.<x,y> = PolynomialRing(CC)
f = (y**5 - 4*y**3 + 3*y**2)*x**6 + (y**6 - 5*y**4 + 6*y**2 - 1)*x**5
g = y*x**2 - y**2*x + y
def division(dividend, divisor):
return (dividend._maxima_().divide(divisor).sage())
a = division(f,g)
print("The quotient is: \n")
print(a[0])
print("The remainder is: \n")
print(a[1])MunoThu, 06 Jul 2017 07:12:28 +0200https://ask.sagemath.org/question/38187/