Assignment: Python Code Required
1. Write a code to compute a natural spline S(x) which interpolates a collection of given points (xo, yo), (x1, y1), ... (xn, Yn) where x0 < x1 < x2 < ... < xn (do not assume they are equidistributed). Your code should have a triadiagonal solver for the resulting linear system of equations (you're not allowed to use Matlab's \ operator to solve the linear system).
2. One important application of spline interpolation is the construction of smooth curves that are not necessarily the graph of a function but that have a parametric representation x = x(t) and y = y(t) for t ε [a, b]. Hence one needs to determine two splines interpolating (tj,xj) and (tj, yj) (j = 0, 1, ... n).
The arc length of the curve is a natural choice for the parameter t. However, this is not known a priori and instead the tj's are usually chosen as the distances of consecutive points:
to = 0, tj = tj-i + √[(xj - xj-1)2 + (yj-uj-1)2], j= 1, 2, ...n. (1)
Use the values in Table 1 to construct a smooth parametric representation of a curve passing through the points (xj, yj), j = 0, 1, ... , 8 by finding the two natural cubic splines interpolating (ti, xj) and (ti,yj), j = 0, 1, ... 8, respectively. Tabulate the coefficients of the splines and plot the resulting (parametric) curve.
j
|
tj
|
xj
|
yj
|
0
|
0
|
1.50
|
0.75
|
1
|
0.618
|
0.90
|
0.90
|
2
|
0.935
|
0.60
|
1.00
|
3
|
1.255
|
0.35
|
0.80
|
4
|
1.636
|
0.20
|
0.45
|
5
|
1.905
|
0.10
|
0.20
|
6
|
2.317
|
0.50
|
0.10
|
7
|
2.827
|
1.00
|
0.20
|
8
|
3.330
|
1.50
|
0.25
|
Table 1: Table of data for Problem 2.
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also include a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also Include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.