Divide - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Algebraic

  

Divide

  

exact divisibility check for polynomials with algebraic number coefficients

 

Calling Sequence

Parameters

Options

Description

Examples

Calling Sequence

Divide(a, b, options)

Divide(a, b, 'q', options)

Parameters

a,b

-

polynomials with algebraic number coefficients

q

-

(optional) name; will be assigned the value of the quotient ab if a is divisible by b 

options

-

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

Options

• 

If the option 'symbolic'=true is given and a RootOf whose minimal polynomial factors nontrivially is detected, then Divide will reduce it 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 nonnegative integer, the divisibility is computed over an extension of the ring p of integers modulo p. The default is 'characteristic'=0 and means that the divisibility 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 Divide may not be able to determine whether a is divisible by b or not. If it does not succeed because it encounters an integer that has no inverse modulo p, it issues the error "zero divisor modulo p detected"

• 

If the option 'makeindependent'=true is given, then Divide 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 Divide command determines if a given polynomial a is exactly divisible by the polynomial b.  Formally, a is divisible by b if there exists a polynomial q such that a=qb.  a and b may be polynomials in one or more variables.

• 

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 division property must hold in the domain K[x], where:

– 

x is the set of names in a and b which do not appear inside a RootOf or a radical.

– 

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 this function does not determine divisibility over the integers, as by default, all division is computed over the field of rationals, so true will be returned if two non-zero constants are given as input. For integer division, use iquo and irem.

• 

If the optional argument q is included and a is divisible by b, then q will be assigned the value of the quotient ab.  It is always guaranteed that a=qb. If a is not divisible by b, then q will not be assigned any value.

• 

Non-algebraic sub-expressions such as sinx that are neither variables, rational numbers, or algebraic objects are frozen and temporarily replaced by new local variables, which are not considered to be constant in what follows.

• 

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

• 

If the quotient q is assigned a value, it will be normalized as follows:

– 

All non-constant factors in q are monic with respect to a block-lexicographic ordering of the variables, where all global variables are considered larger than all local ones. If all variables have different names, then this ordering is session-independent.

– 

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 Divide may not be able to determine divisibility.  Divide 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).

• 

This function does not support input containing floats or radical functions such as x.

Examples

withAlgebraic:

Introductory examples:

Dividex2+1,x+I,q1

true

(1)

q1

xI

(2)

Dividex2+2RootOf_Z2_Z1x+1+RootOf_Z2_Z1,x+RootOf_Z2_Z1,q2,q2

true,x+RootOf_Z2_Z1

(3)

Dividex2+3y2,x+Isqrt3y,q3,q3

true,I3y+x

(4)

Note that q is not assigned a value when the output is false:

Dividex2+y2,x+y,q,q

false,q

(5)

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

Dividex2+sqrt2x+sqrt3x+RootOf_Z26,index=1,x+sqrt2,q4,q4

true,x+3

(6)

Dividex2+sqrt2x+sqrt3x+RootOf_Z26,x+sqrt2,q5,q5

true,x+RootOf_Z2622

(7)

Dividex2+sqrt2x+RootOf_Z23x+RootOf_Z26,x+sqrt2

false

(8)

Nested and mixed radicals and RootOfs are handled as well:

Dividex2413,x+RootOf_Z32,index=1,q6,q6

true,x213

(9)

DividexysqrtRootOf_Z23,index=1,yRootOf_Z2RootOf_Z23,index=1,index=1,q7,q7

true,x

(10)

This function does not compute divisibility over the integers.  Use iquo and irem for computing integer quotients and remainders:

Divide17,5,q8,q8

true,175

(11)

iquo17,5,irem17,5

3,2

(12)

A polynomial will always be divisible by any non-zero integer:

Dividex2+y+RootOf_Z2+_Z+5,4,q9,q9

true,x24+y4+RootOf_Z2+_Z+54

(13)

Dividex2+y+RootOf_Z2+_Z+5,0

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

Non-algebraic sub-expressions such as sinx and other functions will be frozen and treated as variables:

Dividetan4sqrt2+tan4x,tan4,q10,q10

true,x+2

(14)

Dividesinx23fooy4,sinxRootOf_Z23fooy2,q11,q11

true,RootOf_Z23fooy2+sinx

(15)

However, whenever possible, such expressions will be converted to algebraic numbers.  This will result in an error if the second argument becomes zero or a zero divisor:

Dividex2+sinπ4y,x+RootOf_Z22,index=1y,q12,q12

true,12

(16)

Dividex2+expIπ,xsecπ,q13,q13

true,x1

(17)

zero0

zero0

(18)

Divide3sinzero,sinzero

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

Non-algebraic sub-expressions may end up becoming algebraic after recursive normalizing takes place:

Dividex2+sinπx+sqrt5x+RootOf_Z25,index=1,x,q14,q14

true,x

(19)

Rational functions are usually not accepted, but if possible, Divide will normalize them into a polynomial form:

Divide1x,1x2

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

Dividex3+1x1,xRootOf_Z2_Z+1

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

Dividex3+1x+1,xRootOf_Z2_Z+1,q15,q15

true,x+RootOf_Z2_Z+11

(20)

If it is outputted, q will also be reduced and normalized:

DividexyRootOf_Z3_Z+35,sqrt2yRootOf_Z3_Z+32,q16,q16

true,x2RootOf_Z3_Z+3232x2

(21)

Algebraic functions such as y are not accepted:

Dividex2+2xsqrty+y,x+sqrty

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

Floats are not accepted.

Dividex2x+0.25,x12

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

When a non-indexed RootOf is given in the input, sometimes divisibility can still be determined if the quotient can be expressed in terms of the RootOf(s) in the input:

Dividex3RootOf_Z21,xRootOf_Z21,q21,q21

true,RootOf_Z21x+x2+1

(22)

However, in the following case, Divide is unable to determine divisibility because it must know whether RootOf_Z22 represents 2 or 2 when no index is given.  In such a case, it will not throw an error, (as GreatestCommonDivisor does), but instead return false. This is because there does not exist a polynomial q with coefficients in the given algebraic extension such that a=qb is true in all possible cases (as there was in the previous example). For this reason, it is best to use indexed RootOfs whenever possible:

Dividexsqrt2,xRootOf_Z22,index=1

true

(23)

Dividexsqrt2,xRootOf_Z22,index=2

false

(24)

Dividexsqrt2,xRootOf_Z22

false

(25)

If the second argument contains a zero divisor, an error will be returned. In this case, option 'symbolic'=true can be used to force Divide to select one of the substitutions and complete the computation:

Dividex2y,RootOf_Z2_Z,index=1x

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

Dividex2y,RootOf_Z2_Z,index=2x

true

(26)

Dividex2y,RootOf_Z2_Zx

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

Dividex2y,RootOf_Z2_Zx,symbolic=true

true

(27)

Using option 'characteristic', divisibility can be checked over finite fields:

Dividex2+4,x+1

false

(28)

Dividex2+4,x+1,q22,characteristic=5,q22

true,x+4

(29)

Dividex25,xIsqrt2,q23,characteristic=7,q23

true,I2+x

(30)

In composite characteristic, Divide cannot always determine divisibility, and will return an error if it encounters a zero divisor:

Divide2x2y+8xy,2x+8,q24,characteristic=9,q24

true,xy

(31)

Divide2x2y+8xy,2x+8,characteristic=10

Error, (in Algebraic:-Divide) 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:

CubeRootOf4RootOf_Z3+4,index=1

CubeRootOf−4RootOf_Z3+4,index=1

(32)

CubeRootOf2RootOf_Z3+2,index=1

CubeRootOf−2RootOf_Z3+2,index=1

(33)

CubeRootOf2RootOf_Z32,index=1

CubeRootOf2RootOf_Z32,index=1

(34)

CubeRootOf3RootOf_Z33,index=1

CubeRootOf3RootOf_Z33,index=1

(35)

CubeRootOf4RootOf_Z34,index=1

CubeRootOf4RootOf_Z34,index=1

(36)

CubeRootOf6RootOf_Z36,index=1

CubeRootOf6RootOf_Z36,index=1

(37)

Dividex+CubeRootOf4CubeRootOf2CubeRootOf3,x+CubeRootOf4CubeRootOf6

false

(38)

Dividex+CubeRootOf4CubeRootOf2CubeRootOf3,x+CubeRootOf4CubeRootOf6,q25,makeindependent=true,q25

true,1

(39)

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

Dividex+CubeRootOf2CubeRootOf3,x+CubeRootOf6,q26,q26

true,1

(40)

Dividex+CubeRootOf2CubeRootOf3,x+CubeRootOf6,makeindependent=false

false

(41)

See Also

Algebraic

Algebraic[PseudoDivision]

Algebraic[Quotient]

Algebraic[Remainder]

Divide