Wikipedia:Reference desk/Archives/Mathematics/2015 November 15

= November 15 =

piecewise polynomial least squares
(I tried math.stackexchange and got no response for a week. Boo hoo.)

I have in mind a project involving a least-squares fit using piecewise polynomials; at a finite number of known arguments xj, the kjth derivative is discontinuous.

How many basis functions are needed? My guess is: xn for 0≤n&lt;min(k), and then, for each j,n such that kj ≤ n ≤ the maximum degree, a pair of functions which are zero on one side and (x-xj)n on the other. Is that right?

In general, I welcome any pointers that might reduce the number of wheels I'll reinvent. —Tamfang (talk) 07:00, 15 November 2015 (UTC)


 * Just trying to understand the problem here. You are trying to create a spline composed of multiple polynomial arcs, right ?  The adjacent arc endpoints must have point continuity, of course, but how about tangent & curvature continuity, etc. ?  Since you are using least squares method, I assume you don't need an exact fit.  So, how many points would each arc run through ?  (Just offhand, this method sounds like it would generate an extremely "lumpy" spline.)  I assume you already know how the number of constraints relates to the degree of the polynomial ? StuRat (talk) 07:12, 15 November 2015 (UTC)


 * Sure, let's say I'm trying to create a spline composed of multiple polynomial arcs, and the degree of continuity is kj-1. Maybe I like it runny lumpy; if it's lumpier than I like, I'll increase kj.  Rather than discrete points, my input is piecewise continuous, so the algo involves integrals rather than sums.  Number of constraints, in the sense I think you mean, is not meaningful here. —Tamfang (talk) 08:51, 15 November 2015 (UTC)


 * If the function is on the domain $$[x_0,x_m]$$, and the polynomials are of degree at most d, and for $$1\le jx_j$$. This also means their number can be rewritten as $$\sum_{j=0}^{m-1}(d+1-k_j)$$. -- Meni Rosenfeld (talk) 10:06, 15 November 2015 (UTC)


 * Hm ... thanks, yes, I think that does work; the k0=0 is a good gimmick (removing some special cases from the description). You've saved me some redundancy; I was thinking that for each discontinuity I'd need pairs of functions: zero on the left and (x-xj)n on the right, (x-xj)n on the left and zero on the right. —Tamfang (talk) 03:51, 24 November 2015 (UTC)


 * Meni, thanks again; see result at . —Tamfang (talk) 22:51, 8 December 2015 (UTC)


 * This is above my head (I don't know why I even look at this notice board!) but does Savitzky–Golay filter help? Thincat (talk) 09:00, 20 November 2015 (UTC)


 * That's interesting, but no. —Tamfang (talk) 03:03, 22 November 2015 (UTC)