Professional Documents
Culture Documents
Cubic Spline p2
Cubic Spline p2
Cubic Spline p2
hi
6
z
i+1
and D
i
=
yi
hi
hi
6
z
i
.
This, however, is not the most ecient computational form. We would like to use the idea of nested
multiplication, so write:
S
i
(x) = a
i
+ b
i
(x x
i
) + c
i
(x x
i
)
2
+ d
i
(x x
i
)
3
Notice that this is just the innite Taylor expansion S
i
(x) =
n=1
1
n!
(x x
i
)
n
S
(n)
i
(x
i
) (with S
(n)
i
= 0 for
n 4 since S
i
is a cubic polynomial).
Therefore,
a
i
= S
i
(x
i
) = y
i
b
i
= S
i
(x
i
) =
h
i
6
z
i+1
h
i
3
z
i
+
y
i+1
y
i
h
i
c
i
=
1
2
S
i
(x
i
) =
z
i
2
d
i
=
1
6
S
i
(x
i
) =
z
i+1
z
i
6h
i
Algorithm for Evaluating S(x)
for i = 0 : n 1
if x x
i+1
break;
end
end
h = x
i+1
x
i
Compute a, b, c and d as above.
S = a + (x x
i
) (b + (x x
i
) (c + (x x
i
)d))
How many ops are required to for each spline function evaluation?