Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect evaluation at objects that are not numbers #189

Closed
cafaxo opened this issue Jan 1, 2020 · 2 comments
Closed

Incorrect evaluation at objects that are not numbers #189

cafaxo opened this issue Jan 1, 2020 · 2 comments

Comments

@cafaxo
Copy link

cafaxo commented Jan 1, 2020

Suppose we have a polynomial p = a_0 x^0 + a_1 x^1 + ... + a_n x^n where the a_i are in a ring R. Then I would expect p(α) = a_0 α^0 + a_1 α^1 + ... + a_n α^n to hold for all α in a ring S where R is a subring of S.

This is currently not the case. Example:

julia> Poly([0,0,1])([0 1; 0 0])
2×2 Array{Int64,2}:
 0  1
 0  0

but [0 1; 0 0]^2 == [0 0; 0 0].

@jverzani
Copy link
Member

jverzani commented Jan 2, 2020

This is due to this definition polyval(p::Poly, v::AbstractArray) = map(x->polyval(p, x), v) which is basically doing p.(A) when A is a matrix. In #179 this call is an error. I wonder if it makes better sense to change the definition for p(A) to what you are expecting, as that seems natural. In #179 it seems to only require changing a + to a .+.

@jverzani
Copy link
Member

jverzani commented Apr 8, 2020

Closed by #196

@jverzani jverzani closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants