SPLINE OPTIMIZATION
Spline optimization using genetic algorithm in AGV
system
Facility of Engineering and Natural Sciences Master of Science Thesis October 2019
ABSTRACT
Viljami Männikkö: Spline optimization Master of Science Thesis
Tampere University
Master’s Degree Programme in Engineering and Natural Sciences October 2019
Splines are polynomial curves. They are used for example to model complicated shapes in computer programs and science. They can be also used to construct planes. Those planes can be used to easily model complicated surfaces. Splines are widely used also in 3D modeling, where models surfaces are defined with splines. In this work, we use splines to model automated guided vehicles’ (AGV) routes. By combining splines, we can easily construct complex route
networks to all sorts of vehicles.
Splines can be constructed in multiple ways. No matter of construction method, splines’ shape is always defined by using control points. In this work, splines are constructed by using knot vector and so-called basis functions. If splines are constructed in this way, they are calledbasis splines (splines). Any spline can be defined by a linear combination of splines and that’s why
B-splines are practically some sort of basis for B-splines. B-spline basis functions are constructed by using the Cox de Boor recursion algorithm.
This work’s purpose is to study spline properties from a spline modification point of view. Our goal is to develop an algorithm that modifies the spline route to be faster to drive with an automated guided vehicle in a specified system. Optimization is made by using genetic algo-rithm properties. In route optimization, we need to take into account different kinds of systems’ restrictions. Splines model AGV routes in the warehouse, which adds more restrictions to the optimization. In optimization, we need to take into account at least AGV maximum acceleration, maximum deceleration, wheel maximum rotation angle, maximum centripetal and maximum ve-locity. The route has to also be possible to drive, so we have to check during the route that AGV doesn’t hit the obstacles. The goal is to modify route such that AGV start and end velocity, start-and endpoint start-and start start-and end angle doesn’t change during the optimization. In the work, we will also go through other possible approaches to the optimization, such as the so-called resilient backpropagation method.
Keywords: Spline, Polynomial curve, Genetic algorithm, Optimization, AGV system The originality of this thesis has been checked using the Turnitin OriginalityCheck service.
TIIVISTELMÄ
Viljami Männikkö: Spline optimointi Diplomityö
Tampereen yliopisto
Teknis-luonnontieteellinen DI-tutkinto-ohjelma Lokakuu 2019
Splinet ovat polynomikäyriä, joita käytetään erityisesti mallintamaan monimutkaisia muotoja tietokoneohjelmissa. Splinejen avulla voidaan myös muodostaa tasoja, joiden avulla voidaan mal-lintaa helposti monimutkaisiakin pinnanmuotoja. Splinejä hyödynnetään myös 3D mallinnuksessa, jossa mallien pinnat määritellään niiden avulla. Tässä työssä niitä käytetään vihivaunujen reittien mallintamiseen. Yhdistelemällä niitä voidaan muodostaa monimutkaisia reittiverkostoja vihivau-nuille.
Splinet voidaan konstruktoida erilaisilla tavoilla, mutta kaikille niille on yhteistä se, että niiden muoto määritellään kontrollipisteiden avulla. Tässä työssä splinejen konstruktointiin käytetään sol-muvektoria ja niin kutsuttuja kantafunktioita. Tällä tavoin konstruktoituja splinejä kutsutaanbasis splineiksi (B-spline). B-splinejen avulla voidaan esittää mikä tahansa spline niiden
lineaarikom-binaationa, joten B-splinet ovat käytännössä "kantasplinejä". B-splinejen kantafunktioiden kon-struktointiin käytetään Cox de Boor:in rekursio menetelmää.
Tämän työn tarkoituksena on tutustua splinejen ominaisuuksiin, niiden muokkauksen näkö-kulmasta. Tavoitteena on kehittää algoritmi, jonka avulla AGV:eiden reittejä pystytään muokkaa-maan nopeammin ajettavaksi. Optimointi suoritetaan hyödyntämällä geneettisten algoritmien omi-naisuuksia. Splinejen optimoinnissa tulee ottaa huomioon systeemin erilaiset rajoitteet. Splinet kuvaavat vihivaunujen reittejä varastohallissa, joten tämä luo systeemiin lisää erilaisia rajoitteita. Optimoinnissa pitää ottaa huomioon vihivaunun maksimikiihtyvyys, maksimihidastuvuus, renkai-den maksimikääntökulma, maksimikeskihakuisvoima ja vihivaunun maksiminopeus. Reitin tulee olla myös mahdollinen ajaa, joten reitin aikana pitää myös tarkastaa ettei vihivaunu osu seinään tai toisen vihivaunun reitille. Tavoitteena on siis muokata kulkureittiä siten, että vihivaunun alku- ja loppunopeus, alku- ja loppupiste sekä lähtö- ja tulokulma eivät muutu, mutta kulkureitti kokonai-suudessaan olisi nopeampi ajaa. Työssä käydään myös läpi muita mahdollisia lähestymistapoja optimointiin, kuten esimerkiksi niin sanottu resilient backpropogation menetelmä.
Avainsanat: Spline, Polynomi kurvi, Geneettinen algoritmi, Optimointi, AGV-järjestelmä Tämän julkaisun alkuperäisyys on tarkastettu Turnitin OriginalityCheck -ohjelmalla.
PREFACE
This Master of Science thesis was done for the Rocla Oy and work was done at Atostek Oy. Work was guided by the master of science Antti Anttonen from Atostek Oy and professor Esko Turunen from Tampere University. The work was funded by both Atostek Oy and Rocla Oy. Rocla funded the algorithm development part and Atostek Oy funded the writing process and the research to the theory behind the algorithm. I want to thank both of my supervisors, the master of science Olli Kivelä for help with thesis topic creation, Rocla Oy for giving this topic to me and finally Atostek Oy for an opportunity to do this thesis as a part of the project.
Tampere, 18th October 2019
CONTENTS
1 Introduction . . . 1
2 Piecewise polynomial curves . . . 3
2.1 Polynomials . . . 3
2.2 Divided difference . . . 9
2.3 Splines . . . 15
2.4 Basis splines . . . 17
2.4.1 Constructing the knot sequence . . . 17
2.4.2 Basis functions and constructing B-spline . . . 18
2.5 Length of spline . . . 27
2.5.1 Multiple linear segments length approximation . . . 27
2.5.2 The length of the parametrized curve . . . 34
2.6 Derivative of B-spline . . . 37
2.7 Curvature . . . 41
3 Genetic algorithm . . . 45
3.1 Description . . . 45
3.2 Example "salesman problem" . . . 49
3.3 Why genetic algorithm works? . . . 51
4 System description . . . 56
4.1 Automated guided vehicles and automated warehouse . . . 56
4.2 System restrictions and initial conditions . . . 56
4.3 Condition checking and calculating drive time through the spline . . . 59
5 Optimization algorithm . . . 67 5.1 Description . . . 67 5.1.1 Population initialization . . . 67 5.1.2 Fitness function . . . 70 5.1.3 Genetic operations . . . 71 5.1.4 End criteria . . . 73
5.1.5 Current implementation solutions . . . 75
5.2 Results . . . 75
5.2.1 AGV velocity evaluation . . . 75
5.2.2 Vehicle collision detection . . . 78
5.2.3 Population initialization . . . 80
5.2.4 Overall algorithm . . . 84
5.3 Development opportunities . . . 90
5.3.1 Parent selection using fitness proportionate selection . . . 90
5.3.3 Other AGV route detection to match real world system . . . 93
5.3.4 Changing the safe area to match sweep polygons . . . 95
5.3.5 Algorithm usage for finding the fastest route between two given points 96 6 Other approaching perspectives . . . 98
6.1 Resilient backpropagation approach . . . 98
6.2 Is RPROP better than GA? . . . 99
7 Summary . . . 101
References . . . 103
Appendix A Population initialization algorithm . . . 105
Appendix B Crossover algorithm . . . 107
Appendix C Mutation algorithm . . . 108
LIST OF FIGURES
2.1 Illustration of two different piecewice polynom, which are both not
differen-tiable, but second function is continuous. . . 9
2.2 Basis functions of the example. . . 24
2.3 Spline functions of the example. . . 25
2.4 Example of dividing spline into parts and calculating straight distance be-tween points. . . 28
2.5 Illustration how changing the n effects on spline length. . . 34
3.1 General evolution algorithm process. . . 46
3.2 Creating a new population using an evolution algorithm. . . 48
3.3 Finding the maximum fitness value using a genetic algorithm. . . 49
3.4 Salesman problem children inheritance. . . 50
3.5 Salesman problem children mutation. . . 50
3.6 Routes before and after salesman problem genetic algorithm. . . 51
4.1 Illustration of optimization situation. . . 57
4.2 Description of steering angle calculation. . . 60
4.3 Illustration how collision is checked. . . 63
5.1 Population initialization algorithm. . . 68
5.2 Crossover algorithm. . . 72
5.3 Children mutation algorithm. . . 73
5.4 AGV velocity evaluation tests results diagrams. . . 77
5.5 Collision detection test result figures. Blue line is route, green lines are bounds of safe area, orange lines are not allowed areas boundaries and red boxes indicates sections where collision is detected. . . 79
5.6 Population generation for simple route which is parallel to y-axis. Popula-tion generaPopula-tion is ran multiple times to ensure that populaPopula-tion generaPopula-tion works correctly when running it multiple times. . . 81
5.7 Population generation for different routes. For each routes there is figure of route, diagram of all control points and figure of all generated routes. . . 82
5.8 Population initialization times with different sized populations. . . 83
5.9 Population evaluation times with different number of threads. . . 84
5.10 The first test route of the overall genetic algorithm. The left route is starting route and the right one is the found optimal route. . . 85
5.11 Population fitness values evolution during the optimization process. . . 87
5.12 Population fitness values evolution during the optimization process, when 0.1%improvement doesn’t reset counter. . . 87
5.13 The second test route of the overall genetic algorithm. The left route is the starting route and the right one is the found optimal route. . . 88 5.14 The third test route of the overall genetic algorithm. The left route is the
starting route and the right one is the found optimal route. . . 89 5.15 Fitness-proportional selection method compared to implemented selection
method. . . 91 5.16 Ray casting example. . . 92 5.17 Example of how warehouse can be splitted into sections. . . 93 5.18 Example of three different cases of how AGV routes collision could effect
on optimization algorithm. . . 94 5.19 Current safe area creation compared to improved safe area creation, which
takes account AGV sweeping. . . 96 5.20 Spline creation between two points, with starting angle and end angle. . . . 97
LIST OF TABLES
5.1 End criteria parameter descriptions. . . 74
5.2 The AGV settings during the velocity test runs. . . 76
5.3 The AGV settings during the collision detection test runs. . . 78
5.4 The Genetic algorithm settings during the tests test runs. . . 85
5.5 Route 1 test results. . . 86
5.6 Route 2 test results. . . 88
LIST OF PROGRAMS AND ALGORITHMS
5.1 Parent selecting functionality. . . 71
5.2 End criterion checking. . . 74
A.1 Spline population initialization functionality . . . 105
B.1 Children crossover functionality . . . 107
C.1 Children mutating functionality . . . 108
LIST OF SYMBOLS AND ABBREVIATIONS
a Acceleration
AGV Automated guided vehicle is independently working vehicle. B-spline Basis spline is spline, which is constructed by using basis functions
and control points.
F Force
f Fitness function
f Mean fitness of the population
GA Genetic algorithm, heuristic method for solving the mathematical especially combinator problems.
k Degree of the spline
m Mass
M Number of knots
n Number of control points
N Natural numbers = {0, 1, 2, ..., } Ni,j Basis function
Nb New population base size
Nc Number of children in each population
N Population size
P Population
pi Control point
pbetter f avour Better parents favouring probability pc Crossover probability
pm Mutation probability
R Real numbers
RPROP Resiliant backpropagation
S Spline is piecewice polynomial curve, which shape is defined using control points.
t Spline variable
ui Knot
1 INTRODUCTION
In the future, more and more warehouses will be more likely to be automated which means that demand for automated guided vehicles (AGV) is increasing. One solution for the automated warehouse is the automated guided vehicle system offered by Rocla Oy. Rocla is a Finnish electric warehouse truck, AGV and forklifts manufacturer. AGVs are independently working trucks that are controlled by the automated warehouse system. AGVs move along pre-defined routes and they can transport goods from place A to place B independently. [18] To get warehouse automated, we need to create a route network into a warehouse. Route network describes AGV’s possible routes in the warehouse. Route network includes all routes to all the possible places of pick-up and drop-off. [18] [1] At this moment, route networks are constructed by hand using computer software. The goal is to automate the route network creation process, due to the increasing demand for automated warehouses.
In the system, the route network’s routes are described by using splines, which are poly-nomial curves. Spline’s shape is defined by using control points [20]. In the current automated route network creation development, it is managed to create automatically a rough route network into the warehouse, but it doesn’t take into account AGV’s drive times or route’s optimality. This work’s purpose is to develop an algorithm for route optimization from the drive time point of view, which can be later applied to that software.
In optimization, we need to take into account multiple restrictions. System restrictions that we have to at least take account are AGV maximum acceleration, maximum deceler-ation, wheel maximum rotation angle, maximum centripetal and maximum velocity. The route has to also be possible to drive, so we have to check during the route that AGV doesn’t hit the walls or other obstacles. We want to modify route such that AGV start and end velocity, start- and end point and start and end angle doesn’t change during the opti-mization. Because all the routes are defined with the splines, in optimization we need to modify the spline’s shape. Spline’s shape is defined by control points, so in the optimiza-tion algorithm, we need to modify control point locaoptimiza-tions. In the optimizaoptimiza-tion algorithm, we will use the properties of the genetical algorithms.
In this work, we will first go through the theory of the splines. After that, we will handle the genetical algorithm functionality at the general level. The work will also provide a brief overview of other possible approaches to optimization. This research purpose is to go through spline properties from an optimization point of view and also research the genetic algorithm suitability for solving this optimization problem. The goal is to develop
an algorithm for route optimization so that it takes account as good as possible systems’ restrictions. However, our goal is not to create an algorithm that takes into account all the possible real-world and system restrictions. Instead of that, our goal is to develop an algorithm for testing the genetic algorithm’s suitability for this problem. The algo-rithm should take into account the most common restrictions of the system such as route suitability (AGV shouldn’t hit the walls), AGV maximum velocity, maximum acceleration, maximum deceleration, maximum centripetal and wheel maximum angle of rotation. The algorithm will be made so that, it is easy to add more restriction checking in to algorithm, for example checking wheel maximum rotation speed.
2 PIECEWISE POLYNOMIAL CURVES
In this chapter, we take a look into the splines. We will go through the theory on how to construct them. After that we will introduce useful properties of splines such as length of spline and derivation of splines, which are both used in constructing the theory for the optimization algorithm. To understand splines fully we have to first take a look shortly into polynomials because B-splines itself are piecewise-defined polynomial functions [2].
2.1 Polynomials
Before going into polynomials itself, we are going to shortly define the function continuity and derivability. Those both properties are needed at the spline theory but we will also use these for defining few properties for the polynomials.
Definition 2.1 (Function continuity [7]). Let f (x) be the function from I → R, where
I ⊂ R, and x0be the point, such that x0 ∈ I. If for any ε > 0 there is δ > 0 such that ∀x ∈ I, |x − x0| < δ =⇒ |f (x) − f (x0)| < ε, (2.1) then function f is called acontinuous at the point x0.
Let’s next define few continuity properties for the functions.
Lemma 2.1. Let f (x) = x be the function from R → R, then the function f (x) is
continu-ous.
Proof. Let f (x) = x, such that f : R → R. Let ε > 0. Let’s define δ = ε. For every x we have that |x − x0| < δ.
|f (x) − f (x0)| = |x − x0| < δ = ε.
Next, we will study the continuity when summing two continuous functions together.
functions f (x) + g(x) is continuous.
Proof. Let f (x) and g(x) be the continuous functions, ε = ε1+ ε2 > 0and δ > 0. Because f (x)is continuous, then for any ε1> 0there is δ1= δ/2 > 0such that
∀x ∈ R, |x − x0| < δ1 =⇒ |f (x) − f (x0)| < ε1.
Also, because g(x) is continuous, then for any ε2> 0there is δ2 = δ/2 > 0such that ∀x ∈ R, |x − x0| < δ2 =⇒ |g(x) − g(x0)| < ε2.
For every x we have that |x − x0| < δ.
|(f (x) + g(x)) − (f (x0) + g(x0))| = |f (x) + g(x) − f (x0) − g(x0)| = |f (x) − f (x0) + g(x) − g(x0)| ≤ |f (x) − f (x0)| + |g(x) − g(x0)| < ε1+ ε2
= ε.
Next, we are going to define the function differentiability.
Definition 2.2 (Function differentiability [7]). Let f be the function from I → R, where
I ⊂ R, and x0 be the point, such that x0 ∈ I. Let f be defined at the neighbourhood of x0. If
f′(x0) = lim h→0
f (x0+ h) − f (x0)
h (2.2)
exists and is finite, then f is calleddifferentiable at x0 and f′(x0)is thederivate of f at
point x0. Function is said to bedifferentiable, if it is differentiable at every point of its’ domain. Function is said to be continuously differentiable if it is differentiable and its’
derivative is continuous.
Now, when we have defined the function continuity and the differentiability, we can go to the polynomial theory. Polynomials are functions that are constructed by summing terms of the form axn. In that term, a is a coefficient of the corresponding term, x is the general variable and n is a positive integer. Highest n in function’s terms defines polynomials degree. [6]
Definition 2.3 (nth degree polynomial). Let n ∈ N and a ∈ R. n-th degree polynomial
is defined such that
f (x) = n ∑︂
i=0
aixi, (2.3)
the degree of the polynomial.
Next, we will go through few examples of different order polynomials.
Example 2.1. Let’s have a examples of 0, 1 and 2 degree polynomials.
1. 0 degree polynomial: f (x) = a, where a ∈ R. 2. 1 degree polynomial: f (x) = 2x + 1 or f (x) = x.
3. 2 degree polynomial: f (x) = 4x2+ 1or f (x) = x2+ xor f (x) = x2+ x + 1.
Polynomials have many useful properties that are useful when studying the splines the-ory. Next, we will introduce few of those properties and after that, we will also prove them.
Lemma 2.3 ([6]). Let f (x) be nth degree polynomial, g(x) be mth degree polynomial and
n, m ∈ N such that n < m. Then the following properties hold for both f and g: 1. f (x) + g(x) is mth degree polynomial. 2. cf (x) is nth degree polynomial, if c ̸= 0. 3. f (x)g(x) is m + nth degree polynomial. 4. f (x) is continuous. 5. f (x) + g(x) is continuous. 6. f (x)g(x) is continuous.
7. f (x) is infinitely times derivable.
Proof. Let f (x) be nth order polynomial, g(x) be mth order polynomial and n, m ∈ N such that n < m. Let f (x) =∑︁n
i=0aixi and g(x) = ∑︁m
i=0bixi.
1) With straight calculation
f (x) + g(x) = n ∑︂ i=0 aixi+ m ∑︂ j=0 bjxj = n ∑︂ i=0 aixi+ n ∑︂ j=0 (bjxj) + m ∑︂ j=n+1 bjxj = n ∑︂ i=0 (aixi+ bixi) + m ∑︂ j=n+1 bjxj = n ∑︂ i=0 ((ai+ bi)xi) + m ∑︂ j=n+1 bjxj = (a0+ b0) + (a1+ b1)x + . . . + (an+ bn)xn+ bn+1xn+1+ bn+2xn+2+ · · · + bmxm.
Because f (x) + g(x) can be written in polynomial form and m is the highest power of x, then f (x) + g(x) polynomial order is m.
2) Let c ∈ R and then by straight calculation cf (x) = c n ∑︂ i=0 aixi = n ∑︂ i=0 cai ⏞⏟⏟⏞ constant ·xi.
Because we get form where terms are form aixi, then cf (x) is also polynom and it’s order is n, if c ̸= 0.
3) With straight calculations
f (x)g(x) = n ∑︂ i=0 aixi m ∑︂ j=0 bjxj = (a0+ a1x + a2x2+ · · · + anxn)(b0+ b1x + b2x2+ · · · + bmxm) = (b0a0+ b0a1x + b0a2x2+ · · · + b0anxn) + (b1xa0+ b1xa1x + b1xa2x2+ · · · + b1xanxn) + . . . + (bmxma0+ bmxma1x + bmxma2x2+ · · · + bmxmanxn) = b0a0+ b0a1x + b0a2x2+ · · · + b0anxn+ b1a0x + b1a1x2+ b1a2x3 + · · · + b1anxn+1+ · · · + bma0xm+ bma1xm+1+ bma2xm+2 + · · · + bmanxm+n = b0(a0+ a1x + a2x2+ · · · + anxn) + b1(a0x + a1x2+ a2x3+ · · · + anxn+1) + . . . + bm(a0xm+ a1xm+1+ a2xm+2+ · · · + anxm+n) = b0 n ∑︂ i=0 aixi+ b1 n+1 ∑︂ i=1 ai−1xi+ · · · + bm n+m ∑︂ i=m ai−mxi.
Now by (1) and (2) f (x)g(x) is polynom. The highest exponent of f (x)g(x) is m + n, so f (x)g(x)polynomial order is m + n.
4) We know that x is continuous everywhere. If x is continuous everywhere, then x · x is continuous everywhere. Now by multiplying continuous x n-times we get that xn is continuous everywhere, for every n ∈ N. We know that the sum of continuous functions is continuous then x + x2+ · · · + xn is continuous. Also, we know that multiplying x by constant a ∈ R is still continuous. By these facts a0+a1x+a2x2+· · ·+anxnis continuous.
5) We know that the sum of continuous functions are continuous and by 4) polynomial are continuous, then also their sum is continuous.
6) We know that multiplying two continuous gives continuous function and by 4) poly-nomial are continuous, then also their product is continuous.
7) Because f (x) is polynom, then f (x) = a0 + a1x + a2x22 + · · · + anxn. Now with straight calculation derivate of f (x) is f′(x) = 0 + a1+ 2a2x2+ · · · + nanxn−1. Derivate is also polynom and its degree is one degree lower than original degree. So derivating the polynom only reduces degree of the polynom by 1. If we derivate f (x) n-times then fn(x) = (n · (n − 1) · (n − 2) · ... · 2 · 1). If we now derivate this one more time then derivate will be 0. As we know derivate of 0 is always zero, so after that all derivates are 0. Polynomials are simple functions that have nice properties. Because they are infinitely times differentiable they are called smooth functions which make them even more useful. Next, we will go through the piecewise polynomials. Piecewise polynomials are important when we are dealing with B-splines because they are constructed by piecewise polyno-mials. Piecewise polynomials are polynomials which are defined differently in different sections. Every section is defined by the polynomial. Piecewise polynomials are not necessarily continuous or can be continuous but in that case, they are not necessarily differentiable. Next example illustrates these cases.
Example 2.2. Let piecewise polynomial f (x) be defined such that
f (x) = ⎧ ⎨ ⎩ x 0 ≤ x ≤ 1 x + 1 x > 1.
This function is piecewise polynom, because all its parts are polynomials. This is not continuous function, because when we approach 1 from the left we get
lim x−→1
f (x) = lim x−→1
(x) → 1 and respectively when we approach 1 from the right we get
lim x+→1
f (x) = lim x+→1
(x + 1) → 2.
Now let piecewice polynomial f (x) be defined such that
f (x) = ⎧ ⎨ ⎩ x 0 ≤ x ≤ 1 −x + 2 x > 1.
continuous function, because when we approach 1 from left we get lim x−→1 f (x) = lim x−→1 (x) → 1 and respectively when we approach 1 from right side we get
lim x+→1
f (x) = lim x+→1
(−x + 2) → 1. This function is not differentiable, because if h > 0 we have that
f′(1) = lim h→0 f (1 + h) − f (1) h = lim h→0 −(1 + h) + 2 − 1 h = lim h→0 −1 − h + 1 h = lim h→0 −h h = lim h→0−1 = −1 and if h < 0 f′(1) = lim h→0 f (1 + h) − f (1) h = lim h→0 (1 + h) − 1 h = lim h→0 −1 + h + 1 h = lim h→0 h h = lim h→01 = 1.
Now because we approach different values, when approaching x = 1 from left and right, then function is not differentiable at point x = 1. Next photo illustrates both functions.
(a) Example of not continuous piecewise
poly-nom.
(b) Example of continuous piecewice polynom,
which is not differentiable.
Figure 2.1. Illustration of two different piecewice polynom, which are both not
differen-tiable, but second function is continuous.
As we saw in previous example piecewice polynomials can be discontinuous. In splines one of the most important properties is that splines are defined such that piecewice poly-nomials are continuous.
2.2 Divided difference
For the B-splines we need to also introduce divided differences and few of its’ properties.
Definition 2.4 (Divided difference [15]). Let g be a function. Then the divided differ-ence is [x0, ..., xn]g = n ∑︂ j=0 g(xj) ∏︁ k∈{0,...,n}\j(xj− xk) . (2.4)
Next we will introduce few properties for the divided difference, which are needed when proving the Cox De Boor recursion algorithm for the B-splines. We won’t go through the theory of the divided difference, because in this research it is only needed when con-structing the Cox de Boor recursion formula.
Lemma 2.4 ([3]). Let g be a function. Then
1. [xi]g = g(xi). 2. [xi, ..., xi+k]g =
[xi+1,...,xi+k]g−[xi,...,xi+k−1]g
xi+k−xi .
always one. Now by calculation [xi]g = i ∑︂ j=i g(xj) ∏︁ k∈{i}\j(xj − xk) = ∏︁ g(xi) k∈{i}\i(xi− xk) = g(xi) 1 = g(xi).
(2) Now by the previous property [xi]g = g(xi). Let’s next calculate [xi, xi+1]g. By straight calculation we have [xi, xi+1]g = i+1 ∑︂ j=i g(xj) ∏︁ k∈{i,i+1}\j(xj− xk) = ∏︁ g(xi) k∈{i,i+1}\i(xi− xk) +∏︁ g(xi+1) k∈{i,i+1}\i+1(xi+1− xk) = g(xi) (xi− xi+1) + g(xi+1) (xi+1− xi) = g(xi+1) (xi+1− xi) + −g(xi) (xi+1− xi) = g(xi+1) − g(xi) (xi+1− xi) = [xi+1]g − [xi]g xi+1− xi .
Respectively [xi, xi+1, xi+2]gis [xi, xi+1, xi+2]g = i+2 ∑︂ j=i g(xj) ∏︁ k∈{i,i+1,i+2}\j(xj − xk) = ∏︁ g(xi) k∈{i,i+1,i+2}\i(xi− xk) +∏︁ g(xi+1) k∈{i,i+1,i+2}\i+1(xi+1− xk) +∏︁ g(xi+2) k∈{i,i+1,i+2}\i+2(xi+2− xk) = g(xi) (xi− xi+1)(xi− xi+2) + g(xi+1)
(xi+1− xi)(xi+1− xi+2)
+ g(xi+2)
(xi+2− xi)(xi+2− xi+1)
= g(xi)
(xi+1− xi)(xi+2− xi)
+ −g(xi+1)
(xi+1− xi)(xi+2− xi+1)
+ g(xi+2)
(xi+2− xi)(xi+2− xi+1) = g(xi)(xi+2− xi+1)
(xi+1− xi)(xi+2− xi)(xi+2− xi+1) + −(xi+2− xi)g(xi+1)
(xi+1− xi)(xi+2− xi)(xi+2− xi+1) + (xi+1− xi)g(xi+2)
(xi+1− xi)(xi+2− xi)(xi+2− xi+1)
= g(xi)(xi+2− xi+1) − (xi+2− xi)g(xi+1) + (xi+1− xi)g(xi+2) (xi+1− xi)(xi+2− xi)(xi+2− xi+1)
= (xi+1
− xi)(xi+2− xi+1)((xg(xi)
i+1−xi)−
(xi+2−xi)g(xi+1)
(xi+1−xi)(xi+2−xi+1) +
g(xi+2)
(xi+2−xi+1))
(xi+1− xi)(xi+2− xi)(xi+2− xi+1) =
g(xi)
(xi+1−xi)−
(xi+2−xi)g(xi+1)
(xi+1−xi)(xi+2−xi+1)+
g(xi+2) (xi+2−xi+1) (xi+2− xi) = g(xi)(xi+2−xi) (xi+1−xi)(xi+2−xi)− (xi+2−xi)g(xi+1)
(xi+1−xi)(xi+2−xi+1) +
(xi+1−xi)g(xi+2)
(xi+1−xi)(xi+2−xi+1)
(xi+2− xi) =
g(xi)(xi+2−xi)−(xi+2−xi)g(xi+1)+(xi+1−xi)g(xi+2)−g(xi+1)xi+1+g(xi+1)xi+1)
(xi+1−xi)(xi+2−xi)
(xi+2− xi) =
(g(xi+2)−g(xi+1))(xi+1−xi)−(g(xi+1)−g(xi))(xi+2−xi+1)
(xi+1−xi)(xi+2−xi) (xi+2− xi) = g(xi+2)−g(xi+1) xi+2−xi+1 − g(xi+1)−g(xi) xi+1−xi) (xi+2− xi) = [xi+1, xi+2]g − [xi, xi+1]g
(xi+2− xi)
.
Now if we continue this recursively using previous results we obtain that
[xi, . . . , xi+k]g =
[xi+1, . . . , xi+k]g − [xi, . . . , xi+k−1]g xi+k− xi
Next we will go through the Leibniz’ formula for the divided difference. It is also used in construction of the recursion algorithm.
Lemma 2.5 (Leibniz’ formula [3]). Let g and h be functions of x. If (gh)(x) = g(x)h(x)
for all x, then
[x0, . . . , xk](gh) = k ∑︂
r=0
([x0, . . . , xr]g)([xr, . . . , xk]h). (2.5)
Proof. Let’s prove this by induction.
The base case: Let’s go through the case [x0](gh). Let’s assume that for all x hold that (gh)(x) = g(x)h(x). Now by straight calculation
[x0](gh) = (gh)(x0) = g(x0)h(x0) = [x0]g[x0]h.
Because [x0](gh) = [x0]g[x0]h, then this holds for the basic case.
The induction hypothesis: Let’s assume that holds
[x0, . . . , xk](gh) = k ∑︂
r=0
([x0, . . . , xr]g)([xr, . . . , xk]h). (2.6)
Let’s go through the couple of first steps to get the idea.
1st step: [x0, x1](gh) = [x1](gh) − [x0](gh) x1− x0 = (gh)(x1) − (gh)(x0) x1− x0 = g(x1)h(x1) − g(x0)h(x0) x1− x0 = g(x1)h(x1) + g(x1)h(x0) − g(x1)h(x0) − g(x0)h(x0) x1− x0 = g(x1)h(x1) − g(x1)h(x0) x1− x0 + g(x1)h(x0) − g(x0)h(x0) x1− x0 = g(x1)(h(x1) − h(x0)) x1− x0 +h(x0)(g(x1) − g(x0)) x1− x0 = g(x1) [x1]h − [x0]h x1− x0 + h(x0) [x1]g − [x0]g) x1− x0 = [x1]g[x0, x1]h + [x0, x1]g[x0]h = 1 ∑︂ r=0 ([x0, . . . , xr]g)([xr, . . . , x1]h).
2nd step: [x0, x1, x2](gh) = [x1, x2](gh) − [x0, x1](gh) x2− x0 = [x2]h[x1, x2]g + [x1, x2]h[x1]g − [x1]h[x0, x1]g − [x0, x1]h[x0]g x2− x0 = [x1, x2]h[x1]g − [x0, x1]h[x0]g x2− x0 +[x2]h[x1, x2]g − [x1]h[x0, x1]g x2− x0 = [x1, x2]h[x1]g − [x1, x2]h[x0]g + [x1, x2]h[x0]g − [x0, x1]h[x0]g x2− x0 +[x2]h[x1, x2]g − [x2]h[x0, x1]g + [x2]h[x0, x1]g − [x1]h[x0, x1]g x2− x0 = [x0]g([x1, x2]h − [x0, x1]h) x2− x0 +x1− x0 x2− x0 [x1, x2]h([x1]g − [x0]g) x1− x0 +[x2]h([x1, x2]g − [x0, x1]g) x2− x0 +x2− x1 x2− x0 [x0, x1]g([x2]h − [x1]h) x2− x1 = [x0]g[x0, x1, x2]h + x1− x0 x2− x0 [x0, x1]g[x1, x2]h + [x0, x1, x2]g[x3]h + x2− x1 x2− x0 [x0, x1]g[x1, x2]h = [x0]g[x0, x1, x2]h + [x0, x1]g[x1, x2]h + [x0, x1, x2]g[x2]h = 2 ∑︂ r=0 ([x0, . . . , xr]g)([xr, . . . , x2]h).
Induction step: Next we prove this for the case k + 1, at the first we apply equation (2.4),
use the induction hypothesis and then we get: [x0, . . . , xk+1](gh) = [x1, . . . , xk+1](gh) − [x0, . . . , xk](gh) xk+1− x0 = ∑︁k+1 r=1([x1, . . . , xr]g)([xr, . . . , xk+1]h) −∑︁kr=0([x0, . . . , xr]g)([xr, . . . , xk]h) xk+1− x0 = ∑︁k+1 r=1([x1, . . . , xr]g)([xr, . . . , xk+1]h) −∑︁kr=0([x0, . . . , xr]g)([xr, . . . , xk]h) xk+1− x0 .
Next we add and substract the term ∑︁k
r=0[x0,...,xr]g[xr+1,...,xk+1]h
the first two steps. Now we get [x0, . . . , xk+1](gh) = ∑︁k+1 r=1[x1, . . . , xr]g[xr, . . . , xk+1]h − ∑︁k r=0[x0, . . . , xr]g[xr+1, . . . , xk+1]h xk+1− x0 + ∑︁k r=0[x0, . . . , xr]g[xr+1, . . . , xk+1]h − ∑︁k r=0[x0, . . . , xr]g[xr, . . . , xk]h xk+1− x0 = ∑︁k+1 r=1[x1, . . . , xr]g[xr, . . . , xk+1]h − ∑︁k+1 r=1[x0, . . . , xr−1]g[xr, . . . , xk+1]h xk+1− x0 + ∑︁k r=0[x0, . . . , xr]g[xr+1, . . . , xk+1]h − [x0, . . . , xr]g[xr, . . . , xk]h xk+1− x0 = ∑︁k+1 r=1[x1, . . . , xr]g[xr, . . . , xk+1]h − [x0, . . . , xr−1]g[xr, . . . , xk+1]h xk+1− x0 + ∑︁k r=0[x0, . . . , xr]g([xr+1, . . . , xk+1]h − [xr, . . . , xk]h) xk+1− x0 = ∑︁k+1 r=1[xr, . . . , xk+1]h([x1, . . . , xr]g − [x0, . . . , xr−1]g) xk+1− x0 + ∑︁k r=0[x0, . . . , xr]g([xr+1, . . . , xk+1]h − [xr, . . . , xk]h) xk+1− x0 = k+1 ∑︂ r=1 xr− x0 xk+1− x0 [xr, . . . , xk+1]h [x1, . . . , xr]g − [x0, . . . , xr−1]g xr− x0 + k ∑︂ r=0 xk+1− xr xk+1− x0 [x0, . . . , xr]g [xr+1, . . . , xk+1]h − [xr, . . . , xk]h xk+1− xr = k+1 ∑︂ r=1 xr− x0 xk+1− x0 [x0, . . . , xr]g[xr, . . . , xk+1]h + k ∑︂ r=0 xk+1− xr xk+1− x0 [x0, . . . , xr]g[xr, . . . , xk+1]h.
Next we open the sum equations and see if we are able to simplify expression. [x0, . . . , xk+1](gh) = x1− x0 xk+1− x0 [x0, x1]g[x1, . . . , xk+1]h + x2− x0 xk+1− x0 [x0, x1, x2]g[x2, . . . , xk+1]h + · · · +xk+1− x0 xk+1− x0 [x0, . . . , xk+1]g[xk+1]h + xk+1− x0 xk+1− x0 [x0]g[x0, . . . , xk+1]h +xk+1− x1 xk+1− x0 [x0, x1]g[x1, . . . , xk+1]h + · · · + xk+1− xk xk+1− x0 [x0, . . . , xk]g[xk, xk+1]h = [x0]g[x0, . . . , xk+1]h + xk+1− x1+ x1− x0 xk+1− x0 [x0, x1]g[x1, . . . , xk+1]h +xk+1− x2+ x2− x0 xk+1− x0 [x0, x1, x2]g[x2, . . . , xk+1]h + · · · +xk+1− xk+ xk− x0 xk+1− x0 [x0, . . . , xk]g[xk, xk+1]h + [x0, . . . , xk+1]g[xk+1]h = [x0]g[x0, . . . , xk+1]h + [x0, x1]g[x1, . . . , xk+1]h + [x0, x1, x2]g[x2, . . . , xk+1]h + · · · + [x0, . . . , xk]g[xk, xk+1]h + [x0, . . . , xk+1]g[xk+1]h = k+1 ∑︂ r=0 ([x0, . . . , xr]g)([xr, . . . , xk+1]h).
As previously said we won’t go through much more theory about divided differences, because they are only needed for constructing the Cox de Boor recursion algorithm and they are not used anywhere else in this work. [13]
2.3 Splines
In this section, we are going to introduce and define the splines at the general level. Be-fore defining the splines we need to define a few other properties, which are needed in spline definition. Let’s first define the knot and the knot vector.
Definition 2.5 (Knot [19][2]). Let f (x) be the piecewise defined function. Let function be
defined in whole real-line such that first part is defined in section (−∞, t0]and then next sections are defined in the following sections [ti, ti+1], i = 0, . . . , m − 1and let the last part be defined in the section [tm, ∞). Now the point ti connects two parts together and that point is called as aknot.
Now when we have defined the knot, we will next define the knot vector. They both are a key thing at the spline theory and especially at the spline constructing.
Definition 2.6 (Knot vector [19]). Let f (x) be the piecewise defined function and ti be a ith knot of the function. The knot vector is the collection that contains all the knots
ti in non decreasing order, such that t0 ≤ t1 ≤ t2 ≤ · · · ≤ tm. If ti+1− ti = h∀i, then constructed spline is called auniform spline.
Now when we have defined all the necessary things for the splines, we are able to define the spline function.
Definition 2.7 (Spline of degree n [2]). Let S(t) be a function such that S : R → R.
Let also n be the degree of the spline function with the knot sequence T , where knot se-quence t0, . . . , tmis non decreasing sequence. Function S(t) is called a nth order spline function if it is defined on the entire real line and it fulfills the following three properties:
1. Function S(t) is defined by maximally degree n polynomial in each knot interval (−∞, t0],[ti, ti+1], i = 0, 1, . . . , m − 1and [tm, ∞).
2. Function S(t) is continuous everywhere.
3. Function’s S(t) maximally n − 1 order derivatives are continuous everywhere.
In the definition, we also talk about the degree of the spline. We haven’t defined the de-gree of the spline yet, because first, we had to define the spline. Next, we are going to define the degree of the spline.
Definition 2.8 (Degree of spline [2]). Let S(t) be the spline. Then the degree of the spline is the highest polynomial degree, which appears in any knot interval (−∞, t0],[ti, ti+1], i = 0, 1, . . . , m − 1and [tm, ∞).
In many literature and applications, when talking about splines there can be talked about the order of the spline. Order of the spline is a different thing than the degree of the spline. The next we are going to define the order of the spline.
Definition 2.9 (Order of spline [2]). Let S(t) be the spline. Let n be the degree of the
spline. Order of the spline is the highest number of defining coefficients in defining
poly-nomials in any knot interval (−∞, t0],[ti, ti+1], i = 0, 1, . . . , m − 1 and [tm, ∞). Because the degree of the spline is n and the n degree polynomials always have n + 1 coefficients, then order of the spline is n + 1.
Next, we define a property that makes it possible for the user easily to change the shape of the spline without changing the order of the spline.
Definition 2.10 (Control point [26]). Point that defines the shape of the spline is called
acontrol point.
Changing the control points location, always changes the shape of the spline. Splines are much used in computer graphics and computer science because they are quite easy
to construct and can be used to easily approximate complex shapes. In this work, we are going to usebasis splines (B-splines), which are also splines. Splines are such curves
that in all cases curve doesn’t go through all control points. If the curve goes through the all control points curve is said to be theinterpolating curve and in another case, the
curve isapproximating curve. [2] In our work we don’t mind if the curve goes through all
the points or not, but that is still useful property especially in data science where splines can be used to data analysis.
2.4 Basis splines
In this section, we are going to go through the theory of the B-splines. B-splines are splines, but they are constructed in specific way. They are constructed by using basis functions and control points. These together form a parametrized piecewise polynomial function.
Definition 2.11 (Basis spline [20]). Let S(t) be the spline. If the spline is defined in the
following way: S(t) = n−1 ∑︂ i=0 piNi,k(t), (2.7)
where Ni,k(t)is the basis function of order k for the knot span i and piis knot span’s the corresponding control point, then the spline is called a basis spline (B-spline).
Basis functions are constructed by using the Cox de Boor recursion algorithm. To be able to use that recursion algorithm we need to construct a knot sequence, define the control points and define the degree of the basis spline, which we are going to construct. Next, we will take a closer look into how knot vectors are constructed.
2.4.1 Constructing the knot sequence
In this section, we will go through the basics of constructing the knot vector and theory how knot vector effects on spline. There is two special knot sequences which should be mentioned. One of them is the knot vector of the form [. . . , 0, 0, 0, 1, 1, 1, . . . ]. In this case, spline only has two knots and the spline is constructed from Bernstein polynomial. The other special knot vector is uniform knot sequence which will be used in this work and we will discuss more of that. If a knot sequence is uniform, then all knots are equidistant in vector. In this case splines are calleduniform splines. [20]
If t0 < t1 < t2 < · · · < tm, then B-spline won’t necessary go through the first and last control point in all cases. In this problem we need to be sure that spline goes through the first and the last control point in all cases. This can be done by modifying knot vector, so that t1, . . . , tj = t0, ti, . . . , tm−1 = tm and every other points so that they are equidistant.
If we have this kind of knot vector, then B-spline will go through the first and last control point. In this case knot vector is callednon periodic equidistant knot vector. [20]
Lemma 2.6. If knot vector is constructed in the following way
⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ ti = t0 , if i ≤ k ti+1− ti = constant k ≤ i < n + 2 ti = tk+(n+1), i ≥ n + 2, (2.8)
then B-spline will go through the first and last control point. In this case knot vector is called anopen uniform knot vector.
To be able to prove the previous lemma, we need to first define the basis functions. Num-ber of required knots depends on degree of the spline and numNum-ber of control points. If spline degree is changed or control point amount is changed, knot sequence has to be constructed again. There exist relation between required number of knots, spline degree and number of control points, this relation is introduced in the following definition.
Definition 2.12. Let m be number of knots, n number of control points and k degree of
the spline. Then required number of knots can be calculated as follows
m = n + k + 1. (2.9)
Let’s take example of creating knot vector.
Example 2.3. Let degree of the spline be 2 and number of control points be 5, then
n = 5, k = 2. In this case, required number of knots is m = n + k + 1 = 5 + 2 + 1 = 8. So now we can construct one possible knot vector T = [0, 0, 0, 1, 2, 3, 3, 3]. We will continue working with this example later when we are constructing B-splines.
If knot sequence is not uniform and it is used to construct the B-spline, then constructed spline is callednon-uniform rational basis spline (NURBS). These splines are widely
used in computer graphics. One strength of NURBS is the quite easy formulas for degree elevation or reduction without changing the shape of the spline and also changing the number of control points without changing the shape of the spline. [20]
2.4.2 Basis functions and constructing B-spline
This section contains theory of the B-spline construction. For the construction we will use Cox De Boor recursion formula which is based on B-spline definition given by Curry and
Schoenberg [3].
Definition 2.13 (Basis function definition [3]). Let t be knot sequence. The ith basis
function of kth order B-spline is denoted by Ni,k and it is defined by
Ni,k(t) := (ti+k− ti)[ti, . . . , ti+k] max((t − x), 0)k−1, ∀x ∈ R, (2.10) where the max((t − x), 0) is the truncated power function. For truncated power function we define that (x)0
+ = 0for x < 0.
Let’s mark for the future mk(t) := max((t − x), 0)k−1. For equation (2.10) we can apply lemma (2.4) and then we have
Ni,k(t) = (ti+k− ti)[ti, . . . , ti+k]mk = (ti+k− ti)(
[ti+i, . . . , ti+k]mk− [ti, . . . , ti+k−1]mk ti+k− ti
) = [ti+1, . . . , ti+k]mk− [ti, . . . , ti+k−1]mk
By setting k = 1, we get basis functions for the first order B-spline and they are form Ni,1(t) = [ti+1]m1− [ti]m1
= ([ti+1] max((t − x), 0))1−1− ([ti] max((t − x), 0))1−1 = ([ti+1] max((t − x), 0))0− ([ti] max((t − x)0, 0))0 = max((t − ti+1), 0)0− max((t − ti), 0)0
This is characteristic function by the definition of the truncated power function. This can be represented now as a partial function as follows
Ni,1(t) = ⎧ ⎨ ⎩ 1 ti ≤ t < ti+1 0 otherwise (2.11)
Now we can construct recursion formula known as Cox De Boor recursion algorithm, by using the B-spline definition. [3]
Lemma 2.7 (Cox De Boor recursion algorithm [3]). Let T = {t1, t2, t3, . . . , tm} be se-quence of non decreasing real numbers, then kth degree B-spline basis functions can be written
where ωi,k = ⎧ ⎨ ⎩ t−ti ti+k−1−ti ti+k−1− ti ̸= 0 0 otherwise (2.13) and Ni,1(t) = ⎧ ⎨ ⎩ 1 ti ≤ t < ti+1 0 otherwise. (2.14)
Proof. Proof adapts the proof of B-spline property (i) at page 90 at the [3]. First we will use lemma (2.5). This is used for the kth divided difference of a product to the particular product
max(0, (t − x))k−1= (t − x) max(0, (t − x))k−2. Now we have
[ti, . . . , ti+k]mk= (ti− t)[ti, . . . , ti+k]mk−1+ [ti+1, . . . , ti+k]mk−1. (2.15) Now by using (2.4) (a) and fact that if for all r > i + 1 holds [ti, . . . , tr](t − x) = 0, then [ti, ti+1](t − x) = 1, we have that
(ti− t)[ti, . . . , ti+k] = (ti− t)
([ti+1, . . . , ti+k] − [ti, . . . , ti+k−1]) ti+k− ti
= ti− t ti+k− ti
([ti+1, . . . , ti+k] − [ti, . . . , ti+k−1]).
Next we apply that to (2.15) and we get [ti, . . . , ti+k]mk = t − ti ti+k− ti [ti, . . . , ti+k−1]mk−1+ ti+k− t ti+k− ti [ti+1, . . . , ti+k]mk−1 = t − ti ti+k− ti [ti, . . . , ti+k−1]mk−1+ ti+k− t ti+k− ti [ti+1, . . . , ti+k]mk−1
Next we multiply both sides with (ti+k− ti), when we get (ti+k− ti)[ti, . . . , ti+k]mk= (ti+k− ti)(
t − ti ti+k− ti [ti, . . . , ti+k−1]mk−1 + ti+k− t ti+k− ti [ti+1, . . . , ti+k]mk−1
Ni,k = (t − ti)[ti, . . . , ti+k−1]mk−1+ (ti+k− t)[ti+1, . . . , ti+k]mk−1 = (t − ti) ti+k−1− ti ti+k−1− ti [ti, . . . , ti+k−1]mk−1 + (ti+k− t) ti+1+k−1− ti+1 ti+1+k−1− ti+1 [ti+1, . . . , ti+k]mk−1 = t − ti ti+k−1− ti (ti+k−1− ti)[ti, . . . , ti+k−1]mk−1 + ti+k− t ti+1+k−1− ti+1
(ti+1+k−1− ti+1)[ti+1, . . . , ti+k]mk−1 = t − ti ti+k−1− ti Bi,k−1+ ti+k− t ti+1+k−1− ti+1 Ni+1,k−1 = ωi,kNi,k−1+ ti+k− t ti+1+k−1− ti+1 Ni+1,k−1 = ωi,kNi,k−1+ (
ti+k− ti+1− t + ti+1 ti+1+k−1− ti+1
)Ni+1,k−1 = ωi,kNi,k−1+ (
ti+1+k−1− ti+1− (t − ti+1) ti+1+k−1− ti+1 )Ni+1,k−1 = ωi,kNi,k−1+ ( ti+1+k−1− ti+1 ti+1+k−1− ti+1 − t − ti+1 ti+1+k−1− ti+1 )Ni+1,k−1 = ωi,kNi,k−1+ (1 − t − ti+1 ti+1+k−1− ti+1 )Ni+1,k−1 = ωi,kNi,k−1+ (1 − ωi+1,k)Ni+1,k−1.
Cox de Boor recursion algorithm is used for creating the basis functions for construct-ing the B-splines. Basis functions calculation only requires knot vector. Next we will go through one spline construction by hand. Calculating the spline by hand requires much calculation. Operations in the process are simple, but when calculating the basis func-tions by hand it is really easy to get confused by indexes.
Example 2.4 (Continue example 2.3). We constructed knot vector T = [0, 0, 0, 1, 2, 3, 3, 3]
in example 2.3. Now we will calculate basis functions by using Cox De Boor recursion algorithm. Because the order of the spline was 3 (k = 2), we have to calculate all basis functions of order 1 and 2 to be able to calculate 3rd order basis functions.
3rd order basis functions. N0,3 = t − 0 0 − 0N0,2(t) + 1 − t 1 − 0N1,2(t) = (1 − t)N1,2(t) = (1 − t)[︁ t − 0 0 − 0N0,1(t) + 1 − t 1 − 0N2,1(t) ]︁ = (1 − t)(1 − t)N2,1(t) = (1 − t)2N2,1(t) = (1 − 2t + t2)N2,1(t) N1,3 = t − 0 1 − 0N1,2(t) + 2 − t 2 − 0N2,2(t) = tN1,2(t) + 2 − t 2 N2,2(t) = t[︁ t − 0 0 − 0N1,1(t) + 1 − t 1 − 0N2,1(t)]︁ + 2 − t 2 [︁ t − 0 1 − 0N2,1(t) + 2 − t 2 − 1N3,1(t) ]︁ = t − t2N2,1(t) + 2 − t 2 [︁tN2,1(t) + (2 − t)N3,1(t) ]︁ = t − t2N2,1(t) + 2t − t2 2 N2,1(t) + (2 − t)2 2 N3,1(t) = (t − t2+2t − t 2 2 )N2,1(t) + (2 − t)2 2 N3,1(t) = (2t − 2t 2 2 + 2t − t2 2 )N2,1(t) + 4 − 4t + t2 2 N3,1(t) = 4t − 3t 2 2 N2,1(t) + 4 − 4t + t2 2 N3,1(t)
N2,3= t − 0 2 − 0N2,2(t) + 3 − t 3 − 1N3,2(t) = t 2N2,2(t) + 3 − t 2 N3,2(t) = t 2 [︁ t − 0 1 − 0N2,1(t) + 2 − t 2 − 1N3,1(t)]︁ + 3 − t 2 [︁ t − 1 2 − 1N3,1(t) + 3 − t 3 − 2N4,1(t) ]︁ = t 2 2N2,1(t) + ( 2t − t2 2 + 3 − t 2 (t − 1))N3,1(t) + 3 − t 2 (3 − t)N4,1(t) = t 2 2N2,1(t) + ( 2t − t2 2 + 3t − 3 − t2+ t 2 )N3,1(t) + (3 − t)2 2 N4,1(t) = t 2 2N2,1() + ( 2t − t2 2 + 4t − 3 − t2 2 )N3,1(t) + (3 − t)2 2 N4,1(t) = t 2 2N2,1(t) + 6t − 2t2− 3 2 N3,1(t) + 9 − 6t + t2 2 N4,1(t) N3,3= t − 1 3 − 1N3,2(t) + 3 − t 3 − 2N4,2(t) = t − 1 2 N3,2(t) + (3 − t)N4,2(t) = t − 1 2 [︁ t − 1 2 − 1N3,1(t) + 3 − t 3 − 2N4,1(t)]︁ + (3 − t)[︁ t − 2 3 − 2N4,1(t) + 3 − t 3 − 3N5,1(t) ]︁ = (t − 1) 2 2 N3,1(t) + (3 − t) t − 1 2 N4,1(t) + (3 − t)(t − 2)N4,1(t) = (t − 1) 2 2 N3,1(t) + (3 − t)( t − 1 2 + (t − 2))N4,1(t) = t 2− 2t + 1 2 N3,1(t) + (3 − t)( 3t − 5 2 )N4,1(t) = t 2− 2t + 1 2 N3,1(t) + ( 14t − 3t2− 15 2 )N4,1(t) N4,3= t − 2 3 − 2N4,2(t) + 3 − t 3 − 3N5,2(t) = (t − 2)N4,2(t) = (t − 2)[︁ t − 2 3 − 2N4,1(t) + 3 − t 3 − 3N5,1(t) ]︁ = (t − 2)2N4,1(t) = (t2− 4t + 4)N4,1(t).
So the basis functions are partial polynomial functions which are defined in different in-tervals.
N0,3 = ⎧ ⎨ ⎩ 1 − 2t + t2 0 ≤ t ≤ 1 0 otherwise N1,3 = ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ 4t−3t2 2 0 ≤ t ≤ 1 4−4t+t2 2 1 ≤ t ≤ 2 0 otherwise N2,3 = ⎧ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎪ ⎪ ⎪ ⎩ t2 2 0 ≤ t ≤ 1 6t−2t2−3 2 1 ≤ t ≤ 2 9−6t+t2 2 2 ≤ t ≤ 3 0 otherwise N3,3 = ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ t2−2t+1 2 1 ≤ t ≤ 2 14t−3t2−15 2 2 ≤ t ≤ 3 0 otherwise N4,3 = ⎧ ⎨ ⎩ t2− 4t + 4 2 ≤ t ≤ 3 0 otherwise.
Next figure will show how these basis functions behave as u changes.
Now we construct the spline function. S(t) = 4 ∑︂ i=0 piNi,3(t) = p0N0,3(t) + p1N1,3(t) + p2N2,3(t) + p3N2,3(t) + p4N4,4(t) = [1, 1]N0,3(t) + [2, 2]N1,3(t) + [3, 2]N2,3(t) + [4, 1]N2,3(t) + [5, 0]N4,4(t) = ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ [1 + 2t −12t2, 1 + 2t − t2] 0 ≤ t ≤ 1 [t +32, −t22 + t +32] 1 ≤ t ≤ 2 [12t2− t +7 2, − 1 2t 2+ t +3 2] 2 ≤ t ≤ 3.
Next figure will illustrate shape of the spline. Control points are marked also into the figure.
Figure 2.3. Spline functions of the example.
Now we have defined everything to be able to prove the lemma (2.6).
Proof of lemma (2.6). Let knot vector be [t0, ..., t0, tk+1, ..., tk+1, tk+n+1, ..., tk+n+1]and the control point vector be P = [p0, ..., pn−1]. Let’s calculate the first nonzero basis function
for kth order spline. N0,k = t − t0 tk−1− t0 N0,k−1(t) + (1 − t − t1 tk− t1 )N1,k−1 = t − t0 t0− t0 N0,k−1(t) + (1 − t − t1 tk− t1 )N1,k−1 = (1 − t − t1 t0− t1 )N1,k−1 = (1 − t − t0 t0− t0 )N1,k−1 = N1,k−1 .. . = N2,k−2 .. . = Nk−1,k−(k−1) = Nk−1,1 = 1.
Respectively the last nonzero basis function for kth order spline is Nn+2,k= t − tn+2 tn+2+k−1− tn+2 Nn+2,k−1(t) + (1 − t − tn+3 tn+2+k− tn+2 )Nn+3,k−1 = t − tn+1+k tn+1+k − tn+1+k Nn+2,k−1(t) + (1 − t − tn+3 tn+2+k− tn+2 )Nn+3,k−1 = (1 − t − tk+(n+1) tk+(n+1)− tk+(n+1))Nn+3,k−1 = 1 · Nn+3,k−1 .. . = Nn+4,k−2 .. . = N(k−1)+n+2,k−(k−1) = Nk+n+1,1 = 1.
Now, when t = t0, then S(0) = p0 and respectively when t = tk+n+1, then S(tk+n+1) = pn−1.
Changing the control points location always changes the shape of the spline. Changing one control point location affects only the previous part, the current part and the next part of the spline. This means that if we have many control points we only affect small parts of the spline and it makes possible to make many small curves during the spline. Instead, if
we have a small number of control points we will affect the longer part of the spline and we are not able to create that much curves during the spline. In this system, we will need the way to lock the input and output angle of the route. Input and output angle are locked by not changing the first two and last two control points. In this way, any change in control points doesn’t affect the first or last control point area and input and output angles remain the same. Locking the first two and last two control points means that spline has to have at least 5 control point to get algorithm work. [22]
2.5 Length of spline
To be able to determine drive time of the spline we need to be able to calculate length of the spline. There is few different ways to determine the length of the spline. We will introduce two of them. The first method is easier to implement into software algorithm and that’s why it is introduced and the other one is more theoretical approach to the length of spline. That approach is not easy to implement to the algorithm, because this approach needs more accurate initial conditions and it has more complicated calculations.
2.5.1 Multiple linear segments length approximation
One way to calculate spline length is to divide spline into arbitrary small parts and calcu-late distance of the parts. After that we get spline length by summing all parts distances together. This method is illustrated in the following figure. Figure illustrates how linear segment approximation works, when number of segments is increased.
Figure 2.4. Example of dividing spline into parts and calculating straight distance
be-tween points.
We can create general theorem for approximating spline length by linear segment ap-proximation method.
Theorem 2.8. Let S(t) be a arbitrary spline function and let S(t) be defined in [t0, tn], where t0 is starting point of spline and tn is end point of spline. Let metric to be usual metric, so that d(v1, v2) = √︁(x2− x1)2+ (y2− y1)2, where v1 = x1i + y1j and v2 = x2i + y2j. Length of the spline can be approximated as follows
l(S(t)) ≥ n−1 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))). (2.16) Proof. Let S(t) be a arbitrary spline function and let S(t) be defined in [t0, tn], where t0is starting point of spline and tnis end point of spline. Let metric be usual metric, such that d(v1, v2) =√︁(x2− x1)2+ (y2− y1)2. Let’s divide interval [t0, tn]in to equidistant n-parts. Now length of each part is tn−t0
n . Start point of the i-th part can be calculated such that we add i times length of each part in to the starting point t0 as follows
t0+
tn− t0 n · i.
End point can be calculated in same way but we only add one more part length as follows t0+
tn− t0
n · (i + 1). Distance between start and end point of the spline is
d(S(t0), S(tn)).
Now by the properties of the metric space [27] we have that d(S(t0), S(tn)) ≤ d(S(t0), S(t0+ tn− t0 2 )) + d(S(t0+ tn− t0 2 , S(t1))) ≤ d(S(t0), S(t0+ tn− t0 4 )) + d(S(t0+ tn− t0 4 ), S(t0+ tn− t0 2 )) + d(S(t0+ tn− t0 2 ), S(t0+ 3(tn− t0) 4 )) + d(S(t0+ 3(tn− t0) 4 ), S(t1))). If we continue this many times, then we have
d(S(t0), S(tn)) ≤ d(S(t0), S(t0+ tn− t0 n )) + d(S(t0+ tn− t0 n ), S(t0+ tn− t0 n · 2)) + ... + d(S(t0+ tn− t0 n · (n − 2)), S(t0+ 3(tn− t0) n · (n − 1))) + d(S(t0+ (tn− u0) n · (n − 1)), S(tn))) ≤ d(S(t0+ tn− t0 n · 0), S(t0+ tn− t0 n )) + d(S(t0+ tn− t0 n ), S(t0+ tn− t0 n · 2)) + ... + d(S(t0+ tn− t0 n · (n − 2)), S(t0+ 3(tn− t0) n · (n − 1))) + d(S(t0+ (tn− t0) n · (n − 1)), S(t0+ tn− t0 n · n))) ≤ n−1 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))). If n → ∞, then length of each part tn−t0
n
n→∞
−−−→ 0. This means that if we get big enough n < ∞, then distance between spline points tends to spline length of that part. Because of that, we can select big enough n such that when we go through all the parts of the spline and sum the distances between points we get the distance of spline. So for the big enough n we have that
n−1 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))) = l(S(t)). (2.17)
Now by the metric space properties [27] we have that l(S(t)) = n−1 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))) = d(S(t0+ tn− t0 n · 0), S(t0+ tn− t0 n )) + d(S(t0+ tn− t0 n ), S(t0+ tn− t0 n · 2)) + . . . + d(S(t0+ tn− t0 n · (n − 2)), S(t0+ 3(tn− t0) n · (n − 1))) + d(S(t0+ (tn− t0) n · (n − 1)), S(t0+ tn− t0 n · n))) ≥ d(S(t0+ tn− t0 n − 1 · 0), S(t0+ t1− t0 n − 1 )) + d(S(t0+ tn− t0 n − 1 ), S(t0+ tn− t0 n − 1 · 2)) + . . . + d(S(t0+ tn− t0 n − 1 · (n − 3)), S(t0+ 3(tn− t0) n − 1 · (n − 2))) + d(S(t0+ (tn− t0) n − 1 · (n − 2)), S(t0+ tn− t0 n − 1 · (n − 1))) = n−2 ∑︂ i=0 d(S(t0+ t1− t0 n − 1 · i), S(t0+ t1− t0 n − 1 · (i + 1))).
This method always gives the approximation of the length of the curve, only when n tends to infinity, the length of the curve tends to real distance of the curve. In many cases, n doesn’t need to be big to get good enough approximation of the length. Next, we will take look into maximum difference to the real distance of the curve.
Lemma 2.9. The maximal error in multiple linear segments length approximation is
errmax= l(S(t)) − d(S(t0), S(tn)). (2.18) Proof. Let S(t) be spline where t ∈ [t0, tn]. Let l(S(t)) be length of the spline. Now, the error is err = l(S(t)) − n−1 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))). Now if n is big enough then∑︁n−1
i=0 d(S(t0+ tn−t0
n · i), S(t0+ tn−t0
n · (i + 1))) = l(S(t)) and then the error is 0. Because
d(S(t0), S(tn)) ≤ d(S(t0)), S(t0+ tn− t0 2 · 1) + d(S(t0+ tn− t0 2 · 1), S(t0+ tn− t0 2 · 2,
then smallest distance is attained if n = 1. So now maximum error is errmax= l(S(t)) − 0 ∑︂ i=0 d(S(t0+ tn− t0 n · i), S(t0+ tn− t0 n · (i + 1))) errmax= l(S(t)) − d(S(t0+ tn− t0 1 · 0), S(t0+ tn− t0 1 · (0 + 1))) errmax= l(S(t)) − d(S(t0), S(t0+ tn− t0)) errmax= l(S(t)) − d(S(t0), S(tn)).
Because we can find the minimum for the error at the length of the curve, then with this method curve length can’t ever differ from the real length more than the maximum error. Because maximum error is attained when n = 1, then by growing the n always gives the better approximation or at least the same than previous length were.
Computing the distance needs much resources when spline is divided in to really small parts. This method is good when rough approximation is enough or there is much re-sources available. Let’s take one example, how to calculate spline distance with this method.
Example 2.5. Let’s continue from example 2.4, where we constructed B-spline. Now we
can calculate length of the that spline. Constructed spline was
S(t) = ⎧ ⎪ ⎪ ⎪ ⎨ ⎪ ⎪ ⎪ ⎩ [1 + 2t −12t2, 1 + 2t − t2] 0 ≤ t ≤ 1 [t +32, −t22 + t +32] 1 ≤ t ≤ 2 [12t2− t +72, −12t2+ t +32] 2 ≤ t ≤ 3
and knot vector was T = [0, 0, 0, 1, 2, 3, 3, 3]. Now length can be approximated by formula (2.16). Let’s calculate length by different values n = 1, 6, 100. Now, when n = 1, we have
that l1= 1 ∑︂ i=0 d(S(0 +3 − 0 2 · i), S(0 + 3 − 0 2 · (i + 1))) = d(S(0 + 3 − 0 1 · 0), S(0 + 3 − 0 1 · (0 + 1))) = d(S(0), S(0 + 3 · 1)) = d(S(0), S(3)) = d([1 + 2 · 0 − 1 2 · 0 2, 1 + 2 · 0 − 02], [1 23 2− 3 +7 2, − 1 23 2+ 3 +3 2]) = d([1, 1], [9 2− 6 2 + 7 2, − 9 2 + 6 2+ 3 2]) = d([1, 1], [10 2 , 0]) = d([1, 1], [5, 0]) =√︁(5 − 1)2+ (0 − 1)2 =√︁42+ 1 =√16 + 1 =√17 ≈ 4, 12. When n = 6, we have that
l6 = 5 ∑︂ i=0 d(S(0 +3 − 0 6 · i), S(0 + 3 − 0 6 · (i + 1))) = d(S(0 + 3 − 0 6 · 0), S(0 + 3 − 0 6 · (0 + 1))) + d(S(0 +3 − 0 6 · 1), S(0 + 3 − 0 6 · 2)) + ... + d(S(0 +3 − 0 6 · 5), S(0 + 3 − 0 6 · 6)) = d(S(0), S(3 6)) + d(S( 3 6), S( 3 3)) + ... + d(S( 15 6 ), S(3)) = d(S(0), S(1 2)) + d(S( 1 2), S(1)) + ... + d(S( 5 2), S(3))
Next, we have to calculate values of spline at points t = 12, 1,32, 2,52. S(1 2) = [1 + 2 1 2− 1 2( 1 2) 2, 1 + 21 2− ( 1 2) 2] = [1 + 1 −1 2 1 4, 1 + 1 − 1 4] = [15 8 , 7 4] S(1) = [1 + 2 · 1 − 1 21 2, 1 + 2 · 1 − 12] = [1 + 2 · 1 −1 21 2, 1 + 2 · 1 − 12] = [1 + 2 −1 2, 1 + 2 − 1] = [5 2, 2] S(3 2) = [ 3 2+ 3 2, − (32)2 2 + 3 2 + 3 2] = [6 2, − 9 4 2 + 6 2] = [3, −9 8+ 24 8 ] = [3,15 8 ] S(2) = [2 + 3 2, − 22 2 + 2 + 3 2] = [7 2, 3 2] S(5 2) = [ 1 2( 5 2) 2−5 2+ 7 2, − 1 2( 5 2) 2+5 2+ 3 2] = [1 2 25 4 + 2 2, − 1 2 25 4 + 8 2] = [25 8 + 8 8, − 25 8 + 32 8 ] = [33 8 , 7 8]. Now, we can calculate the distance
l6 = d([1, 1], [ 15 8 , 7 4]) + d([ 15 8 , 7 4], [ 5 2, 2]) + d([5 2, 2], [3, 15 8 ]) + d([3, 15 8 ], [ 7 2, 3 2]) + d([7 2, 3 2], [ 33 8 , 7 8]) + d([ 33 8 , 7 8], [5, 0]) = √ 85 8 + √ 29 8 + √ 17 8 + 5 8+ 5 4√2 + 7 4√2 ≈ 5, 087.
n = 100case is calculated with computer, but its logic is still the same. In n = 100 case we have that l100 = 5, 105.
(a) Example how spline length calculation
changes as n grows from 1 to 100.
(b) Example how spline lengths changes as n
grows.
Figure 2.5. Illustration how changing the n effects on spline length.
Another way to calculate length of the spline is to use so called "lenght of the parametrized curve". We will take a look into this method in the following subsection.
2.5.2 The length of the parametrized curve
Before we are going to introduce other way for calculating the length of the spline we have to make clear few definitions. The another, general definition for the curve length is introduced, because it is needed, when constructing the curvature theory. The first we define a parametrized curve.
Definition 2.14 (Parametrized curve [11]). Let t ∈ [a, b], where a, b ∈ R and a < b. Let
f (t) = [x(t), y(t)]. Now x(t) and y(t) arecomponent functions of f (t) and t is said to
be the parameter. Thecurve is the image of the f , in the other words the curve C is the
set of points such that C = [x(t), y(t)] : t ∈ [a, b]. In this case f is said to be aparametric representation of the curve C and the curve C is said to be the parametrized by the
function f .
Because the spline is a function with parametric representation, then it is a curve. In this system our splines are curves in R2. Next, we will define the curve smoothness.
Definition 2.15 ([11]). Let C be the curve and t be the parametrization of the curve C.
C is said to besmooth if there exist a continuously differentiable parametrisation c such
that c′(t) ̸= (0, 0) ∀t ∈ [a, b].
Next, we will define the reparametrization of the curve.
such that t ∈ [a, b]. Curves’ C reparametrization is an invertible differentiable function ϕ : [c, d] → [a, b], t = ϕ(s). From that we define a new parametrization
˜︁
r(s) = r(ϕ(s)), (2.19)
where s ∈ [c, d], c = ϕ−1(a)and d = ϕ−1(b).
Finally, we will define the length of the parametrized curve.
Definition 2.17 (Length of parametrized curve [5]). Let C be the curve, with injective
parametrization c(t), where t ∈ [t0, tn]. Now length of the curve l(C) can be calulated by
l(C) = ∫︂ tn
t0
||c′(t)||dt. (2.20)
The length of the curve doesn’t depend on the parametrization, if the parametrization is smooth.
Important thing when evaluating length of the parametrized curve is that the parametriza-tion is not allowed to go through same values in coordinate system twice when t changes. This means that curve cannot change the direction or create any sort of loops. Because of that, curves’ x-parameter function derivate have to be all the time positive or the nega-tive, it cannot change during the curve. When derivate is posinega-tive, curve is moving to right and x-values are growing, when t grows, and if derivate is negative, then curve is moving left and x-values are decreasing when t grows. [5]
Definition 2.18. Let s(t) be a parametrized function, where t ∈ [t0, tn]. If for all t1, t2 ∈ [t0, tn]
s(t1) = s(t2) ⇒ t1 = t2, (2.21)
then s(t) is injective.
Let’s go through few basic examples of injective and non-injective functions.
Example 2.6. Let s(t) = [t − 1, t + 2]. Now let’s take t1, t2 ∈ [t0, tn],such that t1 = a and t2 = b. Now by the straight calculation
s(t1) = s(t2) s(a) = s(b)
We know that this is true only when both vectors elements equal, so [a − 1, a + 2] = [b − 1, b + 2]
⇒ a − 1 = b − 1 ∧ a + 2 = b + 2 a = b ∧ a = b
⇒ t1 = t2.
So s(t) = [t − 1, t + 2] is injective. Let’s consider now s(t) = [cos(t), 1]. Now if we choose t1 = 2πand t2 = 4π, then
s(t1) = s(t2) s(2π) = s(4π) [cos(2π), 1] = [cos(4π), 1]
[1, 1] = [1, 1].
Now we get same value with two different values t1 = 2π and t2 = 4π. This means that s(t) = [cos(t), 1]is not injective.
Next we take one example of calculating the length of the curve.
Example 2.7. Let s(t) = [t2 + t, t − 1]be injective parametrization of the curve S, such that t ∈ [0, 5]. Now the length can be calculated as follows
l(S) = ∫︂ 5
0 √︁
(x′(t))2+ (y′(t))2dt.
Let’s first calculate derivatives
x′(t) = d(t2+ t) = 2t + 1
y′(t) = d(t − 1) = t.
Now the length is l(S) = ∫︂ 5 0 √︁ (x′(t))2+ (y′(t))2dt = ∫︂ 5 0 √︁ (2t + 1)2+ (t)2dt = ∫︂ 5 0 √︁ 4t2+ 4t + 1 + t2dt = ∫︂ 5 0 √︁ 5t2+ 4t + 1dt ≈ 32.538.
Calculating the length of the curve is more accurate and more light weight way to calcu-late curve distance than the way which was introduced earlier. However in many cases calculating length is much more complicated to implement, because before calculation you have to be sure that parametrization is injective and derivatives of parametrizations exist. In spline cases length can be calculated in sum of spline parts lengths. [5]
2.6 Derivative of B-spline
Differentiability of the spline is important property, because we need it for defining curva-ture of the spline and also for defining current slope of the spline. We will start with the first derivative of the basis function.
Theorem 2.10. Let T = [t0, t1, . . . , tm] be the knot sequence, then the derivative of a basis funcation is Ni,k′ (t) = k ti+k−1− ti Ni,k−1(t) − k ti+k− ti+1 Ni+1,k−1(t). (2.22) Proof. We will follow the proof from page 59 in [20]. Let’s prove this by induction. First if k = 2, then Ni,1(t) and Ni+1,1(t) are 0 or 1. Now derivation of Ni,2(t) derivative with respect to t can be calculated as follows
DNi,2(t) = D( t − ti ti+1− ti Ni,1(t) + ti+k− t ti+k− ti+1 Ni+1,1(t)). Now this is either
DNi,2(t) = D( t ti+1− ti − ti ti+1− ti ) Ni,2′ (t) = 1 ti+1− ti
or DNi,2(t) = D( ti+k ti+k− ti+1 − t ti+k− ti+1 ) Ni,2′ (t) = −1 ti+k− ti+1 .
Now we assume that this holds also for k − 1 case, where k > 2. Next we will prove this for the case k. In proof we will use derivation product rule (f g)′ = f′g + f g′. Now derivation of Ni,k(t)derivative with respect to t can be calculated as follows
D(Ni,k(t)) = D( t − ti ti+k−1− ti Ni,k−1(t) + ti+k− t ti+k− ti+1 Ni+1,k−1(t)) Ni,k′ (t) = 1 ti+k−1− ti Ni,k−1(t) + t − ti ti+k−1− ti Ni,k−1′ (t) − 1 ti+k− ti+1 Ni+1,k−1(t) + ti+k− t ti+k− ti+1 Ni+1,k−1′ (t).
By assumption that equation (2.22) holds for k − 1 case, then we can use this formula for the Ni,k−1′ (t)and Ni+1,k−1′ (t). Then we have that
Ni,k′ (t) = 1 ti+k−1− ti Ni,k−1(t) + t − ti ti+k−1− ti [︃ k − 1 ti+k−2− ti Ni,k−2(t) − k − 1 ti+k−1− ti+1 Ni+1,k−2(t) ]︃ − 1 ti+k− ti+1 Ni+1,k−1(t) + ti+k− t ti+k− ti+1 [︃ k − 1 ti+k−1− ti+1 Ni+1,k−2(t) − k − 1 ti+k− ti+2 Ni+2,k−2(t) ]︃ = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + t − ti ti+k−1− ti [︃ k − 1 ti+k−2− ti Ni,k−2(t) − k − 1 ti+k−1− ti+1 Ni+1,k−2(t) ]︃ + ti+k− t ti+k− ti+1 [︃ k − 1 ti+k−1− ti+1 Ni+1,k−2(t) − k − 1 ti+k− ti+2 Ni+2,k−2(t) ]︃ = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + t − ti ti+k−1− ti k − 1 ti+k−2− ti Ni,k−2(t) − t − ti ti+k−1− ti k − 1 ti+k−1− ti+1 Ni+1,k−2(t) + ti+k− t ti+k− ti+1 k − 1 ti+k−1− ti+1 Ni+1,k−2(t) − ti+k− t ti+k− ti+1 k − 1 ti+k− ti+2 Ni+2,k−2(t) = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + t − ti ti+k−1− ti k − 1 ti+k−2− ti Ni,k−2(t) − ti+k− t ti+k− ti+1 k − 1 ti+k− ti+2 Ni+2,k−2(t) + k − 1 ti+k−1− ti+1 (︃ − t − ti ti+k−1− ti + ti+k− t ti+k− ti+1 )︃ Ni+1,k−2(t).
Now we notice that − t − ti ti+k−1− ti + ti+k− t ti+k− ti+1 = 1 − t − ti ti+k−1− ti + ti+k− t ti+k− ti+1 − 1 = ti+k−1− ti ti+k−1− ti − t − ti ti+k−1− ti + ti+k− t ti+k− ti+1 −ti+k− ti+1 ti+k− ti+1 = ti+k−1− ti− t + ti ti+k−1− ti
+ti+k− t − ti+k+ ti+1 ti+k− ti+1 = ti+k−1− t ti+k−1− ti + ti+1− t ti+k− ti+1 .
By using this we have that Ni,k′ (t) = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + t − ti ti+k−1− ti k − 1 ti+k−2− ti Ni,k−2(t) − ti+k− t ti+k− ti+1 k − 1 ti+k− ti+2 Ni+2,k−2(t) + k − 1 ti+k−1− ti+1 (︃ ti+k−1− t ti+k−1− ti + ti+1− t ti+k− ti+1 )︃ Ni+1,k−2(t) = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + k − 1 ti+k−1− ti t − ti ti+k−2− ti Ni,k−2(t) − ti+k− t ti+k− ti+1 k − 1 ti+k− ti+2 Ni+2,k−2(t) + k − 1 ti+k−1− ti ti+k− t ti+k−1− ti+1 Ni+1,k−2(t) − k − 1 ti+k−1− ti+1 t − ti+1 ti+k− ti+1 Ni+1,k−2(t) = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + k − 1 ti+k−1− ti (︃ t − ti ti+k−2− ti Ni,k−2(t) + ti+k− t ti+k−1− ti+1 Ni+1,k−2(t) )︃ − k − 1 ti+k− ti+1 (︃ t − ti+1 ti+k−1− ti+1 Ni+1,k−2(t) + ti+k− t ti+k− ti+2 Ni+2,k−2(t) )︃ = 1 ti+k−1− ti Ni,k−1(t) − 1 ti+k− ti+1 Ni+1,k−1(t) + k − 1 ti+k−1− ti Ni,k−1(t) − k − 1 ti+k− ti+1 Ni+1,k−1(t) = k ti+k−1− ti Ni,k−1(t) − k ti+k− ti+1 Ni+1,k−1(t).
Now because equation (2.22) holds also for case k, then by induction it holds also for all cases.