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

RFC: add evalpoly function, mirroring @evalpoly macro #7186

Closed
wants to merge 1 commit into from

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Jun 9, 2014

As mentioned in #7146, since we have an @evalpoly(z, c...) it makes sense to also have a evalpoly(z, c), analogous to Matlab's polyval but with the arguments in reverse order and the coefficients in ascending order by power of z.

We could alternatively mirror Matlab and store the coefficients in descending order, in which case we might as well swap the arguments and call it polyval. However, this issue seems to have been discussed in vtjnash/Polynomial.jl#5, and the consensus seems to have been to reject Matlab's ordering, resulting in @Keno's Polynomials.jl fork.

@stevengj
Copy link
Member Author

stevengj commented Jun 9, 2014

There's also the question of whether this should use * or .*, where the latter is used in Polynomial.jl. Using .* (and presumably .+ for consistency) allows us to evaluate a polynomial with vector-valued coefficients at a vector of points, but I was uncomfortable with using it in a generic evalpoly. First, my feeling is that evalpoly should work for any types that define + and * in such a way as to form a field (i.e. satisfying a distributive law); they shouldn't have to define .* (which has no default meaning for non-Number types). Second, this isn't Matlab and I'm not sure it's a good idea to vectorize evaluation of multiple polynomials in that way (on the other hand, it is convenient to evaluate a single scalar-coefficient polynomial at a vector of points, and I added a method for that).

@jiahao jiahao force-pushed the master branch 3 times, most recently from 6c7c7e3 to 1a4c02f Compare October 11, 2014 22:06
@doy
Copy link

doy commented Oct 27, 2014

Any progress on this?

@stevengj
Copy link
Member Author

There doesn't seem to be much demand for such a function.

@IainNZ
Copy link
Member

IainNZ commented Jan 21, 2015

Cross-reference to Stackoverflow question along these lines: http:https://stackoverflow.com/questions/28077057/julia-evalpoly-macro-with-varargs/

@stevengj
Copy link
Member Author

Rebased this in case anyone is still interested. (Probably should be updated to use muladd too.)

@stevengj
Copy link
Member Author

Updated to use muladd.

@stevengj
Copy link
Member Author

Travis failure on OSX seems unrelated: "The job exceeded the maxmimum time limit for jobs, and has been terminated."

@vtjnash
Copy link
Sponsor Member

vtjnash commented Jun 26, 2019

As @stevengj said, doesn't seem like interest in having this in Base. To me, seems like a better match for a package, so I've opened JuliaMath/Polynomials.jl#169. I assume Nemo (http:https://nemocas.org/index.html) already has it?

@vtjnash vtjnash closed this Jun 26, 2019
@stevengj stevengj mentioned this pull request Sep 10, 2019
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

Successfully merging this pull request may close these issues.

None yet

5 participants