You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `gcd` and `lcm` functions of `Base` have been implemented for monomials, you have for example `gcd(x^2*y^7*z^3, x^4*y^5*z^2)` returning `x^2*y^5*z^2` and `lcm(x^2*y^7*z^3, x^4*y^5*z^2)` returning `x^4*y^7*z^3`.
4
-
5
3
Given two polynomials, ``p`` and ``d``, there are unique ``r`` and ``q`` such that ``p = q d + r`` and the leading term of ``d`` does not divide the leading term of ``r``.
6
4
You can obtain ``q`` using the `div` function and ``r`` using the `rem` function.
7
5
The `divrem` function returns ``(q, r)``.
8
6
9
7
Given a polynomial ``p`` and divisors ``d_1, \ldots, d_n``, one can find ``r`` and ``q_1, \ldots, q_n`` such that ``p = q_1 d_1 + \cdots + q_n d_n + r`` and none of the leading terms of ``q_1, \ldots, q_n`` divide the leading term of ``r``.
10
8
You can obtain the vector ``[q_1, \ldots, q_n]`` using `div(p, d)` where ``d = [d_1, \ldots, d_n]`` and ``r`` using the `rem` function with the same arguments.
11
9
The `divrem` function returns ``(q, r)``.
12
-
13
10
```@docs
14
11
divides
15
12
div_multiple
13
+
```
14
+
15
+
Note that the coefficients of the polynomials need to be a field for `div`,
16
+
`rem` and `divrem` to work.
17
+
Alternatively, [`pseudo_rem`](@ref) or [`pseudo_divrem`](@ref) can be used
18
+
instead as they do not require the coefficient type to be a field.
19
+
```@docs
16
20
pseudo_rem
21
+
pseudo_divrem
17
22
rem_or_pseudo_rem
18
23
```
24
+
25
+
## Greatest Common Divisor (GCD)
26
+
27
+
The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) can be
28
+
obtained for integers respectively with the `gcd` and `lcm` functions.
29
+
The same functions can be used with monomials and polynomials:
0 commit comments