login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

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)

\label{eq1}\hbox{\axiomType{DistributedMultivariatePolynomial}\ } ([ x , y , z ] , \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }))(1)
Type: Type
fricas
d1: lex := -2* x^12 + 4* x^2 * y^4

\label{eq2}-{2 \ {{x}^{12}}}+{4 \ {{x}^{2}}\ {{y}^{4}}}(2)
Type: DistributedMultivariatePolynomial([x,y,z],Fraction(Integer))
fricas
d2: lex := x^2 - y^11

\label{eq3}{{x}^{2}}-{{y}^{11}}(3)
Type: DistributedMultivariatePolynomial([x,y,z],Fraction(Integer))
fricas
f :lex := 3*x^14*y^10 + 5*x*y^3 -6*y^7 + 1

\label{eq4}{3 \ {{x}^{14}}\ {{y}^{10}}}+{5 \  x \ {{y}^{3}}}-{6 \ {{y}^{7}}}+ 1(4)
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.

\label{eq5}\begin{array}{@{}l}
\displaystyle
\left[{quotient ={\left[ -{{3 \over 2}\ {{x}^{2}}\ {{y}^{10}}}, \:{{6 \ {{x}^{2}}\ {{y}^{14}}}+{6 \ {{y}^{25}}}}\right]}}, \: \right.
\
\
\displaystyle
\left.{remainder ={{5 \  x \ {{y}^{3}}}+{6 \ {{y}^{36}}}-{6 \ {{y}^{7}}}+ 1}}\right] 
(5)
Type: Record(quotient: List(DistributedMultivariatePolynomial([x,y,z],Fraction(Integer))),remainder: DistributedMultivariatePolynomial([x,y,z],Fraction(Integer)))
fricas
mpolydiv(f, [d2,d1])

\label{eq6}\begin{array}{@{}l}
\displaystyle
\left[{
\begin{array}{@{}l}
\displaystyle
quotient ={
\begin{array}{@{}l}
\displaystyle
\left[{{3 \ {{x}^{12}}\ {{y}^{10}}}+{3 \ {{x}^{10}}\ {{y}^{21}}}+{3 \ {{x}^{8}}\ {{y}^{32}}}+{3 \ {{x}^{6}}\ {{y}^{43}}}+{3 \ {{x}^{4}}\ {{y}^{54}}}+{3 \ {{x}^{2}}\ {{y}^{65}}}+{3 \ {{y}^{76}}}}, \right.
\
\
\displaystyle
\left.\: 0 \right] 
(6)
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

\label{eq7}{3 \ {{x}^{14}}\ {{y}^{10}}}+{5 \  x \ {{y}^{3}}}-{6 \ {{y}^{7}}}+ 1(7)
Type: DistributedMultivariatePolynomial([x,y,z],Fraction(Integer))




  Subject:   Be Bold !!
  ( 13 subscribers )  
Please rate this page: