 Divide - Maple Help

Algebraic

 Divide
 exact divisibility check for polynomials with algebraic number coefficients 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 $\frac{a}{b}$ 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 ${\mathrm{ℤ}}_{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 ${\mathrm{ℤ}}_{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 $\frac{a}{b}$.  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 $\mathrm{sin}\left(x\right)$ 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 $\sqrt{x}$. Examples

 > $\mathrm{with}\left(\mathrm{Algebraic}\right):$

Introductory examples:

 > $\mathrm{Divide}\left({x}^{2}+1,x+I,'\mathrm{q1}'\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{q1}$
 ${x}{-}{I}$ (2)
 > $\left[\mathrm{Divide}\left({x}^{2}+2\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}-1\right)x+1+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}-1\right),x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}-1\right),'\mathrm{q2}'\right),\mathrm{q2}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{-}{1}\right)\right]$ (3)
 > $\left[\mathrm{Divide}\left({x}^{2}+3{y}^{2},x+I\sqrt{3}y,'\mathrm{q3}'\right),\mathrm{q3}\right]$
 $\left[{\mathrm{true}}{,}{-}{I}{}\sqrt{{3}}{}{y}{+}{x}\right]$ (4)

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

 > $\left[\mathrm{Divide}\left({x}^{2}+{y}^{2},x+y,'q'\right),q\right]$
 $\left[{\mathrm{false}}{,}{q}\right]$ (5)

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

 > $\left[\mathrm{Divide}\left({x}^{2}+\sqrt{2}x+\sqrt{3}x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-6,\mathrm{index}=1\right),x+\sqrt{2},'\mathrm{q4}'\right),\mathrm{q4}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}\sqrt{{3}}\right]$ (6)
 > $\left[\mathrm{Divide}\left({x}^{2}+\sqrt{2}x+\sqrt{3}x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-6\right),x+\sqrt{2},'\mathrm{q5}'\right),\mathrm{q5}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}\frac{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{6}\right){}\sqrt{{2}}}{{2}}\right]$ (7)
 > $\mathrm{Divide}\left({x}^{2}+\sqrt{2}x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-3\right)x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-6\right),x+\sqrt{2}\right)$
 ${\mathrm{false}}$ (8)

Nested and mixed radicals and RootOfs are handled as well:

 > $\left[\mathrm{Divide}\left({x}^{2}-{4}^{\frac{1}{3}},x+\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-2,\mathrm{index}=1\right),'\mathrm{q6}'\right),\mathrm{q6}\right]$
 $\left[{\mathrm{true}}{,}{x}{-}{{2}}^{{1}}{{3}}}\right]$ (9)
 > $\left[\mathrm{Divide}\left(xy\sqrt{\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-3,\mathrm{index}=1\right)},y\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-3,\mathrm{index}=1\right),\mathrm{index}=1\right),'\mathrm{q7}'\right),\mathrm{q7}\right]$
 $\left[{\mathrm{true}}{,}{x}\right]$ (10)

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

 > $\left[\mathrm{Divide}\left(17,5,'\mathrm{q8}'\right),\mathrm{q8}\right]$
 $\left[{\mathrm{true}}{,}\frac{{17}}{{5}}\right]$ (11)
 > $\left[\mathrm{iquo}\left(17,5\right),\mathrm{irem}\left(17,5\right)\right]$
 $\left[{3}{,}{2}\right]$ (12)

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

 > $\left[\mathrm{Divide}\left({x}^{2}+y+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}+\mathrm{_Z}+5\right),4,'\mathrm{q9}'\right),\mathrm{q9}\right]$
 $\left[{\mathrm{true}}{,}\frac{{{x}}^{{2}}}{{4}}{+}\frac{{y}}{{4}}{+}\frac{{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{+}{\mathrm{_Z}}{+}{5}\right)}{{4}}\right]$ (13)
 > $\mathrm{Divide}\left({x}^{2}+y+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}+\mathrm{_Z}+5\right),0\right)$

Non-algebraic sub-expressions such as $\mathrm{sin}\left(x\right)$ and other functions will be frozen and treated as variables:

 > $\left[\mathrm{Divide}\left(\mathrm{tan}\left(4\right)\sqrt{2}+\mathrm{tan}\left(4\right)x,\mathrm{tan}\left(4\right),'\mathrm{q10}'\right),\mathrm{q10}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}\sqrt{{2}}\right]$ (14)
 > $\left[\mathrm{Divide}\left({\mathrm{sin}\left(x\right)}^{2}-3{\mathrm{foo}\left(y\right)}^{4},\mathrm{sin}\left(x\right)-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-3\right){\mathrm{foo}\left(y\right)}^{2},'\mathrm{q11}'\right),\mathrm{q11}\right]$
 $\left[{\mathrm{true}}{,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{3}\right){}{{\mathrm{foo}}{}\left({y}\right)}^{{2}}{+}{\mathrm{sin}}{}\left({x}\right)\right]$ (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:

 > $\left[\mathrm{Divide}\left(\frac{x}{2}+\mathrm{sin}\left(\frac{\mathrm{Pi}}{4}\right)y,x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2,\mathrm{index}=1\right)y,'\mathrm{q12}'\right),\mathrm{q12}\right]$
 $\left[{\mathrm{true}}{,}\frac{{1}}{{2}}\right]$ (16)
 > $\left[\mathrm{Divide}\left({x}^{2}+{ⅇ}^{I\mathrm{Pi}},x-\mathrm{sec}\left(\mathrm{Pi}\right),'\mathrm{q13}'\right),\mathrm{q13}\right]$
 $\left[{\mathrm{true}}{,}{x}{-}{1}\right]$ (17)
 > $\mathrm{zero}≔0$
 ${\mathrm{zero}}{≔}{0}$ (18)
 > $\mathrm{Divide}\left(3\mathrm{sin}\left(\mathrm{zero}\right),\mathrm{sin}\left(\mathrm{zero}\right)\right)$

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

 > $\left[\mathrm{Divide}\left({x}^{2}+\mathrm{sin}\left(\frac{\mathrm{Pi}\left(x+\sqrt{5}\right)}{x+\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-5,\mathrm{index}=1\right)}\right),x,'\mathrm{q14}'\right),\mathrm{q14}\right]$
 $\left[{\mathrm{true}}{,}{x}\right]$ (19)

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

 > $\mathrm{Divide}\left(\frac{1}{x},\frac{1}{{x}^{2}}\right)$
 > $\mathrm{Divide}\left(\frac{{x}^{3}+1}{x-1},x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}+1\right)\right)$
 > $\left[\mathrm{Divide}\left(\frac{{x}^{3}+1}{x+1},x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}+1\right),'\mathrm{q15}'\right),\mathrm{q15}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{\mathrm{_Z}}{+}{1}\right){-}{1}\right]$ (20)

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

 > $\left[\mathrm{Divide}\left(xy{\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-\mathrm{_Z}+3\right)}^{5},\sqrt{2}y{\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-\mathrm{_Z}+3\right)}^{2},'\mathrm{q16}'\right),\mathrm{q16}\right]$
 $\left[{\mathrm{true}}{,}\frac{{x}{}\sqrt{{2}}{}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{\mathrm{_Z}}{+}{3}\right)}{{2}}{-}\frac{{3}{}\sqrt{{2}}{}{x}}{{2}}\right]$ (21)

Algebraic functions such as $\sqrt{y}$ are not accepted:

 > $\mathrm{Divide}\left({x}^{2}+2x\sqrt{y}+y,x+\sqrt{y}\right)$

Floats are not accepted.

 > $\mathrm{Divide}\left({x}^{2}-x+0.25,x-\frac{1}{2}\right)$

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:

 > $\left[\mathrm{Divide}\left({x}^{3}-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right),x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-1\right),'\mathrm{q21}'\right),\mathrm{q21}\right]$
 $\left[{\mathrm{true}}{,}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{2}}{-}{1}\right){}{x}{+}{{x}}^{{2}}{+}{1}\right]$ (22)

However, in the following case, Divide is unable to determine divisibility because it must know whether $\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right)$ represents $\sqrt{2}$ or $-\sqrt{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:

 > $\mathrm{Divide}\left(x-\sqrt{2},x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2,\mathrm{index}=1\right)\right)$
 ${\mathrm{true}}$ (23)
 > $\mathrm{Divide}\left(x-\sqrt{2},x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2,\mathrm{index}=2\right)\right)$
 ${\mathrm{false}}$ (24)
 > $\mathrm{Divide}\left(x-\sqrt{2},x-\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-2\right)\right)$
 ${\mathrm{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:

 > $\mathrm{Divide}\left({x}^{2}y,\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z},\mathrm{index}=1\right)x\right)$
 > $\mathrm{Divide}\left({x}^{2}y,\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z},\mathrm{index}=2\right)x\right)$
 ${\mathrm{true}}$ (26)
 > $\mathrm{Divide}\left({x}^{2}y,\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}\right)x\right)$
 > $\mathrm{Divide}\left({x}^{2}y,\mathrm{RootOf}\left({\mathrm{_Z}}^{2}-\mathrm{_Z}\right)x,'\mathrm{symbolic}'=\mathrm{true}\right)$
 ${\mathrm{true}}$ (27)

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

 > $\mathrm{Divide}\left({x}^{2}+4,x+1\right)$
 ${\mathrm{false}}$ (28)
 > $\left[\mathrm{Divide}\left({x}^{2}+4,x+1,'\mathrm{q22}','\mathrm{characteristic}'=5\right),\mathrm{q22}\right]$
 $\left[{\mathrm{true}}{,}{x}{+}{4}\right]$ (29)
 > $\left[\mathrm{Divide}\left({x}^{2}-5,x-I\sqrt{2},'\mathrm{q23}','\mathrm{characteristic}'=7\right),\mathrm{q23}\right]$
 $\left[{\mathrm{true}}{,}{I}{}\sqrt{{2}}{+}{x}\right]$ (30)

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

 > $\left[\mathrm{Divide}\left(2{x}^{2}y+8xy,2x+8,'\mathrm{q24}','\mathrm{characteristic}'=9\right),\mathrm{q24}\right]$
 $\left[{\mathrm{true}}{,}{x}{}{y}\right]$ (31)
 > $\mathrm{Divide}\left(2{x}^{2}y+8xy,2x+8,'\mathrm{characteristic}'=10\right)$

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

 > ${\mathrm{CubeRootOf}}_{-4}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}+4,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{-4}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{+}{4}{,}{\mathrm{index}}{=}{1}\right)$ (32)
 > ${\mathrm{CubeRootOf}}_{-2}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}+2,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{-2}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{+}{2}{,}{\mathrm{index}}{=}{1}\right)$ (33)
 > ${\mathrm{CubeRootOf}}_{2}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-2,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{2}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{2}{,}{\mathrm{index}}{=}{1}\right)$ (34)
 > ${\mathrm{CubeRootOf}}_{3}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-3,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{3}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{3}{,}{\mathrm{index}}{=}{1}\right)$ (35)
 > ${\mathrm{CubeRootOf}}_{4}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-4,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{4}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{4}{,}{\mathrm{index}}{=}{1}\right)$ (36)
 > ${\mathrm{CubeRootOf}}_{6}≔\mathrm{RootOf}\left({\mathrm{_Z}}^{3}-6,\mathrm{index}=1\right)$
 ${{\mathrm{CubeRootOf}}}_{{6}}{≔}{\mathrm{RootOf}}{}\left({{\mathrm{_Z}}}^{{3}}{-}{6}{,}{\mathrm{index}}{=}{1}\right)$ (37)
 > $\mathrm{Divide}\left(x+{\mathrm{CubeRootOf}}_{4}{\mathrm{CubeRootOf}}_{-2}{\mathrm{CubeRootOf}}_{3},x+{\mathrm{CubeRootOf}}_{-4}{\mathrm{CubeRootOf}}_{6}\right)$
 ${\mathrm{false}}$ (38)
 > $\left[\mathrm{Divide}\left(x+{\mathrm{CubeRootOf}}_{4}{\mathrm{CubeRootOf}}_{-2}{\mathrm{CubeRootOf}}_{3},x+{\mathrm{CubeRootOf}}_{-4}{\mathrm{CubeRootOf}}_{6},'\mathrm{q25}','\mathrm{makeindependent}'=\mathrm{true}\right),\mathrm{q25}\right]$
 $\left[{\mathrm{true}}{,}{1}\right]$ (39)

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

 > $\left[\mathrm{Divide}\left(x+{\mathrm{CubeRootOf}}_{2}{\mathrm{CubeRootOf}}_{3},x+{\mathrm{CubeRootOf}}_{6},'\mathrm{q26}'\right),\mathrm{q26}\right]$
 $\left[{\mathrm{true}}{,}{1}\right]$ (40)
 > $\mathrm{Divide}\left(x+{\mathrm{CubeRootOf}}_{2}{\mathrm{CubeRootOf}}_{3},x+{\mathrm{CubeRootOf}}_{6},'\mathrm{makeindependent}'=\mathrm{false}\right)$
 ${\mathrm{false}}$ (41)