ArticleslgStudy

computer science

De Boor's algorithm

De Boor's algorithm is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand De Boor's algorithm rather than just read about it. In short: In the mathematical subfield of numerical analysis, de Boor's algorithm is a polynomial-time and numerically stable algorithm for evaluating spline curves in B-spline form. It is a generalization of de Casteljau's algorithm for Bézier curves.

Key takeaways

  • De Boor's algorithm belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect De Boor's algorithm to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of De Boor's algorithm from memory before moving on to harder problems.

Reference excerpt

In the mathematical subfield of numerical analysis, de Boor's algorithm is a polynomial-time and numerically stable algorithm for evaluating spline curves in B-spline form. It is a generalization of de Casteljau's algorithm for Bézier curves. The algorithm was devised by German-American mathematician Carl R. de Boor. Simplified, potentially faster variants of the de Boor algorithm have been created but they suffer from comparatively lower stability.

Introduction A general introduction to B-splines is given in the main article. Here we discuss de Boor's algorithm, an efficient and numerically stable scheme to evaluate a spline curve 𝐒(x) at position x. The curve is built from a sum of B-spline functions Bi,p(x) multiplied with potentially vector-valued constants 𝐜i, called control points, 𝐒(x)=∑i𝐜iBi,p(x). B-splines of order p+1 are connected piece-wise polynomial functions of degree p defined over a grid of knots t0,…,ti,…,tm (we always use zero-based indices in the following). De Boor's algorithm uses O(p2) + O(p) operations to evaluate the spline curve. Note: the main article about B-splines and the classic publications use a different notation: the B-spline is indexed as Bi,n(x) with n=p+1.

Local support B-splines have local support, meaning that the polynomials are positive only in a compact domain and zero elsewhere. The Cox-de Boor recursion formula shows this: Bi,0(x):={1if ti≤x<ti+10otherwise Bi,p(x):=x−titi+p−tiBi,p−1(x)+ti+p+1−xti+p+1−ti+1Bi+1,p−1(x). Let the index k define the knot interval that contains the position, x∈[tk,tk+1). We can see in the recursion formula that only B-splines with i=k−p,…,k are non-zero for this knot interval. Thus, the sum is reduced to: 𝐒(x)=∑i=k−pk𝐜iBi,p(x). It follows from i≥0 that k≥p. Similarly, we see in the recursion that the highest queried knot location is at index k+1+p. This means that any knot interval [tk,tk+1) which is actually used must have at least p additional knots before and after. In a computer program, this is typically achieved by repeating the first and last used knot location p times. For example, for p=3 and real knot locations (0,1,2), one would pad the knot vector to (0,0,0,0,1,2,2,2,2).

The algorithm With these definitions, we can now describe de Boor's algorithm. The algorithm does not compute the B-spline functions Bi,p(x) directly. Instead it evaluates 𝐒(x) through an equivalent recursion formula. Let 𝐝i,r be new control points with 𝐝i,0:=𝐜i for i=k−p,…,k. For r=1,…,p the following recursion is applied: 𝐝i,r=(1−αi,r)𝐝i−1,r−1+αi,r𝐝i,r−1;i=k−p+r,…,k αi,r=x−titi+1+p−r−ti. Once the iterations are complete, we have 𝐒(x)=𝐝k,p, meaning that 𝐝k,p is the desired result. De Boor's algorithm is more efficient than an explicit calculation of B-splines Bi,p(x) with the Cox-de Boor recursion formula, because it does not compute terms which are guaranteed to be multiplied by zero.

Optimizations The algorithm above is not optimized for the implementation in a computer. It requires memory for (p+1)+p+⋯+1=(p+1)(p+2)/2 temporary control points 𝐝i,r. Each temporary control point is written exactly once and read twice. By reversing the iteration over i (counting down instead of up), we can run the algorithm with memory for only p+1 temporary control points, by letting 𝐝i,r reuse the memory for 𝐝i,r−1. Similarly, there is only one value of α used in each step, so we can reuse the memory as well. Furthermore, it is more convenient to use a zero-based index j=0,…,p for the temporary control points. The relation to the previous index is i=j+k−p. Thus we obtain the improved algorithm: Let 𝐝j:=𝐜j+k−p for j=0,…,p. Iterate for r=1,…,p: 𝐝j:=(1−αj)𝐝j−1+αj𝐝j;j=p,…,r αj:=x−tj+k−ptj+1+k−r−tj+k−p. Note that j must be counted down. After the iterations are complete, the result is 𝐒(x)=𝐝p.

Example implementation The following code in the Python programming language is a naive implementation of the optimized algorithm.

See also De Casteljau's algorithm Bézier curve Non-uniform rational B-spline

External links De Boor's Algorithm The DeBoor-Cox Calculation

Computer code PPPACK: contains many spline algorithms in Fortran GNU Scientific Library: C-library, contains a sub-library for splines ported from PPPACK SciPy: Python-library, contains a sub-library scipy.interpolate with spline functions based on FITPACK TinySpline: C-library for splines with a C++ wrapper and bindings for C#, Java, Lua, PHP, Python, and Ruby Einspline: C-library for splines in 1, 2, and 3 dimensions with Fortran wrappers

References

Works cited

Carl de Boor (2003). A Practical Guide to Splines, Revised Edition. Springer-Verlag. ISBN 0-387-95366-3.

Worked examples

Example 1 — a first encounter with De Boor's algorithm

Start with the simplest possible case. Write down what De Boor's algorithm claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to De Boor's algorithm before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about De Boor's algorithm ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of De Boor's algorithm

In research
De Boor's algorithm appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses De Boor's algorithm in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
De Boor's algorithm is common in secondary-school and first-year university syllabi. It links to neighbouring topics Interpolation, Numerical analysis, Splines (mathematics), so understanding it makes those chapters shorter.
In everyday life
Look for De Boor's algorithm outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “De Boor's algorithm” →

How to study De Boor's algorithm in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what De Boor's algorithm means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain De Boor's algorithm out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is De Boor's algorithm in simple terms?

In the mathematical subfield of numerical analysis, de Boor's algorithm is a polynomial-time and numerically stable algorithm for evaluating spline curves in B-spline form. It is a generalization of de Casteljau's algorithm for Bézier curves.

Why does De Boor's algorithm matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study De Boor's algorithm?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on De Boor's algorithm.

Tags

  • Interpolation
  • Numerical analysis
  • Splines (mathematics)

Keep exploring