
212 Introduction to Computational Linear Algebra
Let then for each interior node i, 2 ≤ i ≤ n − 1:
ψ
i
(x) =
(x − x
i+1
)(x − x
i+
1
2
)
h
2
i
2
x ∈ [x
i
, x
i+1
]
(x − x
i−1
)(x − x
i−
1
2
)
h
2
i−1
2
x ∈ [x
i−1
, x
i
]
0 otherwise
and at the boundary nodes:
ψ
1
(x) =
(x − x
2
)(x − x
3
2
)
h
2
1
2
x ∈ [x
1
, x
2
]
0 otherwise
ψ
n
(x) =
(x − x
n−1
)(x − x
n−
1
2
)
h
2
n−1
2
x ∈ [x
n−1
, x
n
]
0 otherwise
Note that ψ
i
(x
i
) = 1 and ψ
i
(x
j
) = 0, ∀j 6= i.
A Lagrangian basis of S
2
(Π) consists of:
{ψ
i
(x) |i = 1 : n} ∪ {η
i
(x) |i = 1 : m}
where:
η
i
(x) =
(x − x
i
)(x
i+1
− x)
h
2
i
4
x
i
≤ x ≤ x
i+1
0 otherwise
Obviously, one has:
∀ϕ ∈ S
2
(Π), ϕ(x) =
n
X
i=1
ϕ
i
ψ
i
(x) +
m
X
i=1
ϕ
i+
1
2
η(x).
Implementation
The finite element solution ...