vtjnash / Polynomial.jl

Polynomial manipulations
Other
6 stars 10 forks source link

Interpolating polynomials #31

Open pwl opened 10 years ago

pwl commented 10 years ago

I have been working on differential algebraic equation integrator which makes a heavy use of interpolating polynomials. At this point I have implemented all the necessary functions myself as a part of my package, but I was wandering if it would be possible to move some of the functionality to a more suitable package. The functions that I am currently using [1] are:

  1. Return the value of an interpolating polynomial p at the point x0. The interpolating polynomial p is constructed from the values y at points x, i.e. p(x[i])==y[i].

    InterpolateAt(x::Vector{T},y::Vector{T},x0::T)
  2. Analogous function but for the first derivative of p

    InterpolateDerivativeAt(x::Vector{T},y::Vector{T},x0::T)
  3. Return the coefficient in front of highest power in the interpolating polynomial. (or in other words if p(x)=a_{k-1}*x^{k-1}+...+a_{1}*x+a_{0} return a_{k-1}).

    interpolateHighestDerivative(x::Vector{T}, y::Matrix{T})

From what I see, you store all polynomials in the same way, as coefficients [a_0,a_1,...,a_{k-1}], in the case of interpolating polynomials turning to a_k representation may not be the optimal case, as you rarely need to compute the coefficients from x_k and y_k to evaluate the polynomial at a given point (for example see the last formula in [2]). The one exception is point 3. of my usage example, but a_{k-1} can be easily and efficiently computed directly from x_k and y_k.

Would it be possible to integrate this functionality into Polynomial.jl, or is it too far away from your vision for this package?

[1] For my (pretty straight forward) implementation see https://github.com/pwl/DASSL.jl/blob/master/src/DASSL.jl#L595 [2] http://en.wikipedia.org/wiki/Polynomial_interpolation#Constructing_the_interpolation_polynomial

vtjnash commented 10 years ago

sounds good to me. my notion for this package was simply to contain all Polynomial-related functionality that didn't imply the development of a CAS

however, loladiro/Polynomials.jl is where the future development will occur (because of the better ordering of coefficients)