• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
An example of linear and quadratic b - spline values andderivatives for a fixed set of knots. To be used when verifying B- spline implementations (e.g. PPPACK, gsl_bspline).
In[35]:=
Define Bsplines recursively
Clear
t, x, B, dB
;B
j
, 0
:
If
x

j

x

j
1

, 1, 0
&;B
j
, n
:
Function
t, FullSimplify
If
t
x

j

&&x

j
n

x

j

,
  
t
x

j

x

j
n

x

j

B
j, n
1

t
,0
If
t
x

j
n
1

&& x

j
n
1

x

j
1

,
  
x

j
n
1

tx

j
n
1

x

j
1

B
j
1, n
1

t
,0

;
In[38]:=
Establish our knots
x
3,
3,
3, 2, 9, 12, 21, 21, 21
;
Establish our sample locations
xloc

t
0
,
t
5
,
t
9
,
t
12
,
t
15

;
In[40]:=
Examine k
2 linears
Plot

B
1, 1

t
, B
2, 1

t
, B
3, 1

t
, B
4, 1

t
, B
5, 1

t
, B
6, 1

t

,
t,
4, 22
, PlotRange
Full
Out[40]=
51015200.20.40.60.81.0
 
In[41]:=
Table
B
i, 1

t
,
i, 6
 
MatrixForm Table
B
i, 1

t
,
i, 6
 
. xloc

MatrixForm 
Out[41]//MatrixForm=
0
µ
 
2
t5
3
t
2
ر
  
9
t7
2
t
9
  
3
t5
3
t
2
ر
4
 
t3
9
t
12
  
17
2
t
2
t
9
ر
  
21
t9
12
t
21
  
13
9
t
9
t
12
µ
 
19
12
t
12
t
21
Out[42]//MatrixForm=
0
 
25
  
35
0 0 00 0
 
47
  
37
0 00 0 0 1 0 00 0 0 0 1 00 0 0 0
 
23
  
13
2
 
bsplineverification.nb 
 
In[43]:=
D
Table
B
i, 1

t
,
i, 5

, t
 
MatrixForm 
For indeterminate values, consult the function table and use the valuecorresponding to either left or right continuity in your implementation
D
Table
B
i, 1

t
,
i, 5

, t
 
. xloc

MatrixForm 
ut 43 // atrx orm=
0
ر
0 t
3
 
15
3
t
20 t
2Indeterminate True
ر
0 t
3
  
15
3
t
2
 
17
2
t
90 t
9Indeterminate True
ر
0 t
2
  
17
2
t
9
 
13
9
t
120 t
12Indeterminate True
ر
0 t
9
  
13
9
t
12
 
19
12
t
210 t
21Indeterminate True
Out[44]//MatrixForm=
0
 
15
  
15
0 00 0
 
17
  
17
00 0 Indeterminate Indeterminate Indeterminate0 0 0 Indeterminate Indeterminate0 0 0 0
 
19
In[45]:=
Examine k
3 quadratics
Plot

B
1, 2

t
, B
2, 2

t
, B
3, 2

t
, B
4, 2

t
, B
5, 2

t
, B
6, 2

t

,
t,
3, 21
, PlotRange
Full
Out[45]=
51015200.20.40.60.81.0
bsplineverification.nb 
 
3
of 00

Leave a Comment

You must be to leave a comment.
Submit
Characters: ...
You must be to leave a comment.
Submit
Characters: ...