• Embed Doc
  • Readcast
  • Collections
  • CommentGo Back
Download
 
Test data for B-spline operators based on Galerkin
L
2
projection.
Wrap
Mathematica
's B-spline routines so they match the GNU Scientific Library's semantics. Note that
Mathematica
workswith piecewise polynomial degree while the GSL uses piecewise order plus one.
In[1]:=
Knots
k_, b_
:
Join
ConstantArray
First
b
, k
1
, b, ConstantArray
Last
b
, k
1

Lastdof
k_, b_
:
Length
Knots
k, b

k
1
2;Basis
k_, b_
:
BSplineBasis

k
1, Knots
k, b

,
1,
2
&
Provide some sample breakpoints for testing purposes and visualize some different basis orders:
In[4]:=
b
Sort

0, 1, 3
2, 2, 9
8, 3

;
In[5]:=
Plotem 
k_
:
Plot
Table
Basis
k, b

i, x
,
i, 0, Lastdof
k, b

,
x, First
b
, Last
b

, PlotRange
Full, PlotLabel
k
Table
Plotem 
k
,
k, 1, 4

Out[6]=
0.5 1.0 1.5 2.0 2.5 3.00.20.40.60.81.0
1
,
0.20.40.60.81.0
2
,
 
0.5 1.0 1.5 2.0 2.5 3.00.5 1.0 1.5 2.0 2.5 3.00.20.40.60.81.0
3
,
0.5 1.0 1.5 2.0 2.5 3.00.20.40.60.81.0
4
Compute the Galerkin
L
2
-based mass matrices for the above bases:
In[7]:=
MassMatrix
k_, b_
:
Module

B
Basis
k, b
, n
Lastdof
k, b
, Table
Integrate
B
i, x
B
j, x
,
x, First
b
, Last
b

,
i, 0, n
,
j, 0, n

;
In[8]:=
MassMatrix
1, b

MatrixForm MassMatrix
2, b

MatrixForm MassMatrix
3, b

MatrixForm MassMatrix
4, b

MatrixForm 
2
 
BsplineGalerkinL2Operators.nb 
of 00

Leave a Comment

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