241 final exam solution fa01

15
ENGRD 241: Engineering Computation December 20, 2001 SOLUTION TO FINAL EXAM This is an open-book, open-notes, and open-problem-set examination. Each problem starts on a separate page. Do all work on these sheets, and confine your solution to each problem to its own page, using the back of the page if necessary . Because these sheets may be temporarily separated for grading purposes, be sure to print your name on each and every page , and to observe and sign the pledge on this cover sheet. Show all work (including equations, formulas, and sketches where appropriate), and include only an appropriate number of significant figures for numerical values. Read all problems before beginning and follow directions carefully. Problems have the value indicated, and the total number of points is 150 for the 2½-hour (150-minute) examination – plan your time accordingly. Partial credit is available for all problems, so you are advised to work on all of them. You must submit all of these pages upon completion of the exam, whether or not you have attempted all problems. Name (Print): _______________________________________ Academic integrity is expected of all students of Cornell University at all times, whether in the presence or absence of members of the faculty. Understanding this, I declare that I shall not give, use, or receive unauthorized aid in this examination. Signature: _____________________________ Grading Summary: Problem Score Value 1 15 2 15 3 20 4 15 5 15 6 20 7 20

Upload: bd87gl

Post on 28-Apr-2015

16 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: 241 Final Exam Solution Fa01

ENGRD 241: Engineering Computation December 20, 2001

SOLUTION TO FINAL EXAM

This is an open-book, open-notes, and open-problem-set examination. Each problem starts on a separate page. Do all work on these sheets, and confine your solution to each problem to its own page, using the back of the page if necessary. Because these sheets may be temporarily separated for grading purposes, be sure to print your name on each and every page, and to observe and sign the pledge on this cover sheet. Show all work (including equations, formulas, and sketches where appropriate), and include only an appropriate number of significant figures for numerical values. Read all problems before beginning and follow directions carefully. Problems have the value indicated, and the total number of points is 150 for the 2½-hour (150-minute) examination – plan your time accordingly. Partial credit is available for all problems, so you are advised to work on all of them. You must submit all of these pages upon completion of the exam, whether or not you have attempted all problems.

Name (Print): _______________________________________

Academic integrity is expected of all students of Cornell University at all times, whether in the presence or absence of members of the faculty. Understanding this, I declare that I shall not give, use, or receive unauthorized aid in this examination.

Signature: _____________________________

Grading Summary:

Problem Score Value

1 15

2 15

3 20

4 15

5 15

6 20

7 20

8 15

9 15

Total 150

Letter Grade

Page 2: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

1. Ordinary Differential Equations, Initial Value Problems [15 points]Consider the first-order equation with initial condition

(a) Use a value of Δx = h = 1.0 to find y(1) by the “classical” fourth-order Runge-Kutta (RK) method, showing all equations and work.

(b) By how much would the truncation error in y(1) decrease if one used a step size of Δx = h = 0.25? [Do not solve again for Δx = h = 0.25.]

(c) Briefly explain the significance (i.e., the mathematical or graphical nature) of the k’s in RK methods, using the 4th-order RK method as an example.

(a)

(25.40)

(25.40a)

(25.40b)

(25.40c)

(25.40d)

(b) The 4th-order RK method is O(h4) – from the name and C&C p. 702. Therefore, as h goes from 1.0 to 0.25, the truncation error decreases by a multiplicative factor of (0.25/1.0) 4 = 0.0039

(c) The k’s in the RK methods are approximations of the slope y' at different locations along the step. For the 4th-order method, k1 is the slope at the beginning of the step, k2 is a first estimate of the slope at the middle of the step, k3 is an improved estimate at the middle, and k4 is an estimate of the slope at the end of the step. These slopes are then combined in a weighted average to produce an effective slope for the solution step, Eq. (25.40).

2. Ordinary Differential Equations, Boundary Value Problems [15 Points]You wish to solve the following boundary value problem for the steady-state temperature in a rod of length 10m (C&C Problems 27.1-27.3):

(a) For a finite difference solution, write the discrete version of this equation at a typical interior point x = xi using O(h2) finite divided difference operators. Assume that Δx = h = 0.5 is uniform throughout the length of the rod. [Do not write out the full matrix equations for this problem, just write the one equation for the one typical interior point, i.e., the computational “molecule.”]

Page 3: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

(b) You now decide that it would be more convenient to solve this problem by the shooting method (garden hose method) because you have handy a flexible and well-designed Excel spreadsheet for the fourth-order Runge-Kutta method.

(i) Re-write the second-order equation as two first-order differential equations that you will use in your spreadsheet macros.

(ii) Using Δx = h = 0.2, you obtain the following values from your spreadsheet corresponding to two assumed (trial) initial conditions for T'(0):

When T'(0) = –60, you find T(10) = 129.481ºWhen T'(0) = –65, you find T(10) = –56.951º

What value of T'(0) would you use next? Is this likely to give you a solution that satisfies the “far” boundary condition? Why?

(a)

(b) (i) Let , then the two first-order equations are:

(iii) From Lecture Notes 7C, page 1, with T'(0) = z0: zo = zo(1)+

Because this is a linear problem, this linearly interpolated initial value will yield the correct solution from our spreadsheet using the same value of h = 0.2 (but one should always actually try it out to verify the calculation of the interpolant).

3. Partial Differential Equations [20 points](a) Classify the following PDE’s as elliptic, parabolic, or hyperbolic and as linear or

nonlinear. Show or explain your reasoning. Assume that E, F, D, ψ, and c are positive functions and that ψ < 1.

(i) The generalized Poisson equation

(ii) The generalized convection-diffusion equation

(iii) The equation governing the behavior of a wake behind a thin plate held fixed in a uniform stream of incompressible viscous fluid so that the plate is edgewise to the flow. [Ref: S. H. Crandall, Engineering Analysis, McGraw-Hill, 1956, Chapter 6.]

Page 4: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

(iv) The generalized wave equation

(v) The biharmonic equation

(b) What auxiliary conditions – and how many of each – are needed to solve (analytically or numerically) the following second-order PDE’s. It is recommended that you use sketches to clarify your answers.

(i) Elliptic in 2D space (e.g., Laplace equation)(ii) Parabolic in 1D space (e.g., the heat equation)(iii) Hyperbolic in 1D space (e.g., the wave equation)

(a) For the second-order equations, examine the sign of B2 – 4AC in

[C&C pp. 813-814]

(i) A = E, B = 0, C = F B2 – 4AC = –4EF elliptic and linear(ii) A = D, B = C = 0 B2 – 4AC = 0 parabolic and nonlinear from u u' term

(iii) A = B = 0, C = B2 – 4AC = 0 parabolic and nonlinear from

term

(iv) A = c, B = 0, C = –1 B2 – 4AC = 4c hyperbolic and linear(v) This is not second-order so we cannot use examination of B2 – 4AC. However,

because there are no time derivatives or first or second derivatives of independent variables other than x or y, we deduce that this represents a steady-state problem for a closed 2D domain and is thus elliptic. It is also linear.

(b) (i) Need one boundary condition (Dirichlet: u = f; Neumann: = g; or mixed: a u + b = c) on every point on the boundary. Typically, these problems have a closed domain, i.e., a boundary completely surrounding the spatial domain. (Because elliptic equations represent steady-state behavior, initial conditions are not relevant or needed.)

(ii) Need boundary conditions on both ends of the 1D spatial domain (Dirichlet, Neumann, or mixed), e.g., Dirichlet would be specified for all t. Also need initial conditions for the dependent variable over the entire space at the beginning of the time span, e.g., . The domain is closed in space but open in future time.

(iii) Need boundary conditions on both ends of the 1D spatial domain (Dirichlet, Neumann, or mixed) – same as for part b(ii). Also need two initial conditions – the dependent variable and its first derivative with respect to time – over the entire space at the beginning of the time span, e.g., (initial displacement)

Page 5: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

and (initial velocity). The domain is closed in space but open in future time.

4. Partial Differential Equations [15 points]Consider the heat conduction equation in 2 spatial dimensions:

You plan to solve this numerically using the finite difference method and, rather than using the ADI scheme, you will solve using an implicit method and the solution of the 2D spatial matrix equations at each time step. Assume Δx = Δy = h. Write the finite difference equation for a typical interior grid point (in either equation or computational-molecule form) for the simple implicit method. Use the following indices: subscript i for the x-direction grid points, subscript

j for the y-direction grid points, and superscript ℓ for the time levels, e.g., , and use

appropriate additions or subtractions to the indices to indicate adjacent points in space-time. Assume that all values have already been computed up to the time level ℓ.

For the simple implicit method we write the spatial operator at time ℓ+1 and the time operator as a backward difference from time ℓ+1 to ℓ. The spatial operator is the operator from C&C Eq. (29.8) written at time ℓ+1 but multiplied by k/h2:

The time operator is given in C&C Eq. (30.3) [identical for forward or backward finite-divided difference in time] but with subscripts that account for 2 spatial dimensions:

Using the usual notation of , we can combine these to obtain the equation form of the computational molecule, in which all the unknowns are collected on the left-hand side:

5. Rootfinding [15 points]The locations of sampling points for Gaussian Quadrature (sometimes called "Gauss-Legendre quadrature") are the roots (zeros) of Legendre polynomial. For example, for six-point Gaussian Quadrature, the Legendre polynomial of sixth order is

(Note: All the zeros of the Legendre polynomials are less than one in magnitude and, for polynomials of even order, are symmetrical about the origin.) [Acknowledgment: C. F. Gerald & P. O. Wheatley, Applied Numerical Analysis, Addison-Wesley, 4th Edition, 1989, prob. 1.63.] In an

Page 6: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

attempt to find the sampling point near 0.65 for the sixth-order Legendre polynomial, the following spreadsheet calculations have been performed.

For each of the indicated missing results (i) through (iii), write the equation and calculate the value. Use 9 significant figures for values of x.

(i)

(ii)

(results may differ due to rounding and differences in pocket calculators)

(iii)

6. Systems of Equations [20 points]You are to solve the following set of equations iteratively by the Gauss-Seidel method:

Page 7: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

(a) Will the Gauss-Seidel method converge for this problem? Justify your answer.(b) The textbook suggests using a trial starting value for the iterative solution of

. Suggest an alternative set of starting values that might be closer to the

final answers and explain your rationale.(c) Write the three iterative equations you will use in general symbolic form, including proper

superscripts on the to indicate the iteration number.(d) Perform (only) two (2) full iterations numerically, and calculate the approximate error of

each iteration.

(a) A sufficient condition for convergence of the Gauss-Seidel method is given on page 9 of Lecture Notes 3B and on C&C page 293, Eq. (11.10):

That is, the system must be diagonally dominant. This set of equations fulfills this condition, so the method will converge.

(b) Because of the diagonal dominance, a good first approximate solution is given by , that is, by neglecting the off-diagonal terms. For this problem, this

approximation yields:

(c) The Gauss-Seidel equations are given on page 8 of Lecture Notes 3B or by C&C Eqs. (11.5) with appropriate superscripts added to show that the most recent values are used:

(d) Use starting values from part (b). [But full credit for correct calculations with any starting values.]

Page 8: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

[Converged solution is ]

7. Interpolation and Curve Fitting [20 points]The following data for creep rate, , the time rate at which strain increases, and the corresponding stress, , were obtained from a creep test performed at room temperature on a wire composed of 40% tin, 60% lead, and a solid solder core. Use a power-law, least-squares curve fit of the equation to find the values of B and m. [This is based on C&C Problem

20.49, page 561.]

Creep rate, min-1 0.0004

0.0011

0.0031

Stress, MPa 5.775 8.577 12.555

Let y = log and x = log . Then when we take logs of the full equation, we obtain the linear equation or . We can find the intercept and slope by linear regression, that is, by means of C&C Eqs. (17.4) to (17.7). We can arrange the necessary calculations in tabular form as follows:

i xi = log yi = log xi2 xiyi

1 0.76155 -3.3979 0.57996

-2.5877

2 0.93232 -2.9586 0.86922

-2.7584

3 1.09882 -2.5086 1.20740

-2.7565

Σ 2.79269 -8.8651 2.65658

-8.1026

Then

and

Page 9: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

8. Numerical Integration [15 points]The following integral is being evaluated by Gaussian Quadrature with six sampling points.

[As an aside, notice that the integrand is singular at x = 1 since ln(2/0) is infinite, and that the value of the integrand is indeterminate (but not singular) at x = 0 since ln(1)/0 = 0/0; however, because Gaussian Quadrature is an open method, it never requires the evaluation of the integrand at the end points of the interval of integration. Acknowledgment: R. W. Hornbeck, Numerical Methods, Quantum Publishers, 1975, prob. 8.13.] The following partial results for this problem have been obtained with a spreadsheet program:

(a) For each of the indicated missing results (i) through (iv), write the equation and calculate the value.

(b) If the exact answer is I = π2/4 = 2.4674011, what is the true relative error of the approximate numerical answer?

(a) (i)

Page 10: 241 Final Exam Solution Fa01

ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001

(ii)

(iii) 1.4328(0.360761573) = 0.5169

(iv)

(b)

9. Errors and Approximation [15 points]Discuss briefly the two principal contributions to total numerical error in computational approximations. From what do each of these arise, i.e., what is the source of each? Describe how the interplay of these different sources of error can sometimes be used to estimate an “optimal” step size for a numerical method. Use a sketch and an example; for instance, the example could be numerical differentiation (in very general terms).

The two principal contributions to numerical error are truncation and roundoff. Truncation arises from using series approximations in place of an exact mathematical procedure (e.g., finite divided differences in place of differentiation, summation in place of integration). Roundoff arises from the discrete and finite arithmetic in digital computation, that is, from only a fixed number of significant figures in the mantissa, from critical arithmetic (e.g., subtraction of two numbers of nearly equal value), and from the gaps between representable numbers. The two errors tend to have opposite trends: truncation errors become smaller with smaller step size, and roundoff errors become more dominant with very small step sizes. This can be shown schematically on a plot of log error vs. log step size as in C&C Figure 4.8, page 94. The fact that the total error, i.e., the sum of the truncation error and the roundoff error, may have a minimum suggests that one attempt to select a step size (h) at or near the minimum of the total

error (T). That is, T(h) = truncation + roundoff = C(h) + R(h), and estimate of

“optimal” h. For example, in numerical differentiation, a truncation error of O(hn) gives C(h) = Ahn, while roundoff error of the mth order derivative gives R(h) = B/hm. Thus T = Ahn + B/hm clearly indicate the pattern depicted in C&C Figure 4.8.