Introductory examples:
Note that q is not assigned a value when the output is false:
The input may contain both radicals and RootOfs, and Divide will embed the coefficients into an algebraic field, if possible:
Nested and mixed radicals and RootOfs are handled as well:
This function does not compute divisibility over the integers. Use iquo and irem for computing integer quotients and remainders:
A polynomial will always be divisible by any non-zero integer:
Non-algebraic sub-expressions such as and other functions will be frozen and treated as variables:
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:
Non-algebraic sub-expressions may end up becoming algebraic after recursive normalizing takes place:
Rational functions are usually not accepted, but if possible, Divide will normalize them into a polynomial form:
If it is outputted, q will also be reduced and normalized:
Algebraic functions such as are not accepted:
Floats are not accepted.
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:
However, in the following case, Divide is unable to determine divisibility because it must know whether represents or 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 with coefficients in the given algebraic extension such that 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:
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:
Using option 'characteristic', divisibility can be checked over finite fields:
In composite characteristic, Divide cannot always determine divisibility, and will return an error if it encounters a zero divisor:
With option 'makeindependent'=true, the input will be checked for algebraic dependencies even if there are more than algebraic objects in the input:
With option 'makeindependent'=false, the input will never be checked for algebraic dependencies: