vtjnash / Polynomial.jl

Polynomial manipulations
Other
6 stars 10 forks source link

exponentiation does not work #36

Closed AlexanderKoshkarov closed 7 years ago

AlexanderKoshkarov commented 7 years ago

Hey, here is the issue I encountered

using Polynomials
x = poly([0])
(x-1)^2  # 1 - 2∙x + x^2 # works good
(x-0.1)^2  
InexactError()

 in +(::Polynomials.Poly{Int64}, ::Float64) at /home/kosh/.julia/v0.5/Polynomials/src/Polynomials.jl:256
 in -(::Polynomials.Poly{Int64}, ::Float64) at /home/kosh/.julia/v0.5/Polynomials/src/Polynomials.jl:249
 in execute_request(::ZMQ.Socket, ::IJulia.Msg) at /home/kosh/.julia/v0.5/IJulia/src/execute_request.jl:157
 in eventloop(::ZMQ.Socket) at /home/kosh/.julia/v0.5/IJulia/src/eventloop.jl:8
 in (::IJulia.##13#19)() at ./task.jl:360
vtjnash commented 7 years ago

You can't subtract 0.1 and form a polynomial with Integral coefficients

AlexanderKoshkarov commented 7 years ago

Well, it still could be a nice feature to make polynomilas this way. for example (x-0.1)*(x-0.1) works, so why would not (x-0.1)^2. By the way, I probably should have submitted it there https://github.com/Keno/Polynomials.jl Should I resubmit?

AlexanderKoshkarov commented 7 years ago

ah it seems you cannot do (x-0.1)*(x-0.1) either, sorry it seems I just do not understand how they work.

AlexanderKoshkarov commented 7 years ago

I see the problem now "You can't subtract 0.1 and form a polynomial with Integral coefficients"

x = poly([0.0])
(x-0.1)^2

works just fine