diff --git a/Project.toml b/Project.toml index 2e3fe927..555ba30a 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "Polynomials" uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" license = "MIT" author = "JuliaMath" -version = "2.0.18" +version = "2.0.19" [deps] Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5" @@ -17,6 +17,7 @@ RecipesBase = "0.7, 0.8, 1" julia = "1" [extras] +DualNumbers = "fa6b7ba4-c1ee-5f82-b5fc-ecf0adba8f74" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" OffsetArrays = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" @@ -24,4 +25,4 @@ SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [targets] -test = ["LinearAlgebra", "SparseArrays", "OffsetArrays", "SpecialFunctions", "Test"] +test = ["DualNumbers", "LinearAlgebra", "SparseArrays", "OffsetArrays", "SpecialFunctions", "Test"] diff --git a/docs/src/index.md b/docs/src/index.md index 99b62d9f..1e0644a1 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -664,7 +664,7 @@ Also, mixing types can result in unspecific symbols, as this example shows: ```jldoctest natural_inclusion julia> [1 p; p 1] + [1 2one(q); 3 4] # array{P{T,:x}} + array{P{T,:y}} -2×2 Matrix{Polynomial{Int64, X} where X}: +2×2 Matrix{Polynomial{Int64}}: Polynomial(2) Polynomial(3 + 2*x) Polynomial(4 + 2*x) Polynomial(5) ``` diff --git a/src/pade.jl b/src/pade.jl index ba16d46a..3b18503a 100644 --- a/src/pade.jl +++ b/src/pade.jl @@ -92,6 +92,7 @@ Evaluate the Pade approximant at the given point. ```jldoctest pade julia> using Polynomials, Polynomials.PolyCompat, SpecialFunctions + julia> p = Polynomial(@.(1 // BigInt(gamma(1:17)))); julia> pade = Pade(p, 8, 8); diff --git a/src/rational-functions/common.jl b/src/rational-functions/common.jl index 7c656ede..be1b1357 100644 --- a/src/rational-functions/common.jl +++ b/src/rational-functions/common.jl @@ -487,7 +487,10 @@ The residues are found using this formula: (From page 5-33 of above pdf) -```jldoctest +```jldoctest rational_functions +julia> using Polynomials + + julia> s = variable(Polynomial, :s) Polynomial(1.0*s) @@ -496,6 +499,7 @@ julia> pq = (-s^2 + s + 1) // ((s-1) * (s+1)^2) julia> d,r = residues(pq); + julia> d Polynomial(0.0) @@ -516,8 +520,10 @@ julia> for (λ, rs) ∈ r # reconstruct p/q from output of `residues` end end + julia> p′, q′ = lowest_terms(d); + julia> q′ ≈ (s-1) * (s+1)^2 # works, as q is monic true diff --git a/src/show.jl b/src/show.jl index 7c716e0f..48b26ef7 100644 --- a/src/show.jl +++ b/src/show.jl @@ -213,7 +213,8 @@ shows how `Dual` objects of `DualNumbers` may be printed with parentheses. ```jldoctest -julia> using DualNumbers +julia> using Polynomials, DualNumbers + julia> Polynomial([Dual(1,2), Dual(3,4)]) Polynomial(1 + 2ɛ + 3 + 4ɛ*x) @@ -222,6 +223,7 @@ Polynomial(1 + 2ɛ + 3 + 4ɛ*x) ```jldoctest julia> using DualNumbers, Polynomials + julia> function Base.show_unquoted(io::IO, pj::Dual, indent::Int, prec::Int) if Base.operator_precedence(:+) <= prec print(io, "(") @@ -232,6 +234,7 @@ julia> function Base.show_unquoted(io::IO, pj::Dual, indent::Int, prec::Int) end end + julia> Polynomial([Dual(1,2), Dual(3,4)]) Polynomial((1 + 2ɛ) + (3 + 4ɛ)*x) ```