Skip to content

Commit e156428

Browse files
authored
Issue 320 (#321)
* change printing to work with Symbolics; close #320 * version bump [ci skip]
1 parent 815ab1a commit e156428

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name = "Polynomials"
22
uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45"
33
license = "MIT"
44
author = "JuliaMath"
5-
version = "2.0.1"
5+
version = "2.0.2"
66

77
[deps]
88
Intervals = "d8418881-c3e1-53bb-8760-2df7ec849ed5"

docs/src/extending.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ As always, if the default implementation does not work or there are more efficie
2525
| `domain` | x | Should return an [`AbstractInterval`](https://invenia.github.io/Intervals.jl/stable/#Intervals-1) |
2626
| `vander` | | Required for [`fit`](@ref) |
2727
| `companion` | | Required for [`roots`](@ref) |
28+
| `fromroots` | | By default, will form polynomials using `prod(variable(::P) - r)` for reach root `r`|
2829
| `*(::P, ::P)` | | Multiplication of polynomials |
2930
| `divrem` | | Required for [`gcd`](@ref)|
3031
| `one`| | Convenience to find constant in new basis |

src/polynomials/standard-basis.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ abstract type StandardBasisPolynomial{T,X} <: AbstractPolynomial{T,X} end
22

33
function showterm(io::IO, ::Type{<:StandardBasisPolynomial}, pj::T, var, j, first::Bool, mimetype) where {T}
44

5-
if iszero(pj) return false end
5+
if pj === zero(T) return false end
66

77
pj = printsign(io, pj, first, mimetype)
88

9-
if !(pj == one(T) && !(showone(T) || j == 0))
9+
if !(pj === one(T) && !(showone(T) || j == 0))
1010
printcoefficient(io, pj, j, mimetype)
1111
end
1212

src/show.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ hasneg(::Type{T}) where {T} = false
1313
isneg(pj::T) where {T} = hasneg(T) && pj < zero(T)
1414

1515
"Make `pj` positive if it is negative. (Don't call `abs` as that may not be defined, or appropriate.)"
16-
aspos(pj::T) where {T} = (hasneg(T) && isneg(pj)) ? -pj : pj
16+
aspos(pj::T) where {T} = (hasneg(T) && isneg(pj)===true) ? -pj : pj
1717

1818
"Should a value of `one(T)` be shown as a coefficient of monomial `x^i`, `i >= 1`? (`1.0x^2` is shown, `1 x^2` is not)"
1919
showone(::Type{T}) where {T} = true
@@ -163,7 +163,7 @@ function showterm(io::IO, ::Type{AbstractPolynomial}, pj::T, var, j, first::Bool
163163
## print the sign
164164
## returns aspos(pj)
165165
function printsign(io::IO, pj::T, first, mimetype) where {T}
166-
neg = isneg(pj)
166+
neg = hasneg(T) && isneg(pj) === true
167167
if first
168168
neg && print(io, showop(mimetype, "l-")) #Prepend - if first and negative
169169
else

0 commit comments

Comments
 (0)