Quiz 05inp Spline Solution
Quiz 05inp Spline Solution
Spline Method
Interpolation
COMPLETE SOLUTION SET
1. The following n data points, (x1 , y1 ) , (x 2 , y 2 ) , …….. ( xn , y n ) , are given. For conducting
quadratic spline interpolation the x-data needs to be
(A) equally spaced
(B) placed in ascending or descending order of x -values
(C) integers
(D) positive
Solution
The correct answer is (B).
The following n data points, (x1 , y1 ) , ( x 2 , y 2 ) , …….. ( x n , y n ) , are given. For conducting
quadratic spline interpolation the x-data needs to be arranged in ascending or descending order.
2. In cubic spline interpolation,
(A) the first derivatives of the splines are continuous at the interior data
points
(B) the second derivatives of the splines are continuous at the interior data
points
(C) the first and the second derivatives of the splines are continuous at the
interior data points
(D) the third derivatives of the splines are continuous at the interior data
points
Solution
The correct answer is (C).
In cubic spline interpolation, the first and the second derivatives of the splines are continuous at
the interior data points. In quadratic spline interpolation, only the first derivatives of the splines
are continuous at the interior data points.
3. The following incomplete y vs. x data is given.
x
1 2 4 6 7
y
5 11 ???? ???? 32
The data is fit by quadratic spline interpolants given by
f ( x ) = ax − 1 , 1 ≤ x ≤ 2
f ( x ) = −2 x 2 + 14 x − 9, 2 ≤ x ≤ 4
f ( x ) = bx 2 + cx + d , 4 ≤ x ≤ 6
f (x ) = 25 x 2 − 303x + 928, 6 ≤ x ≤ 7
where a, b, c, and d are constants. The value of c is most nearly
(A) − 303.00
(B) − 144.50
(C) 0.0000
(D) 14.000
Solution
The correct answer is (C).
Since the first derivatives of two quadratic splines are continuous at the interior points, at x = 4
d
dx
(bx 2 + cx − d ) =
d
dx
(
− 2 x 2 + 14 x − 9 )
x=4 x=4
2bx + c x = 4 = − 4 x + 14 x = 4
2(4)b + c = −4(4) + 14
8b + c = −2 (1)
and at x = 6
d
dx
(bx 2 + cx − d ) = (25 x 2 − 303 x + 928)
d
dx
x =6 x =6
2bx + c x =6 = 50 x − 303 x =6
2(6)b + c = 50(6) − 303
12b + c = −3 (2)
x 1 2 4 6 7
y 5 11 ???? ???? 32
The data is fit by quadratic spline interpolants given by
f ( x ) = ax − 1, 1 ≤ x ≤ 2 ,
f ( x ) = −2 x 2 + 14 x − 9, 2 ≤ x ≤ 4
f ( x ) = bx 2 + cx + d , 4 ≤ x ≤ 6
f ( x ) = ex 2 + fx + g , 6 ≤ x ≤ 7
df
where a, b, c, d , e, f , and g are constants. The value of at x = 2.6 most nearly is
dx
(A) − 144.50
(B) − 4.0000
(C) 3.6000
(D) 12.200
Solution
The correct answer is (C).
1 2 4 x 6 7
y
5 11 ???? ???? 32
The data is fit by quadratic spline interpolants given by
f ( x ) = ax − 1, 1 ≤ x ≤ 2 ,
f ( x ) = −2 x 2 + 14 x − 9, 2 ≤ x ≤ 4
f ( x ) = bx 2 + cx + d , 4 ≤ x ≤ 6
f (x ) = 25 x 2 − 303x + 928, 6 ≤ x ≤ 7
3.5
Where a, b, c, and d are constants. What is the value of ∫ f (x )dx ?
1.5
(A) 23.500
(B) 25.667
(C) 25.750
(D) 28.000
Solution
The correct answer is (C).
3.5 2 3.5
∫ f ( x )dx = ∫ (6 x − 1)dx + ∫ (− 2 x )
+ 14 x − 9 dx
2
1.5 1.5 2
2 3.5
⎡6 ⎤ ⎡ 2 14 ⎤
= ⎢ x 2 − x ⎥ + ⎢− x 3 + x 2 − 9 x ⎥
⎣2 ⎦1.5 ⎣ 3 2 ⎦2
[( ) (
= 3 × 2 2 − 2 − 3 × 1.52 − 1.5 + )]
⎡⎛ 2 ⎞ ⎛ 2 3 ⎞⎤
⎢⎜ − 3 × 3.5 + 7 × 3.5 − 9 × 3.5 ⎟ − ⎜ − 3 × 2 + 7 × 2 − 9 × 2 ⎟⎥
3 2 2
⎣⎝ ⎠ ⎝ ⎠⎦
= [(12 − 2 ) − (6.75 − 1.5)] +
[(− 28.583 + 85.75 − 31.5) − (− 5.3333 + 28 − 18)]
= [4.75] + [21]
= 25.75
6. A robot needs to follow a path that passes consecutively through six points as shown
in the figure. To find the shortest path that is also smooth you would recommend
which of the following?
(A) Pass a fifth order polynomial through the data
(B) Pass linear splines through the data
(C) Pass quadratic splines through the data
(D) Regress the data to a second order polynomial
Path of a Robot
8
7
6
5
4
y
3
2
1
0
0 5 10 15
x
Solution
The correct answer is (C).
Using linear splines (Choice B) would create a straight-line path between consecutive points.
Although this will be the shortest path it will not be smooth. Regressing the data to a second
order polynomial (Choice D) will result in a smooth path but it will not pass through all the
points. As demonstrated in the following figure, using polynomial interpolation such as choice
(A) is a bad idea and will result in a long path. By using quadratic spline interpolation (choice
C), the path will be short as well as smooth.
10
6
y
0
0 2 4 6 8 10 12
x