This is addressed here: https://github.com/JuliaMath/Polynomials.jl/pull/321
After this is merged, you might still wish to add a method to Base.show_unquoted
, as mentioned in ?Polynomials.printcoefficient
:
julia> @variables a b c
Poly(a, b, c)
julia> Polynomial([c,b,a])
Polynomial(c + b*x + a*x^2)
julia> Polynomial([c,b,a]) + Polynomial([a,b,c])
Polynomial(a + c + 2b*x + a + c*x^2)
julia> function Base.show_unquoted(io::IO, pj::Num, indent::Int, prec::Int)
if Base.operator_precedence(:+) <= prec
print(io, "(")
show(io, pj)
print(io, ")")
else
show(io, pj)
end
end
julia> Polynomial([c,b,a]) + Polynomial([a,b,c])
Polynomial((a + c) + (2b)*x + (a + c)*x^2)