Sorry for being too brief. My notation was not clear. The first argument
should be a type and not an instance. This is becoming the standard way of
fitting models deriving from StatsBase and Distributions. Hence, provided
that your polynomial type is parametrised by its degree, the definition
could be something like fit(::Type{Polynomial{3}), Formula, data)
or fit(::Type{Polynomial{3}), y::Vector, x::Vector).



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

> Actually, I called it pfit(); is that name also given?
> I don't understand your signature because a polynomial will not be
> provided, only data and a degree.
>
> How can I see a list of function names in Julia, JuliaBase, ... and
> packages on the METADATa list.
> [As long as I really don't understand the namespace concept in Julia.]
>
>
> On Thursday, May 8, 2014 2:41:59 PM UTC+2, Andreas Noack Jensen wrote:
>
>> 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 <hwbor...@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.
>>>
>>>


-- 
Med venlig hilsen

Andreas Noack Jensen

Reply via email to