Algebraic - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Mathematics : Algebra : Algebraic Numbers : Algebraic/Quotient

Algebraic

  

Quotient

  

quotient of polynomials with algebraic number coefficients

  

Remainder

  

remainder of polynomials with algebraic number coefficients

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

Quotient(a, b, x, options)

Quotient(a, b, x, `r`, options)

Remainder(a, b, x, options)

Remainder(a, b, x, `q`, options)

Parameters

a, b

-

polynomials in x with algebraic number coefficients

x

-

name

q, r

-

(optional) unevaluated names

options

-

(optional) equation(s) of the form keyword = value, where keyword is either 'makeindependent', 'symbolic', or 'characteristic'

Options

• 

If the option 'symbolic'=true is given and a RootOf whose minimal polynomial factors nontrivially is detected, then it will be reduced to a RootOf of lower degree by picking one of the factors arbitrarily. This will eliminate the possibility of a "reducible RootOf detected" error. The default is 'symbolic'=false.

• 

If the option 'characteristic'=p is given, where p is a non-negative integer, the division is performed over an extension of the ring p of integers modulo p. The default is 'characteristic'=0 and means that the division is computed over an extension of the rational numbers.

• 

Note that if p is positive but not a prime, then p is not a field, so Quotient and Remainder may not be able to perform the division. If they do not succeed because they encounter an integer that has no inverse modulo p, they issue the error "zero divisor modulo p detected"

• 

If the option 'makeindependent'=true is given, then QuotientRemainder will always try to find a field representation for algebraic numbers in the input, regardless of how many algebraic objects the input contains. If the input contains many RootOfs, then this can be a very expensive calculation. If 'makeindependent'=false is given, then no independence checking is performed. The default is 'makeindependent'=FAIL, in which case algebraic dependencies will only be checked for if there are 4 or fewer algebraic objects in the input.

Description

• 

The Quotient and Remainder commands compute the quotient and remainder when a is divided by b. The quotient q and remainder r are polynomials in x and satisfy the relationships a=qb+r and degreer&comma;x<degreeb&comma;x.

• 

The Quotient command will return the quotient q, and if the optional parameter `r` is included, it will be assigned the value of r.

• 

The Remainder command will return the remainder r, and if the optional  parameter `q` is included, it will be assigned the value of q.

• 

The inputs a and b may contain algebraic number coefficients. These may be represented by radicals or with the RootOf notation (see type/algnum, type/radnum). In general, algebraic numbers will be returned in the same representation as they were received in. Nested radicals and RootOfs are also supported.

• 

The property a=qb+r will hold in the domain K[x], where K is an algebraic field generated over the rationals and any algebraic number coefficients occurring in a and b (unless the option 'characteristic' is given; see below).

• 

Note that these functions do not compute quotients or remainders over the integers, as by default, all division is computed over the field of rationals. For integer division, use iquo and irem.

• 

The arguments a and b must be univariate polynomials in the variable x, which is typically a name. If other names or non-algebraic sub-expressions are included and they cannot be evaluated to algebraic numbers, an "unable to divide multivariate polynomials" error will be returned.

• 

x can also be a function such as sinx, in which case it will be frozen and replaced by a new local variable. However, functions that are also of type AlgebraicObject such as sinπ3 will be converted to algebraic numbers before proceeding, so they cannot be treated as variables. Proceed with caution when using a function for x, as treating some functions as variables may produce mathematically unsound results.

• 

The inputs a and b can be polynomials disguised as rational functions, in which case they are normalized first using Algebraic[Normal].

• 

The quotient and remainder will be normalized as follows:

– 

All non-constant factors are monic.

– 

There are at most two constant factors, and at most one of them is not a rational number.

– 

All factors that are not rational numbers have integer content equal to 1, except possibly if there is only one non-constant factor.

– 

All algebraic numbers occurring in the result are reduced modulo their minimal polynomial (see Reduce), and all arguments of functions, if any, are normalized recursively (see Normal).

• 

If the set of radicals and RootOfs in the input cannot be embedded into a field algebraically, then Quotient and Remainder may not be able to perform the division. Quotient and Remainder will try to find a field representation if there are at most 4 algebraic objects in the input (unless option 'makeindependent' is given; see below), and otherwise attempt to proceed anyway. If unsuccessful, a "reducible RootOf detected" error will be returned. (unless the option 'symbolic'=true is given; see below).

• 

These functions do not support input containing floats or radical functions such as x.

Examples

with(Algebraic):

Introductory examples:

Quotient(x^2+3,x+I,x);

xI

(1)

Remainder(x^2+3,x+I,x);

2

(2)

[Quotient(y^3,y^2+sqrt(2)*y+1,y,'r1'),r1];

y2&comma;y+2

(3)

root1:=RootOf(_Z^2-3*_Z+1);

root1RootOf_Z23_Z+1

(4)

Remainder(x^4+root1*x^2+x+root1^2,x^2+root1,x);

x+3RootOf_Z23_Z+11

(5)

When a name is passed as the fourth argument to Quotient or Remainder, it will be assigned the value of the remainder or quotient, respectively.

[Quotient(x^2+x+1,x-2,x,'r2'),r2];

x+3&comma;7

(6)

[Remainder(x^2+x+1,x-2,x,'q2'),q2];

7&comma;x+3

(7)

evalb(eval({Quotient(x^2+x+1,x-2,x,'r2'),r2}) = eval({Remainder(x^2+x+1,x-2,x,'q2'),q2}));

true

(8)

The input may contain both radicals and RootOfs, and Quotient and Remainder will embed the coefficients into an algebraic field, if possible:

[Quotient(x^2+sqrt(2)*x+RootOf(_Z^2-3,index=1)*x+2*sqrt(6),x+sqrt(2),x,'r3'),r3];

x+3&comma;32

(9)

[Quotient(x^2 + sqrt(2)*x + RootOf(_Z^2-3)*x + RootOf(_Z^2-6),x + sqrt(2),x,'r4'),r4];

x+RootOf_Z23&comma;2RootOf_Z23+RootOf_Z26

(10)

Nested and mixed radicals are handled as well:

[Quotient(x^2-4^(1/3)+1,x+RootOf(_Z^3-2,index=1),x,'r5'),r5];

x213&comma;1

(11)

[Quotient(x*sqrt(RootOf(_Z^2-3,index=1))+1,RootOf(_Z^2-RootOf(_Z^2-3,index=1),index=1),x,'r6'),r6];

x+3343&comma;0

(12)

The input must contain univariate polynomials only.  Multiple variables are not supported and an error will be returned:

Quotient(x^2+x*y+y^2+1,x+y,x);

Error, (in Algebraic:-Quotient) unable to divide multivariate polynomials

This function does not compute quotients and remainders over the integers.  Use iquo and irem for that functionality:

[Quotient(17,5,x),Remainder(17,5,x)];

175&comma;0

(13)

[iquo(17,5), irem(17,5)];

3&comma;2

(14)

A polynomial will always be exactly divisible by any invertible, non-zero constant, so the remainder in such a case will always be zero:

Quotient(x^2+3*x+4,RootOf(_Z^2-2),x);

RootOf_Z22x22+3RootOf_Z22x2+2RootOf_Z22

(15)

Remainder(x^2+3*x+4,RootOf(_Z^2-2),x);

0

(16)

Quotient(x^2+3*x+4,0,x);

Error, (in Algebraic:-Quotient) numeric exception: division by zero

Remainder(x^2+3*x+4,0,x);

Error, (in Algebraic:-Remainder) numeric exception: division by zero

The input can also be treated as a pair of polynomials in a non-algebraic sub-expression such as sinx, as it will be frozen and temporarily replaced by a new local variable:

[Quotient(sin(x)^2+3*sin(x)+7,sin(x)+1,sin(x),'r7'),r7];

sinx+2&comma;5

(17)

Other non-algebraic sub-expressions can only be included if they can be converted to algebraic numbers:

[Quotient(x/2+sin(Pi/4),x+exp(I*Pi),x,'r8'),r8];

12&comma;22+12

(18)

Remainder(x+sin(y),x+4,x);

Error, (in Algebraic:-Remainder) unable to divide multivariate polynomials

Rational functions are generally not accepted, but polynomials disguised as rational functions are allowed, because they will be simplified by Normal:

Quotient(1/x,1/x^2,x);

Error, (in Algebraic:-Quotient) polynom(s) with radalgnum coefficients expected

[Quotient((x^3+I)/(x-I),x+I,x,'r9'),r9];

x&comma;−1

(19)

The output will always be fully reduced and normalized (see Reduce, Normal):

[Quotient(x*RootOf(_Z^3-_Z+3)^5+1/sqrt(2),sqrt(2)*RootOf(_Z^3-_Z+3)^2*x,x,'r10'),r10];

2RootOf_Z3_Z+32322&comma;22

(20)

Non-algebraic sub-expressions in the input may become algebraic after being recursively normalized:

Remainder(x+sin(Pi*(y-sqrt(2))/(y-RootOf(_Z^2-2,index=1))/4),x,x);

22

(21)

Floats are not accepted.

Quotient(x^2-x+0.25,x-1/2,x);

Error, (in Algebraic:-Quotient) polynom(s) with radalgnum coefficients expected

Algebraic functions such as x are not accepted:

Quotient(x^2+2*x*sqrt(x),x+sqrt(x),x);

Error, (in Algebraic:-Quotient) polynom(s) with radalgnum coefficients expected

When non-indexed RootOfs are given in the input, often the quotient and remainder can still be determined and expressed in terms of them:

[Quotient(x^3-RootOf(_Z^2-1)+RootOf(_Z^2-3),x-RootOf(_Z^2-1),x,'r11'),r11];

RootOf_Z21x+x2+1&comma;RootOf_Z23

(22)

[Quotient(x+sqrt(2),x+RootOf(_Z^2-2),x,'r12'),r12];

1&comma;RootOf_Z22+2

(23)

However, in the following case, Quotient and Remainder are unable to compute the quotient and remainder because they must know whether RootOf_Z22 represents 2 or 2 when no index is given. In such a case, they will return a "reducible RootOf detected" error:

[Quotient(2*sqrt(2)*x,RootOf(_Z^2-2,index=1)*x+sqrt(2)*x+1,x,'r12'),r12];

1&comma;−1

(24)

[Quotient(2*sqrt(2)*x,RootOf(_Z^2-2,index=2)*x+sqrt(2)*x+1,x,'r13'),r13];

22x&comma;0

(25)

Quotient(2*sqrt(2)*x,RootOf(_Z^2-2)*x+sqrt(2)*x+1,x);

Error, (in Algebraic:-Quotient) reducible RootOf detected. Substitutions are {RootOf(_Z^2-2) = -RootOf(_Z^2-2,index = 1), RootOf(_Z^2-2) = RootOf(_Z^2-2,index = 1)}

By using option 'symbolic' = true, Quotient and Remainder can be instructed to automatically select one of the possible substitutions and complete the computation.  Here, they pick RootOf_Z22=2:

[Quotient(2*sqrt(2)*x,RootOf(_Z^2-2)*x+sqrt(2)*x+1,x,'r14','symbolic'=true),r14];

1&comma;−1

(26)

An error will also be returned if the second argument contains a zero divisor.  Again, option 'symbolic' = true will force Quotient and Remainder to select one of the possibilities:

Quotient(x^2,sqrt(2)-RootOf(_Z^2-2),x);

Error, (in Algebraic:-Quotient) reducible RootOf detected. Substitutions are {RootOf(_Z^2-2) = -RootOf(_Z^2-2,index = 1), RootOf(_Z^2-2) = RootOf(_Z^2-2,index = 1)}

Quotient(x^2,sqrt(2)-RootOf(_Z^2-2),x,'symbolic'=true);

2x24

(27)

Using option 'characteristic', quotients and remainders can be computed over finite fields:

[Quotient(x^2-x-1,x+4,x,'r15'),r15];

x5&comma;19

(28)

[Quotient(x^2-x-1,x+4,x,'r16','characteristic'=5),r16];

x&comma;4

(29)

[Quotient(x^2,x-I*sqrt(2),x,'r17','characteristic'=7),r17];

I2+x&comma;5

(30)

In composite characteristic, quotients and remainders cannot always be computed. Quotient and Remainder will return errors if they encounter a zero divisor:

[Quotient(2*x^2+8*x,2*x+6,x,'r18','characteristic'=9),r18];

x+1&comma;3

(31)

Quotient(2*x^2+8*x,2*x+6,x,'characteristic'=10);

Error, (in Algebraic:-Quotient) zero divisor modulo 10 detected

With option 'makeindependent'=true, the input will be checked for algebraic dependencies even if there are more than 4 algebraic objects in the input:

CubeRootOf[-4]:=RootOf(_Z^3+4,index=1);

CubeRootOf−4RootOf_Z3+4&comma;index=1

(32)

CubeRootOf[-2]:=RootOf(_Z^3+2,index=1);

CubeRootOf−2RootOf_Z3+2&comma;index=1

(33)

CubeRootOf[2]:=RootOf(_Z^3-2,index=1);

CubeRootOf2RootOf_Z32&comma;index=1

(34)

CubeRootOf[3]:=RootOf(_Z^3-3,index=1);

CubeRootOf3RootOf_Z33&comma;index=1

(35)

CubeRootOf[4]:=RootOf(_Z^3-4,index=1);

CubeRootOf4RootOf_Z34&comma;index=1

(36)

CubeRootOf[6]:=RootOf(_Z^3-6,index=1);

CubeRootOf6RootOf_Z36&comma;index=1

(37)

[Quotient(x+CubeRootOf[4]*CubeRootOf[-2]*CubeRootOf[3],x+CubeRootOf[-4]*CubeRootOf[6],x,'r19'),r19];

1&comma;RootOf_Z3+2&comma;index=1RootOf_Z33&comma;index=1RootOf_Z34&comma;index=1RootOf_Z3+4&comma;index=1RootOf_Z36&comma;index=1

(38)

[Quotient(x+CubeRootOf[4]*CubeRootOf[-2]*CubeRootOf[3],x+CubeRootOf[-4]*CubeRootOf[6],x,'r20','makeindependent'=true),r20];

1&comma;0

(39)

With option 'makeindependent'=false, the input will never be checked for algebraic dependencies:

[Quotient(x+CubeRootOf[2]*CubeRootOf[3],x+CubeRootOf[6],x,'r21'),r21];

1&comma;0

(40)

[Quotient(x+CubeRootOf[2]*CubeRootOf[3],x+CubeRootOf[6],x,'makeindependent'=false,'r22'),r22];

1&comma;RootOf_Z32&comma;index=1RootOf_Z33&comma;index=1RootOf_Z36&comma;index=1

(41)

See Also

Algebraic

Algebraic[Divide]

Algebraic[PseudoDivision]

Quo

Rem