Algebraic
Divide
exact divisibility check for polynomials with algebraic number coefficients
Calling Sequence
Parameters
Options
Description
Examples
Divide(a, b, options)
Divide(a, b, 'q', options)
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'
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.
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=q⁢b. 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=q⁢b. If a is not divisible by b, then q will not be assigned any value.
Non-algebraic sub-expressions such as sin⁡x 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.
with⁡Algebraic:
Introductory examples:
Divide⁡x2+1,x+I,q1
true
q1
x−I
Divide⁡x2+2⁢RootOf⁡_Z2−_Z−1⁢x+1+RootOf⁡_Z2−_Z−1,x+RootOf⁡_Z2−_Z−1,q2,q2
true,x+RootOf⁡_Z2−_Z−1
Divide⁡x2+3⁢y2,x+I⁢sqrt⁡3⁢y,q3,q3
true,−I⁢3⁢y+x
Note that q is not assigned a value when the output is false:
Divide⁡x2+y2,x+y,q,q
false,q
The input may contain both radicals and RootOfs, and Divide will embed the coefficients into an algebraic field, if possible:
Divide⁡x2+sqrt⁡2⁢x+sqrt⁡3⁢x+RootOf⁡_Z2−6,index=1,x+sqrt⁡2,q4,q4
true,x+3
Divide⁡x2+sqrt⁡2⁢x+sqrt⁡3⁢x+RootOf⁡_Z2−6,x+sqrt⁡2,q5,q5
true,x+RootOf⁡_Z2−6⁢22
Divide⁡x2+sqrt⁡2⁢x+RootOf⁡_Z2−3⁢x+RootOf⁡_Z2−6,x+sqrt⁡2
false
Nested and mixed radicals and RootOfs are handled as well:
Divide⁡x2−413,x+RootOf⁡_Z3−2,index=1,q6,q6
true,x−213
Divide⁡x⁢y⁢sqrt⁡RootOf⁡_Z2−3,index=1,y⁢RootOf⁡_Z2−RootOf⁡_Z2−3,index=1,index=1,q7,q7
true,x
This function does not compute divisibility over the integers. Use iquo and irem for computing integer quotients and remainders:
Divide⁡17,5,q8,q8
true,175
iquo⁡17,5,irem⁡17,5
3,2
A polynomial will always be divisible by any non-zero integer:
Divide⁡x2+y+RootOf⁡_Z2+_Z+5,4,q9,q9
true,x24+y4+RootOf⁡_Z2+_Z+54
Divide⁡x2+y+RootOf⁡_Z2+_Z+5,0
Error, (in Algebraic:-Divide) numeric exception: division by zero
Non-algebraic sub-expressions such as sin⁡x and other functions will be frozen and treated as variables:
Divide⁡tan⁡4⁢sqrt⁡2+tan⁡4⁢x,tan⁡4,q10,q10
true,x+2
Divide⁡sin⁡x2−3⁢foo⁡y4,sin⁡x−RootOf⁡_Z2−3⁢foo⁡y2,q11,q11
true,RootOf⁡_Z2−3⁢foo⁡y2+sin⁡x
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:
Divide⁡x2+sin⁡π4⁢y,x+RootOf⁡_Z2−2,index=1⁢y,q12,q12
true,12
Divide⁡x2+exp⁡I⁢π,x−sec⁡π,q13,q13
true,x−1
zero≔0
Divide⁡3⁢sin⁡zero,sin⁡zero
Non-algebraic sub-expressions may end up becoming algebraic after recursive normalizing takes place:
Divide⁡x2+sin⁡π⁢x+sqrt⁡5x+RootOf⁡_Z2−5,index=1,x,q14,q14
Rational functions are usually not accepted, but if possible, Divide will normalize them into a polynomial form:
Divide⁡1x,1x2
Error, (in Algebraic:-Divide) polynom(s) with radalgnum coefficients expected
Divide⁡x3+1x−1,x−RootOf⁡_Z2−_Z+1
Divide⁡x3+1x+1,x−RootOf⁡_Z2−_Z+1,q15,q15
true,x+RootOf⁡_Z2−_Z+1−1
If it is outputted, q will also be reduced and normalized:
Divide⁡x⁢y⁢RootOf⁡_Z3−_Z+35,sqrt⁡2⁢y⁢RootOf⁡_Z3−_Z+32,q16,q16
true,x⁢2⁢RootOf⁡_Z3−_Z+32−3⁢2⁢x2
Algebraic functions such as y are not accepted:
Divide⁡x2+2⁢x⁢sqrt⁡y+y,x+sqrt⁡y
Floats are not accepted.
Divide⁡x2−x+0.25,x−12
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:
Divide⁡x3−RootOf⁡_Z2−1,x−RootOf⁡_Z2−1,q21,q21
true,RootOf⁡_Z2−1⁢x+x2+1
However, in the following case, Divide is unable to determine divisibility because it must know whether RootOf⁡_Z2−2 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=q⁢b 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:
Divide⁡x−sqrt⁡2,x−RootOf⁡_Z2−2,index=1
Divide⁡x−sqrt⁡2,x−RootOf⁡_Z2−2,index=2
Divide⁡x−sqrt⁡2,x−RootOf⁡_Z2−2
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:
Divide⁡x2⁢y,RootOf⁡_Z2−_Z,index=1⁢x
Divide⁡x2⁢y,RootOf⁡_Z2−_Z,index=2⁢x
Divide⁡x2⁢y,RootOf⁡_Z2−_Z⁢x
Error, (in Algebraic:-Divide) reducible RootOf detected. Substitutions are {RootOf(_Z^2-_Z) = 0, RootOf(_Z^2-_Z) = 1}
Divide⁡x2⁢y,RootOf⁡_Z2−_Z⁢x,symbolic=true
Using option 'characteristic', divisibility can be checked over finite fields:
Divide⁡x2+4,x+1
Divide⁡x2+4,x+1,q22,characteristic=5,q22
true,x+4
Divide⁡x2−5,x−I⁢sqrt⁡2,q23,characteristic=7,q23
true,I⁢2+x
In composite characteristic, Divide cannot always determine divisibility, and will return an error if it encounters a zero divisor:
Divide⁡2⁢x2⁢y+8⁢x⁢y,2⁢x+8,q24,characteristic=9,q24
true,x⁢y
Divide⁡2⁢x2⁢y+8⁢x⁢y,2⁢x+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:
CubeRootOf−4≔RootOf⁡_Z3+4,index=1
CubeRootOf−2≔RootOf⁡_Z3+2,index=1
CubeRootOf2≔RootOf⁡_Z3−2,index=1
CubeRootOf3≔RootOf⁡_Z3−3,index=1
CubeRootOf4≔RootOf⁡_Z3−4,index=1
CubeRootOf6≔RootOf⁡_Z3−6,index=1
Divide⁡x+CubeRootOf4⁢CubeRootOf−2⁢CubeRootOf3,x+CubeRootOf−4⁢CubeRootOf6
Divide⁡x+CubeRootOf4⁢CubeRootOf−2⁢CubeRootOf3,x+CubeRootOf−4⁢CubeRootOf6,q25,makeindependent=true,q25
true,1
With option 'makeindependent'=false, the input will never be checked for algebraic dependencies:
Divide⁡x+CubeRootOf2⁢CubeRootOf3,x+CubeRootOf6,q26,q26
Divide⁡x+CubeRootOf2⁢CubeRootOf3,x+CubeRootOf6,makeindependent=false
See Also
Algebraic[PseudoDivision]
Algebraic[Quotient]
Algebraic[Remainder]
Download Help Document