-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
# Division | ||
|
||
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`. | ||
|
||
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``. | ||
You can obtain ``q`` using the `div` function and ``r`` using the `rem` function. | ||
The `divrem` function returns ``(q, r)``. | ||
|
||
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``. | ||
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. | ||
The `divrem` function returns ``(q, r)``. | ||
|
||
```@docs | ||
divrem | ||
div | ||
rem | ||
divides | ||
div_multiple | ||
``` | ||
|
||
Note that the coefficients of the polynomials need to be a field for `div`, | ||
`rem` and `divrem` to work. | ||
Alternatively, [`pseudo_rem`](@ref) or [`pseudo_divrem`](@ref) can be used | ||
instead as they do not require the coefficient type to be a field. | ||
```@docs | ||
pseudo_rem | ||
pseudo_divrem | ||
rem_or_pseudo_rem | ||
``` | ||
|
||
## Greatest Common Divisor (GCD) | ||
|
||
The Greatest Common Divisor (GCD) and Least Common Multiple (LCM) can be | ||
obtained for integers respectively with the `gcd` and `lcm` functions. | ||
The same functions can be used with monomials and polynomials: | ||
```@docs | ||
gcd | ||
AbstractUnivariateGCDAlgorithm | ||
GeneralizedEuclideanAlgorithm | ||
SubresultantAlgorithm | ||
``` | ||
Internal functions of the `gcd` algorithm: | ||
```@docs | ||
isolate_variable | ||
primitive_univariate_gcd! | ||
univariate_gcd | ||
content | ||
primitive_part | ||
primitive_part_content | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters