I'd suggest fit(Polynomial, data) instead of polyfit(data). The generic fit
function is defined in StatsBase.


2014-05-08 14:23 GMT+02:00 Hans W Borchers <hwborch...@gmail.com>:

> Because I was a (tiny) bit unsatisfied with the Polynomial package,
> I wrote my own polynomial functions, like
>
>   - polyval() to be applied to vectors as well as polynomial types
>   - roots() that uses the Matlab order in constructing the companion
>       matrix and finding all roots
>   - horner() that utilizes the Horner scheme to compute the value
>       and the derivative of the polynomial at the same time
>       (useful for a specialized version of Newton's algorithm)
>   - a deflated Horner function to return p(x) = (x - x0)*q(x) when
>       x is a root of polynomial p
>   - polyfit() for fitting polynomials to data, etc.
>
> I think a polyfit() function should in any case be a part of a polynomial
> package. (Is such a function contained in any other package?)
>
> Besides that an implementation of the Muller algorithm for computing zeros
> of
> polynomials might be helpful. Or the calculation of the number of real
> roots
> of a polynomial in an interval (Descartes' and Sturm's rules). There is
> more
> interesting numerical stuff that could be part of such a polynomial
> package.
>
>
> On Thursday, May 8, 2014 3:42:03 AM UTC+2, Tony Kelman wrote:
>>
>> Yes, Polynomial is using a different convention than Matlab or what you
>> used below in how it constructs the companion matrix. Polynomials.jl uses
>> yet another convention. Both produce more accurate (comparable to Matlab)
>> results for the roots of the Wilkinson polynomial if you just switch the
>> indices during construction of the companion matrix. See
>> https://github.com/vtjnash/Polynomial.jl/blob/
>> master/src/Polynomial.jl#L350-L353 for Polynomial, or https://github.com/
>> loladiro/Polynomials.jl/blob/master/src/Polynomials.jl#L324-L325 for
>> Polynomials.
>>
>> I think the intent (see https://github.com/vtjnash/Polynomial.jl/issues/5)
>> is to deprecate Polynomial and switch the coefficient order by developing
>> under the Polynomials name going forward, but Keno's probably been too busy
>> to register the new package, turn on issues, etc. I'm doing some work on
>> piecewise stuff in a branch of Polynomials, I might just adopt the package.
>> I know David de Laat has put together packages for sparse multivariate
>> polynomials https://github.com/daviddelaat/MultiPoly.jl and orthogonal
>> polynomials https://github.com/daviddelaat/Orthopolys.jl, don't think
>> they're registered but it might make sense to eventually unify all of these
>> into the same package.
>>
>
>



-- 
Med venlig hilsen

Andreas Noack Jensen

Reply via email to