vtjnash / Polynomial.jl

Polynomial manipulations
Other
6 stars 10 forks source link

Allow polynomial definitions using e.g. `(:yo + 1)^2` #32

Open LaurenceA opened 10 years ago

LaurenceA commented 10 years ago

It is nice, and intuitive to define polynomials using,

(:yo + 1)^2

which is easy to do by overloading mathematical operators to take symbols and return polynomials, e.g.

for f = [+, -, *, /]
    f(n::Number, s::Symbol) = f(n, Poly([1, 0], string(s)))
    f(s::Symbol, n::Number) = f(Poly([1, 0], string(s)), n)
end