A tutorial written by Angelos Mantzaflaris (webpage:
http://users.uoa.gr/~amantzaf/proje.html )
(currently only in Greek)
contains the following routine:
fricas
-- Multivariate Polynomial Division
mpolydiv (f,D)==
lex := typeOf (f)
Q:=[ 0:: lex for j in D ]
r:= 0:: lex
m:= #D
lms :=[ leadingMonomial (D.j) for j in 1..m]
j:= 1
flag := false
while f ~= 0 repeat
if j>m then
j:= 1
if flag = false then
t:= leadingMonomial f
r:= r + t
f:= f - t
flag := false
if normalForm ( leadingMonomial (f),[ lms .j ])=0 then
t := ( leadingMonomial f/lms.j):: lex
Q.j := Q.j + t
f := f - t*D.j
flag := true
else
j:= j+1
rec := Record ( quotient : LIST lex , remainder : lex)
return [Q,r]:: rec
Type: Void
Here is an example of it's use:
fricas
lex:=DMP([x,y,z], FRAC INT)
Type: Type
fricas
d1: lex := -2* x^12 + 4* x^2 * y^4
Type: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))
fricas
d2: lex := x^2 - y^11
Type: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))
fricas
f :lex := 3*x^14*y^10 + 5*x*y^3 -6*y^7 + 1
Type: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))
fricas
mpolydiv(f, [d1,d2])
Cannot compile conversion for types involving local variables. In
particular, could not compile the expression involving :: lex
FriCAS will attempt to step through and interpret the code.
Type: Record(quotient: List(DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))),
remainder: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer)))
fricas
mpolydiv(f, [d2,d1])
Type: Record(quotient: List(DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))),
remainder: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer)))
fricas
%.quotient 1 * d2 + %.quotient 2 * d1 + %.remainder
Type: DistributedMultivariatePolynomial
?([x,
y,
z],
Fraction(Integer))