21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Algorithmic approach to finding s:<br />

Reuse representation through cubic Hermite basis polynomials from (9.3.2):<br />

which can be obtained by the chain rule and from dτ<br />

dt = h−1 j<br />

.<br />

(9.4.4)<br />

⇒ s ′′<br />

|[t j−1 ,t j ] (t j−1) = −6 · s(t j−1 )h −2<br />

j<br />

s ′′<br />

|[t j−1 ,t j ] (t j) = 6 · s(t j−1 )h −2<br />

j<br />

+ 6 · s(t j )h −2<br />

j − 4 · h −1<br />

j s ′ (t j−1 ) − 2 · h −1<br />

j s ′ (t j ) ,<br />

+ −6 · s(t j )h −2<br />

j + 2 · h −1<br />

j s ′ (t j−1 ) + 4 · h −1<br />

j s ′ (t j ) .<br />

(9.3.1)<br />

with h j := t j − t j−1 , τ := (t − t j−1 )/h j .<br />

s |[tj−1 ,t j ] (t) = s(t j−1) ·(1 − 3τ 2 + 2τ 3 )+<br />

s(t j ) ·(3τ 2 − 2τ 3 )+<br />

h j s ′ (t j−1 ) ·(τ − 2τ 2 + τ 3 )+<br />

h j s ′ (t j ) ·(−τ 2 + τ 3 ) ,<br />

➣ Task of cubic spline interpolation boils down to finding slopes s ′ (t j ) in nodes of the mesh.<br />

(9.4.2)<br />

(9.4.3) ➙ n − 1 linear equations for n slopes c j := s ′ (t j )<br />

(<br />

1 2<br />

c<br />

h j−1 + + 2 )<br />

(<br />

c<br />

j h j h j + 1 yj − y j−1<br />

c<br />

j+1 h j+1 = 3<br />

j+1 h 2 j<br />

for j = 1,...,n − 1.<br />

+ y )<br />

j+1 − y j<br />

h 2 , (9.4.5)<br />

j+1<br />

Once these slopes are known, the efficient local evaluation of a cubic spline function can be done as<br />

for a cubic Hermite interpolant, see Sect. 9.3.1, Code 9.3.0.<br />

Note: if s(t j ), s ′ (t j ), j = 0, ...,n, are fixed, then the representation (9.4.2) already guarantees<br />

s ∈ C 1 ([t 0 ,t n ]), cf. the discussion for cubic Hermite interpolation, Sect. 9.3.<br />

Ôº¾ º<br />

Ôº¾ º<br />

➣ only continuity of s ′′ has to be enforced by choice of s ′ (t j )<br />

⇕<br />

will yield extra conditions to fix the s ′ (t j )<br />

However, do the<br />

interpolation conditions (9.4.1) s(t j ) = y j , j = 0, ...,n, and the<br />

regularity constraint s ∈ C 2 ([t 0 , t n ])<br />

(9.4.5) ⇔ undetermined (n − 1) × (n + 1) linear system of equations<br />

⎛<br />

⎛<br />

⎞<br />

b 0 a 1 b 1 0 · · · · · · 0 ⎛ ⎞<br />

0 b 1 a 2 b 2<br />

c 3<br />

0<br />

0 ... . .. ... .<br />

⎜ . . .. ... ...<br />

⎜ .<br />

⎟<br />

⎟⎝<br />

⎠ = .<br />

⎝<br />

... a n−1 b n−2 0 ⎠ ⎜<br />

c<br />

0 · · · · · · 0 b n−2 a 0 b n ⎝<br />

n−1 3<br />

(<br />

y 1 −y 0<br />

h 2 + y 2−y 1<br />

1 h 2 2<br />

)<br />

(<br />

y n−1 −y n−2<br />

h 2 + y n−y n−1<br />

n−1<br />

h 2 n<br />

⎞<br />

. (9.4.6)<br />

) ⎟<br />

⎠<br />

uniquely determine the unknown slopes c j := s ′ (t j ) ?<br />

➙<br />

two additional constraints are required, (at least) three different choices are possible:<br />

s ∈ C 2 ([t 0 ,t n ]) ⇒ n − 1 continuity constraints for s ′′ (t) at the internal nodes<br />

s ′′<br />

|[t j−1 ,t j ] (t j) = s ′′<br />

|[t j ,t j+1 ] (t j) , j = 1, ...,n − 1 . (9.4.3)<br />

➀ Complete cubic spline interpolation: s ′ (t 0 ) = c 0 , s ′ (t n ) = c n prescribed.<br />

➁ Natural cubic spline interpolation: s ′′ (t 0 ) = s ′′ (t n ) = 0<br />

Based on (9.4.2), we express (9.4.3) in concrete terms, using<br />

s ′′<br />

|[t j−1 ,t j ] (t) = s(t j−1)h −2<br />

j 6(−1 + 2τ) + s(t j )h −2<br />

j 6(1 − 2τ)<br />

+ h −1<br />

j s ′ (t j−1 )(−4 + 6τ) + h −1<br />

j s ′ (t j )(−2 + 6τ) ,<br />

(9.4.4)<br />

Ôº¾ º<br />

2<br />

h c 1 0 + h 1 c 1 1 = 3 y 1 − y 0<br />

h 2 1<br />

, 1<br />

hn<br />

c n−1 + h 2 c n n = 3 y n − y n−1<br />

h 2 .<br />

n<br />

Ôº¾ º

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!