Wikipedia:Reference desk/Archives/Mathematics/2020 June 4

= June 4 =

In cubic interpolation, does the cubic curve pass through the outer points?
Hello,

In diagrams I've seen e.g. http://researchgate.net/figure/Bi-cubic-spline-interpolation_fig1_280062913, the cubic curves pass through all 4 points from which the cubic curve is derived, and that's what I've drawn in this diagram. I've come to realise that if that's the case, it's not possible to guarantee that the adjacent cubic curves have continuous derivative. This image also shows the curve passing through only the middle two points: http://paulinternet.nl/?page=bicubic. Is this interpretation correct?

Thanks, cm&#610;&#671;ee&#9094;&#964;a&#671;&#954; 22:13, 4 June 2020 (UTC)
 * There are lots of different ways to do it. See for example Bézier curve. 2602:24A:DE47:BB20:50DE:F402:42A6:A17D (talk) 22:17, 4 June 2020 (UTC)


 * See also Cubic Hermite spline. -- ToE 00:43, 5 June 2020 (UTC)


 * There's an old technique which I call 'condition counting' which, while not 100% rigorous, is useful from a heuristic point of view. For a cubic polynomial there are four coefficients so you get to set four condition, and in four point interpolation you set the four conditions to be that the curve passes through the four points. For two adjacent curve you can set eight conditions, but an additional condition, namely that the derivatives match an the common point, would make 9, which is more than you're allowed. For Bezier and Hermite splines the four condition you set are the values and derivatives at the two endpoints. (For cubic curves, Bezier and Hermite splines are pretty much the same thing, just written in different ways.) So if you just have to pick the same derivatives at the endpoints to be the same and you're back down to the 8 conditions you're allowed. If you just specify that the derivatives are equal but not what they are, then you're down to 7 conditions and you need an additional condition to get a unique solution; the Hermite article gives some different choices for what this condition might be. --RDBury (talk) 03:46, 5 June 2020 (UTC)


 * Many thanks, RDBury, ToE and 2602:24A:DE47:BB20:50DE:F402:42A6:A17D. From Cubic_Hermite_spline, I see that a centripetal Catmull–Rom spline goes through all four points, if I understood it correctly. Good to know the diagram needn't be amended. Cheers, cm&#610;&#671;ee&#9094;&#964;a&#671;&#954; 11:42, 6 June 2020 (UTC)


 * To fit a piecewise cubic to a one-dimensional sequence, set the derivative at each sample to what it would be for the quadratic that fits it and the two adjacent points. Then you have for each interval four constraints: the two given points and their two derivatives.  These define a cubic.  (For the first and last intervals, one derivative is missing, so these intervals can be quadratic.)  I imagine that an analogous approach works for a bicubic, but I have not tried it. —Tamfang (talk) 00:32, 7 June 2020 (UTC)
 * Thanks, Tamfang. cm&#610;&#671;ee&#9094;&#964;a&#671;&#954; 17:42, 7 June 2020 (UTC)


 * (continuing) The logic for this is that the curve for interval $$t_1 .. t_2$$ is defined by the values at $$t_0, t_1, t_2, t_3$$, and the curve for interval $$t_2 .. t_3$$ is defined by the values at $$t_1, t_2, t_3, t_4$$, so the properties of the curve at $$t_2$$ must be determined only by the intersection of these two sets of inputs. —Tamfang (talk) 00:47, 11 June 2020 (UTC)