Algebraic
Quotient
quotient of polynomials with algebraic number coefficients
Remainder
remainder of polynomials with algebraic number coefficients
Calling Sequence
Parameters
Options
Description
Examples
Quotient(a, b, x, options)
Quotient(a, b, x, `r`, options)
Remainder(a, b, x, options)
Remainder(a, b, x, `q`, options)
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'
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.
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=q⁢b+r and degree⁡r,x<degree⁡b,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=q⁢b+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 sin⁡x, 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.
with⁡Algebraic:
Introductory examples:
Quotient⁡x2+3,x+I,x
x−I
Remainder⁡x2+3,x+I,x
2
Quotient⁡y3,y2+sqrt⁡2⁢y+1,y,r1,r1
y−2,y+2
root1≔RootOf⁡_Z2−3⁢_Z+1
Remainder⁡x4+root1⁢x2+x+root12,x2+root1,x
x+3⁢RootOf⁡_Z2−3⁢_Z+1−1
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⁡x2+x+1,x−2,x,r2,r2
x+3,7
Remainder⁡x2+x+1,x−2,x,q2,q2
7,x+3
evalb⁡eval⁡r2,Quotient⁡x2+x+1,x−2,x,r2=eval⁡q2,Remainder⁡x2+x+1,x−2,x,q2
true
The input may contain both radicals and RootOfs, and Quotient and Remainder will embed the coefficients into an algebraic field, if possible:
Quotient⁡x2+sqrt⁡2⁢x+RootOf⁡_Z2−3,index=1⁢x+2⁢sqrt⁡6,x+sqrt⁡2,x,r3,r3
x+3,3⁢2
Quotient⁡x2+sqrt⁡2⁢x+RootOf⁡_Z2−3⁢x+RootOf⁡_Z2−6,x+sqrt⁡2,x,r4,r4
x+RootOf⁡_Z2−3,−2⁢RootOf⁡_Z2−3+RootOf⁡_Z2−6
Nested and mixed radicals are handled as well:
Quotient⁡x2−413+1,x+RootOf⁡_Z3−2,index=1,x,r5,r5
x−213,1
Quotient⁡x⁢sqrt⁡RootOf⁡_Z2−3,index=1+1,RootOf⁡_Z2−RootOf⁡_Z2−3,index=1,index=1,x,r6,r6
x+3343,0
The input must contain univariate polynomials only. Multiple variables are not supported and an error will be returned:
Quotient⁡x2+x⁢y+y2+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,0
iquo⁡17,5,irem⁡17,5
3,2
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⁡x2+3⁢x+4,RootOf⁡_Z2−2,x
RootOf⁡_Z2−2⁢x22+3⁢RootOf⁡_Z2−2⁢x2+2⁢RootOf⁡_Z2−2
Remainder⁡x2+3⁢x+4,RootOf⁡_Z2−2,x
0
Quotient⁡x2+3⁢x+4,0,x
Error, (in Algebraic:-Quotient) numeric exception: division by zero
Remainder⁡x2+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 sin⁡x, as it will be frozen and temporarily replaced by a new local variable:
Quotient⁡sin⁡x2+3⁢sin⁡x+7,sin⁡x+1,sin⁡x,r7,r7
sin⁡x+2,5
Other non-algebraic sub-expressions can only be included if they can be converted to algebraic numbers:
Quotient⁡x2+sin⁡π4,x+exp⁡I⁢π,x,r8,r8
12,22+12
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⁡1x,1x2,x
Error, (in Algebraic:-Quotient) polynom(s) with radalgnum coefficients expected
Quotient⁡x3+Ix−I,x+I,x,r9,r9
x,−1
The output will always be fully reduced and normalized (see Reduce, Normal):
Quotient⁡x⁢RootOf⁡_Z3−_Z+35+1sqrt⁡2,sqrt⁡2⁢RootOf⁡_Z3−_Z+32⁢x,x,r10,r10
2⁢RootOf⁡_Z3−_Z+32−3⁢22,22
Non-algebraic sub-expressions in the input may become algebraic after being recursively normalized:
Remainder⁡x+sin⁡π⁢y−sqrt⁡24⁢y−RootOf⁡_Z2−2,index=1,x,x
22
Floats are not accepted.
Quotient⁡x2−x+0.25,x−12,x
Algebraic functions such as x are not accepted:
Quotient⁡x2+2⁢x⁢sqrt⁡x,x+sqrt⁡x,x
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⁡x3−RootOf⁡_Z2−1+RootOf⁡_Z2−3,x−RootOf⁡_Z2−1,x,r11,r11
RootOf⁡_Z2−1⁢x+x2+1,RootOf⁡_Z2−3
Quotient⁡x+sqrt⁡2,x+RootOf⁡_Z2−2,x,r12,r12
1,−RootOf⁡_Z2−2+2
However, in the following case, Quotient and Remainder are unable to compute the quotient and remainder because they must know whether RootOf⁡_Z2−2 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⁡_Z2−2,index=1⁢x+sqrt⁡2⁢x+1,x,r12,r12
1,−1
Quotient⁡2⁢sqrt⁡2⁢x,RootOf⁡_Z2−2,index=2⁢x+sqrt⁡2⁢x+1,x,r13,r13
2⁢2⁢x,0
Quotient⁡2⁢sqrt⁡2⁢x,RootOf⁡_Z2−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⁡_Z2−2=2:
Quotient⁡2⁢sqrt⁡2⁢x,RootOf⁡_Z2−2⁢x+sqrt⁡2⁢x+1,x,r14,symbolic=true,r14
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⁡x2,sqrt⁡2−RootOf⁡_Z2−2,x
Quotient⁡x2,sqrt⁡2−RootOf⁡_Z2−2,x,symbolic=true
2⁢x24
Using option 'characteristic', quotients and remainders can be computed over finite fields:
Quotient⁡x2−x−1,x+4,x,r15,r15
x−5,19
Quotient⁡x2−x−1,x+4,x,r16,characteristic=5,r16
x,4
Quotient⁡x2,x−I⁢sqrt⁡2,x,r17,characteristic=7,r17
I⁢2+x,5
In composite characteristic, quotients and remainders cannot always be computed. Quotient and Remainder will return errors if they encounter a zero divisor:
Quotient⁡2⁢x2+8⁢x,2⁢x+6,x,r18,characteristic=9,r18
x+1,3
Quotient⁡2⁢x2+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⁡_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
Quotient⁡x+CubeRootOf4⁢CubeRootOf−2⁢CubeRootOf3,x+CubeRootOf−4⁢CubeRootOf6,x,r19,r19
1,RootOf⁡_Z3+2,index=1⁢RootOf⁡_Z3−3,index=1⁢RootOf⁡_Z3−4,index=1−RootOf⁡_Z3+4,index=1⁢RootOf⁡_Z3−6,index=1
Quotient⁡x+CubeRootOf4⁢CubeRootOf−2⁢CubeRootOf3,x+CubeRootOf−4⁢CubeRootOf6,x,r20,makeindependent=true,r20
1,0
With option 'makeindependent'=false, the input will never be checked for algebraic dependencies:
Quotient⁡x+CubeRootOf2⁢CubeRootOf3,x+CubeRootOf6,x,r21,r21
Quotient⁡x+CubeRootOf2⁢CubeRootOf3,x+CubeRootOf6,x,makeindependent=false,r22,r22
1,RootOf⁡_Z3−2,index=1⁢RootOf⁡_Z3−3,index=1−RootOf⁡_Z3−6,index=1
See Also
Algebraic[Divide]
Algebraic[PseudoDivision]
Quo
Rem
Download Help Document