[SciPy-user] SciPy cubic interpolation coefficients
Sun Jun 21 16:52:27 CDT 2009
On Sun, Jun 21, 2009 at 5:28 PM, <firstname.lastname@example.org> wrote:
> On Sun, Jun 21, 2009 at 4:13 PM, Celvin<email@example.com> wrote:
>> firstname.lastname@example.org @ Jun, 21, 2009 09:23PM
>>> Did you try
>> >From my experiments with interpolate splines, I would think this
>>> provides what you want. But the documentation is still a bit sparse.
>> Yes, I did try using UnivariateSpline. Apart from being "more off"
>> than using splrep with a smoothing factor of 0, get_coeffs() also
>> returns an 1-d array, with far too few coefficients.
>> Assuming a signal with about 390 data points, I also expect about
>> 390 coefficients (which is consistent with what I get using
>> signal.cspline1d for example, but I need 4 arrays, not just one).
>> I would expect coefficients to be a list of shape
>> coeff = [ [a0, b0, c0, d0],
>> [a1, b1, c1, d1],
>> [a2, b1, c2, d2],
>> [an, bn, cn, dn],
>> but I am only able to obtain 1-d array of coefficients, no matter what
>> function or module I use.
>> ...is basically what I'm looking for. I used to do the matrix
>> calculations for Si(x) myself using C++, but I'd prefer to somehow get the
>> coefficients using numpy/scipy and not use an extension.
>> Any further ideas?
> interpolate.spalde gives you the derivatives of as a 1 by 4 array
> for each point
> given it's a cubic function, it should be possible to recover the coefficients
> something like
> coeff = np.vstack(interpolate.spalde(x,tck))*[1,1,0.5,1/3.]
I don't think that makes any sense. (sleep deprivation)
> I have no idea yet, whether this actually does what you want.
> If you find out how it works, it would be good to get an example since
> figuring out the splines with the current documentation is pretty
More information about the SciPy-user