Uploaded by japplema042

AME 302 HW 6

advertisement
Instructor: Hacker
Name:
Course: AME 302
Chapter 6 Homework Set
Polynomial Curve Fitting and Interpolation
Instructions: Problems in this course are classified into three basic components:
Part 1: True-False concept questions.
Part 2: Basic-computational-skills (BCS) questions.
Part 3: Derivation, analysis, and problem-solving questions
This homework is broke into the first two components with the third part showing up in a separate
homework set for Part 3 problems. The rules for each component are listed below.
Part 1: There is no partial credit given for true-false problems. You do not need to show any work for
these problems.
Part 2: There is no partial credit given for multiple-choice problems. Although there is no partial credit
on this assignment, you must show your work on all of the problems. If you fail to show work you
will receive a zero for the problem even if it is correct.
Part 3: On these problems you must show all of your work to receive any credit. If in doubt, write it out!
Show your work as clearly as you can: if I can’t understand how you got an answer, I will not
give you credit for it. Remember, I know how to solve the problem; and to make matters worse,
I have a lot of training in following logical arguments!
Warning: The definition of “little or no work” will be determined by the instructor, not the
student.
Parts 1-3: Circle your answers here. Do not detach this sheet from the homework.
1.
T
F
6.
a
b
c
d
e
11.
(10 pts)
2.
T
F
7.
a
b
c
d
e
12.
(10 pts)
3.
T
F
8.
a
b
c
d
e
13.
(10 pts)
4.
T
F
9.
a
b
c
d
e
5.
T
F
10.
a
b
c
d
e
Attention: For all problems involving writing a MATLAB program you must turn in
your MATLAB code with the output to receive any credit!
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
2
Part 1: True-or-False Concept Questions Component
Polynomial Curve Fitting and Interpolation
Problem 1. True or False: Unless n is small, it is not wise to use the standard form of
an nth -degree polynomial, P (x) = an xn + · · · + a1 x + a0 , to interpolate data because the
resulting system of equations leads to an ill-condition matrix, known as the Vandermonde
matrix.
Problem 2. True or False: Ignoring any e↵ects due to round o↵ error, theoretically an
nth -order Newton interpolating polynomial is mathematically equivalent to an nth -order
Lagrange interpolating polynomial.
Problem 3. True or False: In general, the algorithm for computing the coefficients for
an nth -order Newton interpolating polynomial is more stable (i.e., better conditioned),
than the algorithm for computing the coefficients for an nth -order polynomial in standard
form: P (x) = an xn + · · · + a1 x + a0 , which yields more accurate numerical results.
Problem 4. True or False: The higher the order of the interpolating polynomial, the
more accurate it becomes. This can be seen by observing that the terms in the Taylor
series of the polynomial become smaller with higher order.
Problem 5. True or False: The higher the order of a best-fit polynomial, the more
accurate it becomes. This is because it has more data to optimize.
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
3
Part 2: Basic Computational Skills Component
Polynomial fit and interpolation by a single polynomial
Problem 6 (General Form). Let P2 (x) = a1 x2 + a2 x + a3 . Use the direct evaluation
method (i.e., substitute in the xi and yi to get a system of equations for the ai ’s.) to
determine the coefficients of the parabola that passes through the given set of points
{(xi , yi )|i = 1, 2, 3} in the table below. Evaluate it at x = 350. Keep 3 significant figures.
labels
x1
x2
x3
x
y
300
0.616
400
0.525
500
0.457
The resulting matrix equation should be of the form:
2 2
32 3 2 3
x1 x1 1
a1
y1
2
4 x 2 x 2 1 5 4 a2 5 = 4 y 2 5
x23 x3 1
a3
y3
(a)
P2 (350) = 0.42
(b)
P2 (350) = 0.57
(c)
P2 (350) = 0.68
(d)
Matrix is not invertible
(e)
None of these
Problem 7 (Newton Interpolation Polynomial). .
(a) Identify the appropriate order of the Newton interpolating polynomial needed to
uniquely interpolate the given data:
{(x1 , f (x1 )), (x2 , f (x2 )), (x3 , f (x3 )), (x4 , f (x4 ))} = {(0, 0), (1, 1), (2, 6), (3, 21)}.
(b) Determine the unique coefficients bi , of the appropriate Newton interpolating polynomial. Express the polynomial in the form:
Pn 1 (x) = b1 + b2 (x
x1 ) + b3 (x
x1 )(x
x2 ) + · · · + bn (x
x1 )(x
x2 ) · · · (x
xn 1 ) ,
given in the formula sheet for Newton Polynomials.
(c) Evaluate the polynomial you found in part (a) at the intermediate value x = 1/2.
What is the absolute relative error between the exact value 3/8 and your approximation?
(a)
0
(b)
0.12
(c)
0.27
(d)
0.83
(e)
None of these
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
4
Problem 8 (Lagrange Interpolation Polynomial). .
(a) Identify the appropriate order of the Lagrange interpolating polynomial needed to
uniquely interpolate the given data:
{(x1 , f (x1 )), (x2 , f (x2 )), (x3 , f (x3 )), (x4 , f (x4 ))} = {(0, 0), (1, 1), (2, 6), (3, 21)}.
(b) Determine the unique weight functions, Li (x), of the appropriate Lagrange interpolating polynomial. Express the polynomial in the form:
Pn 1 (x) =
n
X
Li (x)f (xi ) ,
i=1
given in the formula sheet for Lagrange Polynomials.
(c) Evaluate the polynomial you found in part (a) at the intermediate value x = 1/2.
What is the relative error between the exact value 3/8 and your approximation?
(a)
0
(b)
0.12
(c)
0.27
(d)
0.83
(e)
None of these
Problem 9 (MATLAB’s built-in functions polyfit and polyval). .
In 1901, Carl Runge came up with a simple example of a function that demonstrated
the type of errors that can occur with high-order polynomial approximations. He took
equal-spaced points over the interval [ 1, 1] from the function f (x) = 1/(1 + 25x2 ),1
which came to be known as Runge’s function.
Use polyfit and polyval to fit fourth- and tenth-order polynomials to 5 and 11 equally
spaced points to approximate f (x) with x1 = 1 and xn = 1. Plot each of the approximating polynomials next to the exact solution. Also be sure and label the sampled points
from f on your graph as well. Use your graph, or direct computation, to estimate the
magnitude of the error |f (0.94) P10 (0.94)| to the nearest hundredth.
(a)
1.72
(b)
1.82
(c)
1.92
(d)
2.02
(e)
None of these
1
This is just the inversion of a simple parabola: y = 1 + 25x2 to get a bell-like curve.
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
5
Problem 10. To measure g (the acceleration due to gravity),
the following experiment is carried out. A ball is dropped from
the top of a 100-m-tall building. As the object is falling down,
the time t when it passes sensors mounted on the building wall
is recorded. The data measured in the experiment is given in
the table.
In terms of the coordinates shown in the figure, the position of the ball h as a function of
the time t is given by h = h0 g2 t2 , where h0 = 100 m is the initial position of the ball.
Use linear regression to best fit the equation to the data and determine the experimental
value of g. Round your answer to three decimal places.
(a)
9.785
(b)
9.810
(c)
9.825
(d)
9.831
(e)
None of these
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
6
Part 3: Derivation, Analysis, and Problem-Solving Component
Splines and Piecewise Interpolation
Problem 11. Consider Runge’s function, f (x) = 1/(1 + 25x2 ), over the interval [ 1, 1].
Use the MATLAB command x = linspace(-1,1) to generate 11 equally-spaced data
points over the interval [ 1, 1]. Use the MATLAB command interp1 with the option
’spline’ to interpolate the 11-point data set: (xi , yi ) for i = 1, . . . , 11 with yi = f (xi ).
Compare your answer with the one you got in problem 9 using polyfit. Which method,
splines or a single interpolating polynomial, does a better job at approximating the
function in between the given data?
Problem 12. Fit the data given below with a cubic spline with (i) not-a-knot, (ii)
clamped, and (iii) natural end conditions using the appropriate MATLAB built-in spline
functions and graph the results on the same plot. Be sure and label your graphs with a
legend that is properly labelled.
x
y
1
1
2
5
2.5
7
3
8
4
2
5
1
For clamped ends define yc = [4,y,-1].
Recall: MATLAB’s spline function cannot do natural end points.
AME 302 chapter 6 hw set
Copyright ©Wayne Hacker 2018. All rights reserved.
7
Problem 13 (MATLAB’s built-in function spline). .
The drag force on a smooth rigid sphere immersed in a uniform flow field is known to be
of the form:
1
Fdrag = ⇢ACd V 2 , (⇤)
2
2
where ⇢ is density of the fluid, A = ⇡D /4 is shadow area of the sphere (i.e., the crosssectional area transverse to the direction of the stream), Cd is the dimensionless drag
coefficient, and V is the speed of the fluid relative to the sphere.
The drag coefficient Cd for smooth spheres is known to vary as a function of the Reynolds
number Re, a dimensionless number that gives a measure of the ratio of inertial forces
to viscous forces:
⇢V D
Re =
,
µ
where ⇢ = the fluid’s density (kg/m3 ), V = the fluid velocity (m/s), D = diameter (m),
and µ = dynamic viscosity (kg/(m·s). Although the relationship of drag to the Reynolds
number is sometimes available in equation form, it is frequently tabulated. The following
table provides experimental data for the drag coefficient of a smooth spherical ball as a
function of Reynolds number:
Re⇥10
CD
4
2
0.52
5.8
0.52
16.8
0.52
27.2
0.5
29.9
0.49
33.9
0.44
36.3
0.18
40
0.074
46
0.067
60
0.08
100
0.12
200
0.16
400
0.19
Write a script involving a cubic spline approximation for the experimental data array:
ReCd=[2, 5.8, 16.8, 27.2, 29.9, 33.9, 36.3, 40, 46, 60, 100, 200, 400; 0.52, 0.52, 0.52, 0.5,
0.49, 0.44, 0.18, 0.074, 0.067, 0.08, 0.12, 0.16, 0.19]
and use it to generate a labeled plot of the drag force versus velocity for a sphere with the
following parameter values for the script: D = 0.3 m, ⇢ = 1.3 kg/m3 , and µ = 1.825⇥10 5
kg/(m·s). Note: All units are in consistent MKS SI units.
Hint: You will to determine the drag coefficient as a function of velocity.
Instructions: Turn in your script and a plot of the drag coefficient as a function of
velocity over the data range. Be sure and use red circles for the data that overlay the
solution curve.
Download