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

docs: advertise composition of polynomials #509

Open
nsajko opened this issue Jul 19, 2023 · 1 comment
Open

docs: advertise composition of polynomials #509

nsajko opened this issue Jul 19, 2023 · 1 comment

Comments

@nsajko
Copy link
Contributor

nsajko commented Jul 19, 2023

Searching the docs for "composition" or "substitution" doesn't turn up anything. The same code path designed for evaluating a polynomial seems to work fine for composing two polynomials together, though:

julia> using Polynomials

julia> p = Polynomial([0, 1])
Polynomial(x)

julia> q = Polynomial(Float64[0, 0.5])
Polynomial(0.5*x)

julia> r = Polynomial(Float64[0, 2])
Polynomial(2.0*x)

julia> q(r) == r(q) == p == p(p) == p(p(p)) == p(p(p(p)))
@jverzani
Copy link
Member

Yes, one means of converting from one polynomial type to another is along the lines of

convert(P, q::Q) = q(variable(P)) (P,Q some polynomial type)

But perhaps (given your other issue) we should have a special implementation for (p::P)(q::Q) beyond evalpoly.

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