Sie sind auf Seite 1von 10

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
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
' 1 (0) 0.5
x
dy
y y e y
dx
+
(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 ks in RK
methods, using the 4
th
-order RK method as an example.
(a)
0 0 1
( , ) 1 0 0.5 1 (1) ?
x
f x y y e x y h y y +
( )
1 1 2 3 4
1
2 2
6
i i
y y k k k k h
+
+ + + + (25.40)
( )
0
1
, 0.5 1 1.5
i i
k f x y e +
(25.40a)
0.5
2 1
1 1
, (0.5,1.25) 1.25 1 3.0609
2 2
i i
k f x h y hk f e
_
+ + +

,
(25.40b)
0.5
3 2
1 1
, (0.5, 2.0305) 2.0305 1 4.3477
2 2
i i
k f x h y hk f e
_
+ + +

,
(25.40c)
( )
1
4 3
, (1.0, 4.8477) 4.8477 1 14.1774
i i
k f x h y hk f e + + +
(25.40d)
[ ]
1
1
(1) 0.5 1.5 2(3.0609) 2(4.3477) 14.1774 1 5.5824
6
y y

+ + + +
' ;

(b) The 4
th
-order RK method is O(h
4
) 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 ks in the RK methods are approximations of the slope y' at different locations along
the step. For the 4
th
-order method, k
1
is the slope at the beginning of the step, k
2
is a first
estimate of the slope at the middle of the step, k
3
is an improved estimate at the middle,
and k
4
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):
2
2
0.1 0 (0) 200 (10) 100
d T
T T T
dx

o o
(a) For a finite difference solution, write the discrete version of this equation at a typical interior
point x = x
i
using O(h
2
) 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
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
computational molecule.]
(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)
1 1
1 1 2
2
0.1 0 or 2.025 0
i i i
i i i i
T T T
T T T T
h
+
+
+
+
(b) (i) Let
dT
z
dx
, then the two first-order equations are:
' ( , , ) and ' ( , , ) 0.1
dT dz
T f x T z z z g x T z T
dx dx

(iii) From Lecture Notes 7C, page 1, with T'(0) = z
0
: z
o
= z
o
(1)
+
( )
(2) (1)
(1)
o o

f f (2) (1)

f f
z z
T T
T T
0
65 60
'(0) 60 (100 129.481) 60.791
56.951 129.481
T z
+
+

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 PDEs 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
( , ) ( , ) ( , )
u u
E x y F x y g x y
x x y y
1 1
+
1
1

]
]
(ii) The generalized convection-diffusion equation
( ) ( , ) ( , )
u u u
D x u x t k u x t
t x x x
1
+
1

]
(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.]
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
2
2
1
x y




(iv) The generalized wave equation
2
2
( )
u u
c x au f
dt x x
1
+
1

]
(v) The biharmonic equation
4 4 4
4 2 2 4
2 ( , )
w w w
f x y
x x y y

+ +

(b) What auxiliary conditions and how many of each are needed to solve (analytically or
numerically) the following second-order PDEs. 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 B
2
4AC in
2 2 2
2 2
0
u u u
A B C D
x x y y

+ + +

[C&C pp. 813-814]
(i) A = E, B = 0, C = F B
2
4AC = 4EF elliptic and linear
(ii) A = D, B = C = 0 B
2
4AC = 0 parabolic and nonlinear from u u' term
(iii) A = B = 0, C = 1 B
2
4AC = 0 parabolic and nonlinear from
1 term
(iv) A = c, B = 0, C = 1 B
2
4AC = 4c hyperbolic and linear
(v) This is not second-order so we cannot use examination of B
2
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: / u n = g; or mixed: a
u + b / u n = 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
0
( , ) and ( , )
f
u x t u x t
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., ( , 0) u x . 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
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
the dependent variable and its first derivative with respect to time over the entire
space at the beginning of the time span, e.g., ( , 0) u x (initial displacement) and
( , 0) u x &
(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:
2 2
2 2
C&C Eq. (30.18)
T T T
k
t x y
_
+


,
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.,
, i j
T
l
, 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
2
operator from C&C
Eq. (29.8) written at time +1 but multiplied by k/h
2
:
( )
2 2
1 1 1 1 1
1, 1, , 1 , 1 , 2 2 2
4
i j i j i j i j i j
T T k
k T T T T T
x y h
+ + + + +
+ +
_
+ + + +


,
l l l l l
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:
1
, , i j i j
T T
T
t t
+


l l
Using the usual notation of
2
/ k t h , 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:
1 1 1 1 1
, 1, 1, , 1 , 1 ,
(1 4 )
i j i j i j i j i j i j
T T T T T T
+ + + + +
+ +
+
l l l l l l
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
( )
6 4 2
6
1
( ) 693 945 315 15
48
P x x x x +
(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 &
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
P. O. Wheatley, Applied Numerical Analysis, Addison-Wesley, 4th Edition, 1989, prob. 1.63.] In an
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)
1
1
1
7
4 7
( )( )
C&C Eq. (6.7)
( ) ( )
3.152 10 (0.661152650 0.661209286)
0.661209286 0.661209386
1.781 10 3.152 10
i i i
i i
i i
f x x x
x x
f x f x




(ii)
9
2 2 2
1 1 1 1
( ) (((693 945) 315) 15) / 48 1.469 10
i i i i
f x x x x

+ + + +
+
(results may differ due to rounding and differences in pocket calculators)
(iii)
5 1
1
0.661209386 0.661209286
100% 100 1.512 10 %
0.661209386
i i
a
i
x x
x

+
+


6. Systems of Equations [20 points]
You are to solve the following set of equations iteratively by the Gauss-Seidel method:
Rootfinding by the Secant Method
Please do the following:
1. Define the function, ff(x), in the Visual Basic module for this worksheet
2. Provide initial guesses (need not bound the root).
x
i-1
= 0.5000
x
i
= 0.8000
3. Provide stopping tolerances:
e
s
= 1.00E-05 (%)
max = 5 (maximum # of iterations, <35)
Iter x
i-1
f(x
i-1
) x
i
f(x
i
) x
i+1
f(x
i+1
) e
a
(%)
1 0.500000000 3.232E-01 0.800000000 -3.918E-01 0.635618849 7.741E-02 2.59E+01
2 0.800000000 -3.918E-01 0.635618849 7.741E-02 0.662737817 -4.806E-03 4.09E+00
3 0.635618849 7.741E-02 0.662737817 -4.806E-03 0.661152650 1.781E-04 2.40E-01
4 0.662737817 -4.806E-03 0.661152650 1.781E-04 0.661209286 3.152E-07 8.57E-03
5 0.661152650 1.781E-04 0.661209286 3.152E-07 (i) (ii) (iii)
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
[ ] { } { }
1
2
3
4 0 1 8
1 3 0 6
0 1 2 4
x
A x x b
x
1

1

' ; ' ;
1

1
]
(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
{ }
0
0 0 0
T
x 1
]
. 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
j
i
x 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):
1
n
ii ij
j
j i
a a

f
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
/
i i ii
x b a , that is, by neglecting the off-diagonal terms. For this problem, this
approximation yields:
{ }
0
2 2 2
T
x 1
]
(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:
1
1 1 12 2 13 3 11
1 1
2 2 21 1 23 3 22
1 1 1
3 3 31 1 32 2 33
( ) /
( ) /
( ) /
j j j
j j j
j j j
x b a x a x a
x b a x a x a
x b a x a x a
+
+ +
+ + +



(d) Use starting values from part (b). [But full credit for correct calculations with any starting values.]
1
1
1
2
1
3
1.5 2
(8 0 2 1 2) / 4 1.5 100 33.3%
1.5
1.5 2
(6 1 1.5 0 2) / 3 1.5 100 33.3%
1.5
1.25 2
(4 0 1.5 1 1.5) / 2 1.25 100 60%
1.25
a
a
a
x
x
x


ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
2
1
2
2
2
3
1.6875 1.5
(8 0 1.5 1 1.25) / 4 1.6875 100 11.1%
1.6875
1.4375 1.5
(6 1 1.6875 0 1.25) / 3 1.4375 100 4.3%
1.4375
1.2813 1.25
(4 0 1.6875 1 1.4375) / 2 1.2813 100 2.4%
1.2813
a
a
a
x
x
x


[Converged solution is { } 1.6800 1.4400 1.2800
T
x 1
]
]
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
m
B & to find the values of B and m. [This is based on C&C Problem
20.49, page 561.]
Creep rate, min
-1
0.000
4
0.001
1
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 log log log B m + &
or
0 1
y a a x + . 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 x
i
= log

y
i
= log & x
i
2
x
i
y
i
1 0.76155 -3.3979 0.5799
6
-2.5877
2 0.93232 -2.9586 0.8692
2
-2.7584
3 1.09882 -2.5086 1.2074
0
-2.7565
2.79269 -8.8651 2.6565
8
-8.1026
Then
( )
1 2 2
2
3( 8.1026) 2.79269( 8.8651)
2.636
3(2.65658) (2.79269)
i i i i
i i
n x y x y
m a
n x x



and
6
0 1
8.8651 2.636(2.79269)
log 5.4089 3.900 10
3
B a y a x B



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.
1
0
1 1
ln
1
x
I dx
x x
+ _

[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)
( ) ( ) 1 1(0.661209386)
0.8306 C&C Eq.(22.23)
2 2
d
i
b a b a x
x
+ + +

Welcome to: Numerical Integration by Gauss Quadrature
To use this spreadsheet:
1. Define the integrand, f(x), in a VB macro.
2. Define the Limits of Integration:
a = 0.0000
b = 1.0000
3. Define the # of Gauss-Legendre sampling points:
p = 6 ( Note: 2 ? # pts. ? 6 )
Results: dx = 0.5*(b - a) = 0.5000
pt. # sampling pt. x
d
x
i
f(x
i
)*dx w
i
w
i
*f(x
i
)*dx
0 -0.932469514 0.0338 1.0004 0.171324492 0.1714
1 -0.661209386 0.1694 1.0097 0.360761573 0.3643
2 -0.238619186 0.3807 1.0530 0.467913935 0.4927
3 0.238619186 0.6193 1.1689 0.467913935 0.5469
4 0.661209386 (i) (ii) 0.360761573 (iii)
5 0.932469514 0.9662 2.1032 0.171324492 0.3603
I = (iv)
ENGRD 241 Final Exam Name (Print): ________________________ Fall 2001
(ii)
1 1 1 1 0.8306
( ) ln ln 0.5 1.4328
1 0.8306 1 0.8306
i
i
i i
x
f x dx dx
x x
_ + + _



,
,
(iii) 1.4328(0.360761573) = 0.5169
(iv)
( ) 2.4525
i i
i
I w f x dx

(b)
2.4674011 2.4525
100% 100 0.604%
2.4674011
t
t
t
I I
I



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 0
dT
dh
estimate of optimal h. For example, in
numerical differentiation, a truncation error of O(h
n
) gives C(h) = Ah
n
, while roundoff error of the
m
th
order derivative gives R(h) = B/h
m
. Thus T = Ah
n
+ B/h
m
clearly indicate the pattern depicted
in C&C Figure 4.8.

Das könnte Ihnen auch gefallen