06.09.2021 Views

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

First Semester in Numerical Analysis with Julia, 2020a

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.

CHAPTER 3. INTERPOLATION 126<br />

In [2]: v=[1 1 0 0 0 0]'<br />

Out[2]: 6×1 Array{Int64,2}:<br />

1<br />

1<br />

0<br />

0<br />

0<br />

0<br />

In [3]: A\v<br />

Out[3]: 6×1 Array{Float64,2}:<br />

1.5<br />

-0.5<br />

-1.0<br />

4.5<br />

-3.0<br />

0.5<br />

Therefore, the polynomials are:<br />

S 0 (x) =1.5x − 0.5x 3<br />

S 1 (x) =−1+4.5x − 3x 2 +0.5x 3<br />

Solv<strong>in</strong>g the equations of a spl<strong>in</strong>e even for three data po<strong>in</strong>ts can be tedious. Fortunately,<br />

there is a general approach to solv<strong>in</strong>g the equations for natural and clamped spl<strong>in</strong>es, for any<br />

number of data po<strong>in</strong>ts. We will use this approach when we write <strong>Julia</strong> codes for spl<strong>in</strong>es next.<br />

Exercise 3.4-1:<br />

F<strong>in</strong>d the natural cubic spl<strong>in</strong>e <strong>in</strong>terpolant for the follow<strong>in</strong>g data:<br />

x -1 0 1<br />

y 1 2 0

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

Saved successfully!

Ooh no, something went wrong!