Talk:Spline (mathematics)

What is the difference between a cubic spline and a wilson fowler spline in case CAD??
- —Preceding unsigned comment added by 203.199.60.145 (talk) 03:42, 9 July 2008 (UTC)


 * Forgive me if my reply smacks of creeping bureaucracy, but an article talk page is not the place to ask a general content question. The 'ask a librarian' style questions of this sort are best placed at the Reference desk. Volunteers committed to helping readers with general questions work there, not here.
 * Talk pages are not article-specific help desks; they are places where editors can discuss ways to improve articles. The talk page guidelines explain in particular the intended purpose of these pages. Sometimes, when an article passage lacks clarity or is incomplete, an editor might pose a question that seems superfically like a content question, but such arises because a passage may be so unclear an editor needs to ask what is about before deciding on how best to rephrase it.
 * That said, further forgive my arrogant pedantry, but your question asks about the difference between a general category and an instance in that category. A Wilson-Fower spline is a cubic spline; it inherits all the aspects of a spline assembled from cubic segments. Your question is a bit like asking 'What is the difference between a planet and Earth?'
 * Permit me to hazard a guess at your intended question, 'What is the difference between parametric cubic polynomial splines — the sort mainly discussed in the article — and Wilson-Fowler splines?' This is still not exactly a 'What is the difference between Mars and Earth' question, but it does permit some distinctions.
 * By their construction, Wilson-Fowler splines are planar curves that alway pass through their data points. The splines discussed in this article can be constrained in this manner, but, generally, do not necessarily pass through their defining data points and may curve through three dimensions.
 * With Wilson-Fowler splines, parameterization is localized to each segment. The splines discussed in this article generally are parameterized along the entire real line.
 * Wilson-Fowler splines are a type of spline exhibiting G2 continuity. That is, spline joins are continuous through the second derivative of $$ \frac{d^2 y}{dx^2} \,\!$$ — it is twice differentiable with respect to the curve's arc length; discontinuity at the joins occur at higher derivatives. Again, suitably constrained cubic polynomial splines may have this property as well, but, being a more general concept than the very specific Wilson-Fowler spline, discussion with cubic polynomial splines customarily entail differentiation with respect to the parameter — so-called Cn continuity.
 * Wilson-Fowler splines were devised some time ago — in the 1960s — as a model for wooden splines, which, when bent, assume an energy minimizing shape. While intended for general use, they currently occupy only specialized niches.


 * Containing trigometric terms, Wilson-Fowler splines are not strictly polynomial splines


 * In a nutshell: Wilson-Fowler splines are planar, cubic spline curves with twice-differentiable continuity with respect to their own arc length; they are not generally written with respect to a global parameter. They pass through the points that define them. Hope this helps, but in the future, please direct this kind of question to the reference desk. When you do so, please take care on phrasing the question carefully and let them know what articles you have been reading. Since you won't be (and shouldn't be) posing a question on content on an article talk page, you need to provide the person helping you with some context. Thanks. Gosgood (talk) 23:07, 10 July 2008 (UTC)


 * N. B. Hoschek, Lasser, and Schumaker's Fundamentals of Computer Aided Geometric Design has a technical definition of a Wilson-Fower spline. Gosgood (talk) 23:07, 10 July 2008 (UTC)

The cubic spline in the article differs from the Fowler-Wilson spline in that the former is a spline function while the latter is a spline curve. — Preceding unsigned comment added by Deboor (talk • contribs) 03:44, 26 June 2011 (UTC)

Bezier curve not a spline ?
I did a complete rewrite of the article. A Bezier curve is not a spline. MathMartin 18:02, 19 Sep 2004 (UTC)

What is the difference? 20 Mar 05

To explain what a spline is I think it is best to contrast splines with polynomials. Splines are then defined as piecewiese polynomials (of course you can consider a polynomial a spline with only one piece). After this difference is clear you can discuss different forms of the polynomials used to construct the spline (like Bernstein form, Hermite form, Monomial form etc.).

So although in some sense a Bezier curve is a spline I think it is clearer not use it as a central example in the main spline article. MathMartin 16:04, 21 Mar 2005 (UTC)

I strongly agree. A Bezier curve may be a smaller portion of a spline, and one might argue it is a spline made of one curve, but it is a horrible example for the article 'Spline'. Mgsloan 23:13, 15 March 2007 (UTC)

A Bezier curve is simply an image of a parametric polynomial. One may argue on strictly technical grounds that it is a piece-wise polynomial spline consisting of one piece, but I find such arguments more clever than informative to the reader. There is a better image than Image:Splined epitrochoid.png which does illustrate a piece-wise degree three polynomial spline and a piece-wise degree-one curve, each approximating a single degree-six curve. While it was drawn for a different purpose, I find it less misleading than the present image, and will put it in place

A Bezier curve is, first and foremost, a curve rather than a (scalar-valued) function; it is, more precisely, a way to represent certain curves in way that makes retrieval of certain information easy and also helps when putting together smooth curves from parametrit polynomial pieces. I agree that any curve as an illustration in an article on spline functions is misleading, as the distinction between curves and (scalar-valued) functions is a fundamental one. Deboor (talk) 03:51, 26 June 2011 (UTC) after I post this note. Gosgood (talk) 02:08, 26 June 2008 (UTC)

History section
The greater part of the section History is copied verbatim from a post to the NA Digest. Can anybody confirm that we have permission to do this? I also asked the anonymous contributor for clarification at User talk:205.250.40.97. -- Jitse Niesen (talk) 16:16, 6 October 2005 (UTC)


 * Resolved after some e-mails. -- Jitse Niesen (talk) 12:51, 18 October 2005 (UTC)

This page needs images!
TERdON


 * I have an Excel spreadsheet that calculates a cubic spline, and it produces a graph showing a comparison of the cubic spline and a straight-line. I could always scan this image, but if anyone knows a better way to do something with this spreadsheet to produce a good clear image, I am glad to send you my file or to try it myself. Note: I have very little computer skills - if you want me to do something, you'll have to tell me step by step!

Sarum blue 14:58, 2 February 2006 (UTC) Sarum Blue

Definition: Closed subintervals vs. Half-open subintervals
In the Definition, some people want to use closed subintervals $$[t_i, t_{i+1}]$$ of $$[a, b]$$ (option 1), while others want to use half-open subintervals $$[t_i, t_{i+1})$$ of $$[a, b]$$ (option 2a) or of $$[a, b)$$ (option 2b).

The differences between these options are NOT merely cosmetic! It is important to note why (1) is so mathematically different from (2a) and (2b). Under (1), any two consecutive subintervals will share a knot, so they are not disjoint. In other words, all subintervals (together) do not constitute a partition of $$[a, b]$$, but only a covering (and not a packing). All this implies that two neighboring polynomial pieces will, under (1), always match continuously over the knot in common. This will exclude step functions, for example, or any spline with discontinuities for that matter.

If we are to allow discontinuous splines, we are motivated to use half-open subintervals. Option (2b) would then be the most rigorous, while (2a) offers an attractive compromise between (1) and (2b).

Abstract: Subject Classification
The abstract used to start with "In the mathematical subfield of numerical analysis, ...", and "In the computer science subfields of computer-aided design and computer graphics, ...".

Apparently this formulation was not clear to all, since an editor [07:55, 18 October 2006 211.29.178.155] changed "subfield" to "field" since it "Doesn't make sense to talk of a *sub*field without mentioning a larger encompassing field!".

Since I contributed the original formulation, let me try to clarify what I intended by it. I thought it was clear that the "encompassing fields" were "mathematics" on the one hand and "computer science" on the other, while the SUBfields were "numerical analysis" on the one hand, and "computer-aided design" and "computer graphics" on the other. If anyone knows how to formulate this more clearly, please feel free to post your proposition.

For your information, these (sub)fields were taken from the 2000 Mathematical Subject Classification (MSC2000) of the American Mathematical Society (AMS): See http://www.ams.org/msc/

Definition: Knots are they points, values, vertices, vectors, or ... ?
Since this question was raised by an editor [09:41, 28 September 2006 SpaceDude (knots are not points, they are scalar values? would like confirmation on this... how can inequality be used on points?)], let me try to provide a short answer.

In the article's definition of splines, knots are elements of $$\mathbb{R}$$. Whether you call them "points", "vectors", "values", or ... depends on what you mean by $$\mathbb{R}$$ in the first place.

If you equip the set $$\mathbb{R}$$ with the usual structure of an affine space, you can call the knots "points", to emphasize the geometric view of $$\mathbb{R}$$ as a manifold. You can then consider "weighted averages" of knots. Such averages are needed by the "de Boor algorithm".

If you equip the set $$\mathbb{R}$$ with the usual real vector space structure, you can call the knots "vectors", to emphasize the differential-geometric view of $$\mathbb{R}$$ as a tangent space/line. You can then consider "sums" and "real multiples" of knots. Very useful for uniform partitions and Fourier techniques to construct B-splines ("box splines").

If you equip the set $$\mathbb{R}$$ with the usual structure of a field, you can call the knots "values", to emphasize the algebraic view of $$\mathbb{R}$$ as a space of numbers. You can then consider "sums", "differences", "products" and "quotients" of knots. Very useful for the divided difference approach to B-splines.

If you equip the set $$\mathbb{R}$$ with the usual ordering structure, you could call the knots "vertices" or "exposed points", to empasize the convexity of the subintervals. You can then consider "in-betweenness" of knots and whether any knot is larger than another one. Needed by polyhedron projection techniques to construct B-splines geometrically ("polyhedral splines", "box splines", "simplex splines", "cone splines").

And so on ...

Now, the set $$\mathbb{R}$$ is frequently assumed to be equiped with SEVERAL such structures at the same time -- this is not contradictory as long as the structures are compatibile with each other (which they are), so they can be combined meaningfully. This is how "inequalities" can be used on "points": take $$\mathbb{R}$$ with the usual affine structure and the usual ordering structure combined.

But the assumed (combined) structure(s) are not always stated explicitly though. Fortunately, it is not difficult to work backwards and recover the needed structure(s) on $$\mathbb{R}$$ from the way the elements of $$\mathbb{R}$$ are used.

So what are they then, these knots. Are they points? vectors? values? vertices? ... It depends on the writer.

My impression is that computer scientists prefer to maximally equip $$\mathbb{R}$$ with all structures possible, so they can do what they want with its elements (without having to bother about what they mean by $$\mathbb{R}$$) and can call them how they want: "vectors", "values", "points", ... (Similarly, in "3D" they can speak of "points" and "vectors" -- although CAGD writers definitely prefer "vectors").

Mathematicians, out of economy and clarity, would equip $$\mathbb{R}$$ only minimally: they wouldn't give it a particular structure unless it is really needed.

For example, in CAGD text books one speaks of "vectors" even if the origin has no special role, so (affine) "points" would do for mathematicians.

To conclude, knots in $$\mathbb{R}$$ can be called "vectors", "values", "points", "vertices", ...

Nevertheless, the term "value" has the disadvantage that it is (so far) not used in multivariate spline theory (not discussed here).

To my way of thinking, knots are parameters connected with the representation of splines as a weighted sum of B-splines. Since B-splines are not mentioned in this article, knots should also not be mentioned. The points where two polynomial pieces join used to be called (e.g., by Birkhoff) "joints" but, these days, the term 'breakpoint' or 'break' is used for such a locus. Use of 'points' for them should be discouraged since one usually deals with data points and only their first coordinate, the data site, gives rise to a break in cubic spline interpolation, while its second coordinate, the data value, is the value one hopes to match at that site by the interpolating spline. Deboor (talk) 03:37, 26 June 2011 (UTC)

Yes, there are many structures possible on $ \mathbb{R} $ and I am sure that there are applications that require each. However, it is not clear in the article what underlying set a "knot" belongs to, nor are they defined anywhere. This should be fixed. 128.32.92.238 (talk) 19:54, 23 September 2013 (UTC)

examples
Hi the example is ok but need to explicitly show the smoothness vector $$\mathbf r$$. SNx 20:11, 4 December 2006 (UTC)

Spline smoothness
In the example section, it is said that second derivative should be set to 0 at end points so that the spline be a straight line outside of the interval, while not disrupting its smoothness. This forces the spline to be straight at end points, but to force smoothness, one need to get the same slope on both sides of the end points, so $$S'_{1}(a) \, = S'_{2}(a)$$ where $$S_{1}$$ and $$S_{2}$$ stands for the two polynomials each side of $$a$$. 132.246.2.25 21:32, 23 July 2007 (UTC)Matthieu Deveau


 * It is mentioned that the natural cubic spline is of "continuity" C2. However, previously in the text, the term "smoothness" has always been used for the measure Cn. If these two are synonymous, the slope equality is thus already assumed. It wouldn't hurt, however, mentioning it explicitly.
 * So: are smoothness and continuity equal? If so, should both terms be used where Cn is defined? If not, I've misunderstood and that is not a good sign ;) Beryllium-9 (talk) 20:35, 19 August 2008 (UTC)

Polynomials are in C$\infty$

 * Expressing the connectivity as a "loss of smoothness" is reasonable, since if S were a simple polynomial throughout a neighborhood of ti, it would have smoothness Cn at ti, and you would expect to lose smoothness in order to break a polynomial apart into pieces.

Every polynomial is in $$C^{\infty}$$ so it would have smoothness $$C^{\infty}$$ at ti. However, it's a fact that for 2 polynomials of degree n it's enough their 0 to n derivatives are equal at point p, for these polynomials to be the same one poly. in fact (hence, to be $$C^{\infty}$$ smooth at point p). Eventually, I understand the idea behind n-"number of knots" loss of smoothness, but it was a bit misleading at first. Any ideas how to improve that? SalvNaut 21:03, 27 September 2007 (UTC)

Clarification
I'm not competent to edit the content but in Definition section Cr is introduced and while there is some clarification about what it means, there is nothing about what it IS (the set of all functions with derivatives of order 0 to r). Shouldn't definition section define terms the common reader might be unfamiliar with? Also, the comment that polynomials are in C$\infty$ makes the statement that the smoothness is at most n-r, with r = $$\infty$$ really confusing to us poor laymen --what does a negative smoothness mean? Might be best to simply remove C and just talk about derivatives to order r. Introducing C doesn't seem to be necessary. Just a thought.71.31.154.4 (talk) 16:57, 1 November 2009 (UTC)

Definition Section Clarification
I added the clarification tag on the Definition section. A huge number of symbols and variables are introduced in the first few sentences. Even if these are technically rigorously defined (which I don't think they are), some English explanation of what the mathematical statements mean are necessary to improve readability, especially for someone who is being introduced to splines for the first time. Even the use of the blackboard bold R being used to denote "the set of all real numbers" is just a convention that might be clarified by including a simple entry like "where R is the set of all real numbers" in a list of variable definitions. mcs (talk) 16:18, 21 August 2008 (UTC)

Spline under Tension
I can't find any mention of the univariate spline under tension anywhere on Wikipedia, there is a concise presentation at the beginning of "A method for construction of surfaces under tension" by Nielson and Franke (sorry, no link). This is a very nice generalization of the "natural cubic spline" and piecewise linear interpolation, and the paper mentioned is referenced by "Terrain Simulation Using a Model of Stream Erosion" by Kelley, Malin, and Nielson. Am I not looking in the right place? 136.152.138.22 (talk) 20:12, 17 September 2008 (UTC)

Algorithm
Can we discuss validity and maybe clarifying the algorithm I posted? I am pretty sure it is correct, but I am not a mathematician, and would like some expert opinion on it.

Also can somebody write an algorithm for computing cubic splines in 3d space? —Preceding unsigned comment added by Lev a neiman (talk • contribs) 05:25, 10 January 2009 (UTC)


 * hi Lev a neiman. I reviewed the algorithm, since I needed to implement it today, and I've found some small errors. I made the corrections to the algorithm a few minutes ago. In the following paragraphs I will give you an explanation regarding the changes I made and hope that they are valid. but first I have to ask you a question: from where did you get the algorithm? I'm just curious and I would be grateful to hear from you. so, let's move to the abovementioned explanation:


 * at point 1., the algorithm mentioned to "create a new array a of size n and for i = 0,...,n-1 set $$a_i = y_i$$". since the number of coordinates is n+1, the size of the array a should be n+1 too, due to the fact that the algorithms intends to set $$a_i = y_i$$. the for-definition changes too, because we now need to iterate from i = 0,...,n.


 * at point 2. I moved the initialization of the array c down to point 5. and initialized it with a size of n + 1, since at point 8. it was mentioned to set $$c_n = 0$$. if the array is initialized with a size of n and we wanted to access c[n], we would get an index-out-of-bound-error. the size of n + 1 is also needed, because at point 9. the algorithm accesses $$c_{j+1}$$ and index j (initialized with n - 1) would cause an index-out-of-bound-error, since in that case it would want to access c[n] in the first iteration.


 * at point 4. I changed the size for the array α (alpha) to n. this is due to the fact that the for-definition defines the boundary from 0,...,n-1 and in the following lines no forward-access is made that would cause an index-out-of-bound-error (e.g. α[i+1]).


 * finally, at point 9. and 10. I changed the number of splines S to n and the boundary of the for-definition to 0,...,n-1. The first change was made due to the fact that with n + 1 coordinates you will get n splines and the second change is simply a result of the first one.

I hope my feedback and my changes to the algorithm are okay. if you have some suggestions or corrections, I would be pleased to hear from you. Giuseppe A (talk) 16:47, 6 May 2009 (UTC)

I changed c[n]=0 for c[n]=1 in step 8 because else you get a ZeroDivision error in step 9.1

I needed to implement algorithm for creating clamped cubic spline and I encountered problems in your algorithm. The most obvious fact is that in algorithm there are never used values of first derivation in end points ( at that point I decided to look somewhere else for this algorithm ). But it seems to me, that there are more problems. Place, where I found almost same algorithm, is: http://www.michonline.com/ryan/csc/m510/splinepresent.html But it is quite hard to read it on that page, (for example array α in your algorithm is there without name - members of this array are just denoted as corresponding lower index,) however I haven't found any mistake in that algorithm and my program based on it work fine (so far). I suggest to correct to according to mentioned page. Hope my feedback will be useful. —Preceding unsigned comment added by 184.144.70.128 (talk) 22:55, 26 December 2010 (UTC)

I was looking through the algorithm and I agree that it needs some clarification to avoid confusion. The simple fact of the matter is that it's very poorly written with inconsistent indexing. For most of the arrays, they are of length n with indices from 0 to n-1, but for the set alpha it is indexed starting at 1. This is a major issue for people trying to implement this who might be relying on the index numbers, as it will result in the incorrect output. Kasaiwind (talk) 20:37, 21 October 2018 (UTC)

Control point
Control point (mathematics) redirects to this article but the article does not use the term "control point"; please define or use the term. --Una Smith (talk) 04:03, 30 September 2008 (UTC)

Hard to read
Annoying that the algorithm uses both letter a, and the symbol alpha, and the fonts (at least where I am) display both in a very similar fashion in parts of the formulas. —Preceding unsigned comment added by 66.205.73.36 (talk) 02:59, 21 January 2009 (UTC)

Reticulating Splines
No information on how one would go about reticulating them? Why not? We need to add this in right away. —Preceding unsigned comment added by Pomegranete (talk • contribs) 10:59, 5 September 2009 (UTC)

Propose section for deletion
The section Spline (mathematics) should be deleted. It was added by user:Yuanfangdelang who has added a lot of similarly dubious material to several statistics articles. Skbkekas (talk) 02:50, 26 January 2010 (UTC)


 * This section has now been deleted. Skbkekas (talk) 20:30, 29 January 2010 (UTC)

"General expression for a C2 interpolating cubic spline" seems incorrect
The equation for $$S_i(x)$$ in this section is for the cubic polynomial solving the boundary value problem: Notice that there is nothing about the first derivative $$S^{\prime}_i(x)$$, and in fact when used on non-trivial data the first derivatives do not match at the knots. Thus the resulting cubic is actually only C0, no better -- at least in terms of continuity -- than a linear interpolation. This section also seems to differ from the previous sections on the same page in that $$S_i(x)$$ is for $$[t_{i-1}, \ t_i]$$ where earlier $$S_i(x)$$ is for $$[t_{i}, \   t_{i+1}]$$. It appears that more than a year ago this had the closed form solution for the standard C1 continuous cubic spline. It would seem appropriate to revert to that or similar. —Preceding unsigned comment added by PondTapir (talk • contribs) 04:12, 7 August 2010 (UTC)
 * $$S_i(t_i^{}) = f^{}(t_i^{}) $$,
 * $$S^{\prime\prime}_i(t_i) = f^{\prime\prime}(t_i) $$,
 * $$S_i(t_{i-1}^{}) = f^{}(t_{i-1}^{}) $$,
 * $$S^{\prime\prime}_i(t_{i-1}) = f^{\prime\prime}(t_{i-1}) $$

Confused Algorithm for computing clamped cubic splines
The algorithm appears to compute the natural cubic spline, which is the title of the preceding section (and this one does not describe an algorithm). A clamped cubic spline is not otherwise defined in the article. Also, the values computed for the z array are never described. This is especially confusing because the array z is used in the description following as the second derivative at the knots and the values of z computed are not. Other computed terms could use descriptions as well, such as alpha (triple the difference of the mean slope on adjacent intervals). Further, the mean slope in each interval could be used to simplify the description of the computation of alpha. The array mu is allocated to hold n+1 items, but only n are assigned (or used). JCRVMD (talk) 23:01, 7 January 2011 (UTC)

Improvement of this article!
Why does the article start with this image? ? Of all spline images in "WIKI Commons" this seems to be the strangest and the least suitable for the article!

It says:

"In mathematics, a spline is a special function defined piecewise by polynomials."

and

"In computer science subfields of computer-aided design and computer graphics, the term "spline" more frequently refers to a piecewise polynomial (parametric) curve."

There is therefore no difference in the use of this term between "mathematics" and "computer science"!!

The "Introduction" and even more the "Definition" are strange making rather simple matter sound complicated with a lot of mathematical terminology that really does not help!

A re-write:

++++++++++++++++++++++++++++++++++++++++++++

In mathematics, a spline of degree n is a function defined in a number of adjacent intervals by polynomials of degree n, i.e.


 * $$S(t) = P_0 (t) \mbox{, } t_0 \le t < t_1,$$
 * $$S(t) = P_1 (t) \mbox{, } t_1 \le t < t_2,$$
 * $$\vdots$$
 * $$S(t) = P_{k-1} (t) \mbox{, } t_{k-1} \le t \le t_k.$$

where the polynomials $$P_0 (t), P_1 (t) \cdot P_{k-1}$$

are such that $$S(t)$$ is a continuous and (n-1) times differentiable function in the full interval $$t_0 < t < t_k,$$. A simple example of a spline of degree 2 is
 * $$S(t) = (t+1)^2-1 \mbox{, } -2 \le t < 0$$
 * $$S(t) = 1-(t-1)^2\mbox{, } 0 \le t \le 2$$

for which $$S'(0)=2$$.

The by far most important spline functions are the "cubic splines" of degree 3 as these are the splines used for spline interpolation for which the 4 parameters of a third order polynomial in general are needed to get a good and smooth interpolation. The term "spline" in fact originate from the elastic splines used by craftsmen to draw smooth bent curves passing through a number of given point, called the "knots", and these curves can to a first approximation can be considered to be cubic splines where the "knots" are the points where the different third degree polynomials meet. For this, see Spline interpolation.

+++++++++++++++++++++++++++++++++++++++++++

And this should all be illustrated with figures!! The strange figure included could for example be replaced by a graph of the function
 * $$S(t) = (t+1)^2 -1 \mbox{, } -1 \le t < 0$$
 * $$S(t) = 1 -(t-1)^2 \mbox{, } 0 \le t \le 1$$

And actually I do not think much more should be said here. The (simple) definition is provided and the interesting part is then found in Spline interpolation, i.e the computation of the interpolating cubic spline!

Stamcose (talk) 19:55, 27 January 2011 (UTC)

Here is a complete rewrite removing a lot of stuff that just is confusing a reader who wants the basic stuff clearly and simply explained! Avoiding rather exotic generalizations "reducing the smoothness requirements" at the knots that if at all should be put at the very end of the article under the headin Generalizations of the concept! Who opposes this re-write wanting more of the old stuff to be kept and with what justification?

Proposed rewrite:

Definition
A spline is a piecewise-polynomial real function.


 * $$S: [a,b]\to \mathbb{R}$$

on an interval [a,b] composed of k ordered disjoint subintervals $$[t_{i-1}, t_i] $$ with
 * $$a = t_0 < t_1 < \cdots < t_{k-1} < t_k = b$$.

On each interval i function S is a polynomial
 * $$P_i: [t_{i-1}, t_i] \to \mathbb{R}$$,

so that
 * $$S(t) = P_1 (t) \mbox{, } t_0 \le t < t_1,$$
 * $$S(t) = P_2 (t) \mbox{, } t_1 \le t < t_2,$$
 * $$\vdots$$
 * $$S(t) = P_k (t) \mbox{, } t_{k-1} \le t \le t_k.$$

The order of the spline, n, is equal to the highest order of the polynomials $$ P_i (t) \quad i=1 \cdots k$$ used and the polynomials should be such that $$S(t)$$ is continuous and n-1 times derivable also at the inner knots points $$t_i \quad   i=1, \cdots k-1 $$. This means that at all the inner knots points $$t_1, t_2, \cdots , t_{k-1}$$ $$P_i^{(j)} (t_i) = P_{i+1}^{(j)} (t_i)$$ for all $$j \quad 0 \le j \le n-1$$

If all subintervals are of the same length the spline is uniform if not it is non-uniform.

The by far most used splines are the cubic splines, i.e. splines of order 3, as these are used for spline interpolation simulating the function of flat splines

Examples
A simple example of a quadratic spline (a spline of degree 2) is
 * $$S(t) = (t+1)^2-1 \mbox{, } -2 \le t < 0$$
 * $$S(t) = 1-(t-1)^2\mbox{, } 0 \le t \le 2$$

for which $$S'(0)=2$$.

An simple example of a cubic spline is


 * $$S(t) = |t|^3 $$

as
 * $$S(t) = t^3 \mbox{, } t \ge 0 $$
 * $$S(t) = -t^3 \mbox{, } t < 0 $$

and
 * $$S(0)^{(0)} = S(0) = 0 $$
 * $$S(0)^{(1)} = S(0)' = 0 $$
 * $$S(0)^{(2)} = S(0)'' = 0 $$

2. Example
[...] $$S'(0)=2$$ [...] $$S(0)' =\ 0$$

What's "$$S(0)'$$"? Is it supposed to be "$$S'(0)$$" similiar to the first example and accourding to the normal notation of the 1. derivate of S?

-91.63.238.36 (talk) 13:06, 12 December 2012 (UTC)

Theory

 * Cubic Splines Module Prof. John H. Mathews California State University, Fullerton
 * Spline Curves, Prof. Donald H. House Clemson University
 * An Interactive Introduction to Splines, ibiblio.org
 * Introduction to Splines, codeplea.com

I added the external link to my free Web e-book. It is a more complete treatment of piecewise interpolation for those new to the subject and aimed at graphics. I'll add references to other related Wiki pages in the future.


 * EDIT Dec 29 2022 Comcast closed down web hosting.  My Interpolation e-book appears to be available on the archive:

https://web.archive.org/web/20150930224506/http://home.comcast.net/~k9dci/site/?/page/Piecewise_Polynomial_Interpolation/ — Preceding unsigned comment added by EngineerSteve (talk • contribs) 00:27, 30 December 2022 (UTC)

My e-book is both a study of the fundamentals described in simple terms as well as a reference showing many types of Polynomial Interpolation -both common types and some developed by the author. It also shows some techniques not seen elsewhere. Linear interpolation is looked at carefully and shown is as the basis for all more advanced types using only Algebra. Only after understanding how adding squared and cubed terms cause smooth curves, are the more advanced curves examined such as Bezier, Catmul-Rom, b-spline, and Hermite. More advanced mathematical concepts and notations are kept to a minimum. Some additional techniques that are suggested by the mathematics and that the author has not seen elsewhere are examined. A reference is also included with all the most common curve drawing methods and includes drawings to allow comparison with other types.

WHY: I had hoped, but failed to find a book explaining polynomial interpolation basics and thought that one must certainly exist with a collection of interpolation types. I found either purely mathematical tests or advanced graphics texts. Several years later, I started reading the original Internet Usenet "groups", comp.graphics.algorithms, and did lots of searching on the net. I saved whatever I found related to splines and curves, but did not look at it or try to understand any of it until early in 1996, I decided to look at what I had collected, and started to figure things out. I begin recording my thoughts for future reference and this is the result. The very book I wanted originally is now freely available for others.

I do not believe this has any issues with the Wiki self cite guidelines. -- Steve -- (talk) 22:57, 28 August 2011 (UTC)

Excel functions

 * Open source Excel cubic spline User Defined Function
 * SRS1 Cubic Spline for Excel - Free Excel cubic spline function (with utility to embed spline function code into any workbook)

Online utilities

 * Online Cubic Spline Interpolation Utility
 * Learning by Simulations Interactive simulation of various cubic splines
 * Symmetrical Spline Curves, an animation by Theodore Gray, The Wolfram Demonstrations Project, 2007.

Computer code

 * Notes, PPT, Mathcad, Maple, Mathematica, Matlab, Holistic Numerical Methods Institute
 * various routines, NTCC
 * Sisl: Opensource C-library for NURBS, SINTEF
 * VBA Spline Interpolation, vbnumericalmethods.com
 * Closed Bezier Spline, C#, WPF, Oleg V. Polikarpotchkin
 * Bezier Spline from 2D Points, C#, WPF, Oleg V. Polikarpotchkin

 Category:Interpolation

End re-write

Stamcose (talk) 13:09, 29 January 2011 (UTC)

Removal of dubious text
To my understanding this article is in a bad state! I already drafted above in "Improvement of article" what I think should be said. What is more delicate is what not should be said.

I think the text starting "Recall that a function.." should be removed! Seems to be completely misplaced and irrelevant. It says "is commonly denoted". Please give references showing that anything of this is "common" at all in connection with splines (in serious work!)!

The "Algorithm for computing natural splines" and "clamped splines" is also misplaced(nonsense!?) In this article the definition what a spline is should be given but there is nothing to compute! For "Spline interpolation" there is something to compute but this is done completely different!

I would like to remove all this dubious material! Any protests?

Stamcose (talk) 19:40, 29 January 2011 (UTC)

degree vs order
The degree of the polynomial p(x) = a_0 + a_1x + a_2x^2 + ... is the largest k for which a_k is not zero. In particular, the set of all polynomials of a given degree is not a linear vector space. For that reason, some people use the term "order" to indicate the number of consecutive terms, starting with a_0, a_1x, ... they are going to use to describe a polynomial. Thus, the set of all polynomials of order 4 is what some, carelessly, describe as the set of all cubic polynomials. The same people would call a spline of order 4 what, in this article, is called a cubic spline or a spline of order 3. It would be good if the article were not to confuse order with degree. Deboor (talk) 03:26, 26 June 2011 (UTC)

my spline algorithm creates a oscillating curve -- why?
I was of the opinion, that I understand spline interpolation. Last time I tried to implement this myself, I was successful in getting 0, 1, and 2nd derivative continuous. But the resulting spline was widely oscillating -- going through the given points but oscillating around them (0..2 derivative continuous)! Then I tried things like modifying existing free parameters (1th derivative at point 0) to minimize the integral of the square of the second derivative. Or even adding more coefficients to minimize this integral. But without success. Oscillation was reduced strongly but got again out of control in the last couple of intervals. Then I copied the implementation from Numerical recipes and everything was fine. I've to state, that I don't like the explanation here in wikipedia or the one in numerical recipes. Why not simply stating which things are given and what needs to be solved for?

given: or
 * x1..xn, y1..yn, n >= 3
 * dy/dx continuous
 * d^2y/dx^2 continuous
 * polynomial for every interval is
 * an+bn*x+cn*x^2+dn*x^3
 * yn + bn*(x-xn) + cn*(x-xn)^2 + dn*(x-xn)^3

This makes n points given and n-2 midpoints where the 0, 1 and 2nd derivative must be identical. This is n+3*(n-2)=4n-6

need to be solved for: So we need two more given inputs -- maybe the 1 and 2nd derivative at the first point.
 * (n-1) intervals with 4 (polynomial) coefficients each, which is 4n-4 coefficients.

This gives a linear system with 4n-4 equations and 4n-4 unknowns.

Again: could somebody explain to me, what I'm doing wrong? Why is my solution oscillating? I don't see, how there could be more than one solution to this linear system.

18:35, 6 October 2015 (UTC)Elenchusis (talk) 18:35, 6 October 2015 (UTC) Hi there, I'm new to editing Wikipedia, so I'm not sure if this is where to respond, but... I believe the most common way of getting the two extra inputs you need is to set the 2nd derivative at the start and end points to zero. There are other methods, but I used this and was able to solve it just fine.

Misplaced text
User 71.246.201.83 on 13 April 2011 introduced some text (section "derivation") that in fact is the spline interpolation problem. But this is already available and much better formulated in the article Spline interpolation. I think this text should be removed, possibly replaced with some clear reference to the article Spline interpolation!

Opinions?

Stamcose (talk) 16:53, 18 September 2011 (UTC)
 * Yes, that makes sense: it doesn't really belong here, even without it already appearing in a far more appropriate article. Just replace it with a short paragraph and a main template.-- JohnBlackburne wordsdeeds 18:47, 18 September 2011 (UTC)

Preferred to as?
Suspect typo in second sentence - "preferred to as". I believe this should be "preferred to" due to the comparison to polynomial interpolation, but since the change could change meaning I am requesting confirmation from others before editing. This could also use a reference i.e. preferred by whom? — Preceding unsigned comment added by Jjensen2009 (talk • contribs) 00:37, 16 March 2012 (UTC)

'Smoothness' in introduction
The introduction to the article currently reads: "In mathematics, a spline is a sufficiently smooth polynomial function that is piecewise-defined, and possesses a high degree of smoothness at the places where the polynomial pieces connect (which are known as knots)." There is nothing about the general spline that needs to be 'smooth', however, for example a linear spline is in no way smooth at knots. I propose something to the extend of: "In mathematics, a spline is a piecewise-defined polynomial function which defines a curve or line connecting a series of points (which are known as 'knots'). A linear, or first-order, spline is one in which each point is connected to the next with a straight line.  Higher order splines (e.g. quadratic, or 'second-order', splines) can be used to 'smooth' the connections between points." All Clues Key (talk) 05:10, 1 October 2012 (UTC)

What's the difference? (again)

 * With the advent of computers, splines first replaced polynomials in interpolation, ...

If splines are piecewise polynomials, this could be written better. —Tamfang (talk) 05:20, 27 September 2014 (UTC)

Spline page array index, readability of α and a
I copied this from my TP. Purgy (talk) 09:36, 5 March 2019 (UTC)


 * It's about this edit. It is correct that all of the other arrays in this description appear to be indexed from zero, (emphasis mine), but it is not true that $\alpha$ is actually zero-indexed in step one. Step one is about an array called a, which unluckily looks very similar to α. The array a is indexed from zero, but the array α is not. I will edit α to β to make the difference more obvious. I do not doubt that your implementation works, but I am convinced that the current description is correct, and maybe describes a different implementation of an equivalent algorithm. Purgy (talk) 09:36, 5 March 2019 (UTC)


 * Oops! I do admit that I confused $$a$$ with $$\alpha$$ in my original comment, and I guess that at some point I did end up subtracting 1 from the index when it was accessed in my implementation. So as it stands, the algorithm is still correct, however the mixing of zero- and one-indexed arrays is definitely confusing (and the one-indexing of $$\beta$$ doesn't even provide a significant simplification of the algorithm, seeing as $$\beta$$ is only accessed once, and making it zero-indexed would only require replacing $$\beta_i$$ with $$\beta_{i-1}$$). Goose121 (talk) 19:03, 5 March 2019 (UTC)


 * There is an encompassing index range [0, k]. With respect to the boundaries ranges of [0, k-1] (excluding the right rim) and [1, k-1] (excluding both rims) are necessary. Reindexing the latter to [0, k-2] might be appealing to index jugglers ;), but, honestly, for the sake of tradition-bound zero-based indexing, I would not sacrifice the natural index range. In case there is really such an implementation of a language that reacts positively to such index manipulations, then, of course, it would be meaningful there to reindex, but not in this brute-force pseudo code, which should strive for better accessibility still.


 * Supplement for the semantics of the indices: currently the $$k+1$$ integers $$j \in [0, k]$$ enumerate the $$k-1$$ partioning points plus the two boundary points; the $$k$$ integer values $$i \in [0,k-1]$$ enumerate the generated intervals, the polynomials defined there, ...; and finally, the now not separately named integers $$\in [1,k-1]$$ refer to the $$k-1$$ inner (partitioning) points of the interval. Starting with [1, k+1] would generate [1, k] and [2, k], not necessarily a better variant. Currently I consider to start all ranges at one, giving the upper boundaries a meaningful interpretation: [1, k+1], [1, k], and [1, k-1], possibly frustrating traditionalist base-zero junkies, like E.W.Dijkstra. ;)


 * I just started to look over this article a bit, unifying the indices (i, j, n, perhaps, with fixed associated ranges) might be a step to improvement? Purgy (talk) 20:27, 5 March 2019 (UTC)


 * I renamed the degree of a spline from n to m, the number of intervals (polynomials) from k to n, and used the free k as index name for the range [1, n - 1]. The other ranges are now: j in [0, n] and i in [0, n - 1]. One could note that the i-range is used both increasing and decreasing under the same index name.
 * I intend to work on some places in the article and will collect impressions about the starting values of the ranges. Purgy (talk) 15:24, 7 March 2019 (UTC)

Do the piecewise curves actually equal $$y_i$$ ?
I'm reading the article to try to understand how splines are defined, and I ran across this equation in the section "Algorithm for computing natural cubic splines": But doesn't this mean that the generated function - or more precisely, the endpoints of every single piece of the function - fall directly on the input points? Sorry if I'm misunderstanding, I'm just learning about splines. Russl5445 (talk) 20:51, 17 March 2021 (UTC)
 * $$P_i \left (x_i \right) = y_i = P_{i-1}\left (x_i \right ), i = 1, \ldots , n-1.$$

The pseudo code example is not helpful
I'm sorry but I would not call this pseudo code, a python or C example would be better. There are more explicit ways to write pseudo code. — Preceding unsigned comment added by Jokooon (talk • contribs) 22:05, 3 December 2021 (UTC)