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 dot methods #110

Closed
stevengj opened this issue Mar 20, 2017 · 4 comments
Closed

incorrect dot methods #110

stevengj opened this issue Mar 20, 2017 · 4 comments

Comments

@stevengj
Copy link
Member

The module defines three dot methods:

dot{T<:Number,S}(p::Poly{S}, c::T) = p * c
dot{T<:Number,S}(c::T, p::Poly{S}) = c * p
dot(p1::Poly, p2::Poly) = p1 * p2

which make no sense to me.

dot should define an inner product, which means that it should return a number (or whatever the coefficient type of the polynomial is). For polynomials, you would normally define the dot product to be some kind of integral. But since there are many such definitions and no single canonical choice, it would be better to leave this undefined.

@jverzani
Copy link
Member

That's my fault. I wanted a unicode operation for printing, so I could copy and paste the printed output of polynomials. I noticed, \cdot could be used if I overloaded these. I'll fix to print with * and drop these, I don't think they are used otherwise.

@stevengj
Copy link
Member Author

Thanks! I noticed this in my class when we were covering orthogonal polynomials, and I wanted to show some examples with Polynomials.jl by defining a proper dot product.

@stevengj
Copy link
Member Author

Another thing I noticed is that it would be nice to have a polyint(p, a, b) method to compute the definite integral on [a,b].

@jverzani jverzani mentioned this issue Mar 21, 2017
@jverzani
Copy link
Member

jverzani commented Mar 21, 2017 via email

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