Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
2

Polynomial Long Division with Variable Coefficients

asked 7 years ago

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

I want to divide the following polynomial (in terms of t) with coefficients in terms of λ.

(λ65λ4+6λ21)t5+(λ54λ3+3λ2)t6

by λt2λ2t+λ

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(2λ89λ6+2λ5+6λ44λ2λ)+t3(2λ69λ4+3λ3+6λ21λ)+t(λ42λ)+(λ34λ2)λt2λ2t+λ

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 λ 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])
Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 7 years ago

tmonteil gravatar image

Your polynomials are not polynomials with two indeterminates lambda and t. They are polynomial in t with coefficients in function field in lambda, so the definition of the rings you are working in should reflect that. Here is a possiblity:

sage: R.<l> = FunctionField(QQ) ; R
Rational function field in l over Rational Field
sage: S.<t> = R[] ; S
Univariate Polynomial Ring in t over Rational function field in l over Rational Field
sage: P = (l^6-5*l^4+6*l^2-1)*t^5 + (l^5-4*l^3+3*l^2)*t^6
sage: Q = l*t^2 - l^2*t + l
sage: a,b = P.quo_rem(Q)
sage: a
(l^4 - 4*l^2 + 3*l)*t^4 + ((2*l^6 - 9*l^4 + 3*l^3 + 6*l^2 - 1)/l)*t^3 + (2*l^6 - 10*l^4 + 3*l^3 + 10*l^2 - 3*l - 1)*t^2 + ((2*l^8 - 12*l^6 + 3*l^5 + 19*l^4 - 6*l^3 - 7*l^2 + 1)/l)*t + 2*l^8 - 14*l^6 + 3*l^5 + 29*l^4 - 9*l^3 - 17*l^2 + 3*l + 2
sage: b
(2*l^10 - 16*l^8 + 3*l^7 + 41*l^6 - 12*l^5 - 36*l^4 + 9*l^3 + 9*l^2 - 1)*t - 2*l^9 + 14*l^7 - 3*l^6 - 29*l^5 + 9*l^4 + 17*l^3 - 3*l^2 - 2*l
sage: a*Q+b == P
True
sage: a.degree()
4
sage: b.degree()
1
Preview: (hide)
link

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

Seen: 2,367 times

Last updated: Jul 06 '17