Sei sulla pagina 1di 13

Instructor: Hacker Name:

Course: AME 302-s19


Sample Exam 1 Solutions: Chapters 1-6

Print your name neatly. If you forget to write your name, or if the grader can’t read your writing, you
can lose up to 100 points. Answer all the questions that you can. This is a 50 minute timed exam.
This exam will consist of 11 multiple-choice problems (worth 70%) and three computational/derive
problems worth 10% each. You may only use calculators on this exam. The use of any other device,
such as a cell phone, will be regarded as an attempt to cheat, and will be pursued accordingly.
Basic-skills component: No partial credit will be given for the multiple-choice problems. However,
you can miss one of the 11 problems without penalty. Your grade will be based on your best 10 problems.
You will not receive extra credit for getting all 11 right. Although there is no partial credit on this exam,
you must show your work on all computational problems in the space provided on the exam. If you fail
to show work you will receive a zero for the problem even if it is correct.
Your grade on the exam will be based entirely on the answers that you circle on this sheet. If you have
no answer or a wrong answer there, the grader will not look at the page with the problem to see if the
right answer appears there. Illegible or ambiguous answers will be graded as wrong. You are responsible
for copying your answers clearly, correctly, and in the right place.
The “Give up” option: If you have no idea how to solve a partial-credit problem, you can write “Give
up” and circle it instead of writing nonsense in hopes of getting partial credit. If I see “Give up”, I will
ignore everything else that you’ve written and award you 1.5 out of 5 points for the problem (30%).
This is your reward for knowing what you don’t know, and for being honest about it.

Circle your answers here. Do not detach this sheet from the test.

1. ○
a b c d e 6. a b ○
c d e 11. a ○
b c d e

2. a b c ○
d e 7. a b ○
c d e 12. (5 pts)

3. ○
a b c d e 8. a b c ○
d e 13. (5 pts)

4. ○
a b c d e 9. a ○
b c d e 14. (5 pts)

5. a b c ○
d e 10. a b ○
c d e
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.2

Part 1: Basic-skills Problems


Chapter 1: Developing Mathematical Models
Problem 1. (Closed verses open systems)
Consider the statements given in (i) and (ii). Are the statements true or false?
(i) A mathematical model can be broadly defined as a formulation or equation that
expresses the essential features of a physical system or process in mathematical terms.
(ii) Generally speaking, numerical methods are those in which the mathematical problem
is reformulated, so they can be solved by arithmetic operations either on a computer or
even by hand.
Choose the correct answer from below.
*(a) Statements (i) and (ii) are true (b) (i) is true; (ii) is false
(c) (i) is false; (ii) is true (d) Both statements are false

Chapter 2: MATLAB fundamentals


Problem 2. Consider the statements given in (i) and (ii). Are the statements true or
false?
(i) MATLAB is not case sensitive. By default MATLAB does not distinguish between
lower case and upper case (capital) letters. So for example, it treats the variables a and
A as the same variable.
(ii) The MATLAB script file My file.m is a valid is a valid file name.
(a) Statements (i) and (ii) are true (b) (i) is true; (ii) is false
(c) Both statements are false *(d) (i) is false; (ii) is true

Problem 3. Consider the following matrices:


     
1 2   1 3 1 1 0 1
1 2
A= 0 1 , B= , C = 2 2 0 , and D = 0 2 0 .
2 1
3 9 3 1 2 1 0 1

Consider the statements given in (i) and (ii). Are the statements true or false?
(i) The MATLAB command >> B*A will return an error message.
(ii) The MATLAB command >> B*A’ will return a 2 by 3 matrix.
*(a) Statements (i) and (ii) are true (b) (i) is true; (ii) is false
(c) Both statements are false (d) (i) is false; (ii) is true
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.3

Chapter 3: Programming with MATLAB


Problem 4. Consider the statements given in (i) and (ii). Are the statements true or
false?
(i) If the name of the function file is not the same as the name of the function (including
case sensitive), then the function will not run.
(ii) Function variables are local to the function, the memory is released after the function
runs. It does not show up in the work space.
*(a) Statements (i) and (ii) are true (b) (i) is true; (ii) is false
(c) Both statements are false (d) (i) is false; (ii) is true

Solution: Statement (i) is true. But if the function file also contains a sub-function,
then the sub-fcn name doesn’t need to match the function name.

Problem 5. (Working with the conditional if-elseif-else-statement)


Find the value of r that would be given by the following Matlab program.

>> x = −1;
>> y = 3;
>> r = 1;
if (x > 0)
r = 2;
elseif (y < −2)
r = 3;
else
r = 4;
end
>> r

(a) r = 1 (b) r=2


(c) r=3 *(d) r=4
(e) None of these
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.4

Chapter 4: Roundoff and truncation errors


Problem 6 (Module 1. SLO #2 [Accuracy and Precision]). .
A company makes a special rod to hold the flywheel in place on a tractor. The com-
pany that makes the interchangeable rods claims that the rod is 12.37 ± 0.005 cm long.
Assuming the company took many samples of the manufactured rods, and that accu-
rate measurements were taken, is the reported number with the uncertainty a statement
about accuracy, precision, or both?
(a) accuracy (b) precision *(c) both (d) neither

Solution: Both. Presumably, the accuracy of the rod is good or else the parts will be
returned. The precision must also be good, or else the parts won’t work and they’ll have
to be returned.

Problem 7 (Module 1. SLO #4 [Converting between bases]). .


Convert the hexadecimal number (ABC123)16 into a decimal number.
(a) 12, 236, 199 (b) 10, 256, 199
*(c) 11, 256, 099 (d) 12, 256, 099
(e) None of these
Solution: To convert hexadecimal to decimal just use the definition:

(ABC123)16 = A · 165 + B · 164 + C · 163 + 1 · 162 + 2 · 161 + 3 · 160


= 10 · 165 + 11 · 164 + 12 · 163 + 162 + 2 · 161 + 3 · 160 = 11, 256, 099 .

Problem 8 (Module 1. SLO #3 [Absolute versus relative error]). .


Compute the absolute relative error |xt − xa |/|xt | of xt = π by xa = 22/7 (a common
rational approximation of π) using exact arithmetic (keep 4 significant figures);
(a) 0.0004024 (b) 0.0004026
(c) 0.0004125 *(d) 0.0004025
(e) None of these

22 22
Solution: π − = 0.0012645; |π −

7
|/π = 0.0004025.
7

Problem 9 (Module 1. SLO #3 [Absolute versus relative error]). .


Consider the statements given in (i) and (ii). Are the statements true or false?
(i) In general, absolute error is not as informative as relative error because relative error
accounts for the magnitude of the objects being compared.
(ii) An absolute error of order 10−5 always results in a good approximation with a relative
error much less than one.
(a) Statements (i) and (ii) are true *(b) (i) is true; (ii) is false
(c) Both statements are false (d) (i) is false; (ii) is true
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.5

Solution:
Statement (i) is true.
Statement (ii) is false. Let xt = 5×10−5 and xa = 4×10−5 . Then |Et | = |xt −xa | = 10−5 ,
but t = 15 × 102 = 20, which is most definitely not small!

Problem 10 (Module 1. SLO #5 [Roundoff Error: chopping and rounding]). .


Suppose xa must approximate the true value xt with a relative error of at most 10−3 .
Using exact arithmetic find the interval in which xa must lie if xt = π. Then round the
answer to three decimal places. The sum of the rounded end points of the interval are
(a) 6.267 (b) 6.276
*(c) 6.283 (d) 6.284
(e) None of these

|x − xa |
Solution: Starting from the inequality ≤ 10−3 , for positive x,
|x|
·x
−−−−→ |xa − x| ≤ x · 10−3
expand inequality
−−−−−−−−−−−−−→ − x · 10−3 ≤ xa − x ≤ x · 10−3
+x
−−−−−→ x − x · 10−3 ≤ xa ≤ x + x · 10−3
rewrite
−−−−−−−→ x(1 − 10−3 ) ≤ xa ≤ x(1 + 10−3 ) .

We now round our answer. Starting from the exact relative error we have

|π − xa |
= 10−3 (exact relative error)
π
·π
−−−−→ |π − xa | = π10−3 = .003
⇒ [3.138, 3.145] .
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.6

Problem 11 (Module 1. SLO #6 [Truncation Error]). .


Find the second-degree Taylor polynomial P2 (x) for the function f (x) = ex sin x about
x = 0 (i.e., x0 = 0). Use P2 (x) to get an approximation for the value of f at x = 1/2.
What is the percent relative error, denoted by t , of the approximation?
(Recall: The relative error is defined as the absolute error |f (x) − P2 (x)| divided by
the absolute value of the true (or theoretical) value |f (x)|). To get percent relative error
multiply by 100.
(a) 0% ≤ t < 3% *(b) 3% ≤ t < 6%
(c) 6% ≤ t < 9% (d) 9% ≤ t < 12%
(e) None of these

Solution: The second-order Taylor polynomial about x0 (plus remainder) is of the


form:
f 00 (x0 ) f (3) (ξ(x; x0 ))
P2 (x; x0 ) + R2 (x) = f (x0 ) + f 0 (x0 )(x − x0 ) + (x − x0 )2 + (x − x0 )3 ,
2! (n + 1)!
where ξ(x; x0 ) is a number that lies between x0 and x.1 Here we are treating x0 as a
fixed parameter in the problem, and the variable x as our variable, which is arbitrary,
but fixed.
In order to substitute into the formula for the Taylor polynomial we need the first three
derivatives of f (x) = ex sin x evaluated at x = 0:
f (x) = ex sin x ⇒ f (0) = 0
f 0 (x) = ex (sin x + cos x) ⇒ f 0 (0) = 1
f 00 (x) = 2ex cos x ⇒ f 00 (0) = 2
f 00 (x) = 2ex (cos x − sin x) ⇒ f 000 (0) = 2
The Taylor polynomial and remained are then given by
1
P2 (x) + R2 (x) = x + x2 + eξ (cos ξ − sin ξ)x3 .
3
Thus, the Taylor approximation at x = 1/2 is
   2
1 1 1 3
P2 = + = = 0.75
2 2 2 4
The actual value is
   
1 1 1
f = e 2 sin $ 0.7904 (to four places) .
2 2
The relative error is the absolute error divided by the actual value.
rel(f ) ≡ 0.0512 ⇒ t ≈ 5% .
A conservative bound on the remainder is

1 ξ
e (cos ξ − sin ξ)x ≤ 2 e1/2 (1/2)3 ≈ 0.137 = 13.7%.
3

3 3
1
Since we don’t know whether x is less than or greater than x0 we use the word between.
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.7

Part 2: Computational problems


Problem 12. Use the bisection method to determine the drag coefficient needed so
that an 95-kg bungee jumper has a velocity of 46 m/s after 9 s of free fall. Note: The
acceleration of gravity is 9.81 m/s2 . Start with initial guesses of xl = 0.2 and xu = 0.5
and iterate until the approximate relative error falls below 5%.
Solution:
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.8

Problem 13. Use the Newton-Raphson method to find the root of

f (x) = e−0.5x (4 − x) − 2 .

Employ initial guesses of (a) 2, (b) 6, and (c) 8. Explain your results. Check your results
using MATLAB’s build-in function fzero.

Solution:
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.9

Problem 14 (Large Reynolds Number - [Module 1: SLO 1]). In the case of large
Reynolds number (Re  1), the drag force on an object moving through a fluid, denoted
by Fdrag , is known to be directly proportional to the square of the speed of the object
relative to the fluid (i.e., the object’s kinetic energy):

Fdrag = cd v 2 ,

where cd is a dimensional constant of proportionality. Assume that a tiny particle is


released from rest at the origin and take the y-axis pointing downward in the direction of
motion with the origin at the initial position. In this problem you will be asked to derive
a formula for the equation governing the motion of the object and solve this equation
to answer the following questions. Be sure to verify that your formula is dimensional
consistent.
[1 pt] (a) Draw a free-body diagram for this situation and use your free-body diagram
with Newton’s second law to write down the governing equation for this situation.
[1 pt] (b) Determine the speed of the terminal velocity vterm .2
[3 pt] (c) Derive an expression for the velocity as a function of time v = v(t) and use the
expression for the terminal velocity in the expression.

Solution: (a) Choose the y-axis pointing downward in the direction of motion (see
figure).

t0 = 0 y0 = 0 at t = 0
v0 = 0



 y = 0 (starts at origin)
0
Given:

 v0 = 0 (released from rest) Fdrag = cd v 2
 6
Fdrag = cd v 2 u

a
 ?
 vterm
 ?w = mg
Want: y = y(t) ?
y-axis

v = v(t)

Assumptions:
• constant gravitational acceleration g

• smooth spherical particle

• ignore any buoyancy force on the object

• assume laminar flow over the object

• the drag force opposes the object’s motion

Equations: Apply Newton’s second law to the particle. From the free-body diagram
above, we see that the only two forces acting on the particle are gravity and the drag
force. Taking the downward direction as the positive direction, the net force in the
y-direction is
Fnet = w − Fdrag = mg − cd v 2 .
2
You don’t need to solve the governing equation for the general solution v = v(t) to find this!
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.10

Applying Newton’s second law to the particle and letting ay = dv/dt gives the governing
equation for velocity:
dv
m = may = Fnet = mg − cd v 2
dt
÷m dv cd
−−−−−→ = g − v2 (first-order nonlinear ODE) , (0.1)
dt m
where v = v(t) and y = y(t) is the velocity and position of the particle, respectively.
Letting v = dy/dt, we can also get the governing equation for the position of the particle
as a function of time y = y(t). Thus, the governing equation for the particle’s position
is a second-order nonlinear ODE:
 2
d2 y cd dy
=g−
dt2 m dt
with initial conditions y(0) = 0 and v(0) = 0.
Comment: It turns out to be easier to first solve for v = v(t), then integrate this
expression w.r.t. time and get the expression for position of the particle as a function of
time.
(b) To find the terminal velocity for this situation, we’ll apply some basic physical rea-
soning. By definition, terminal velocity means that the particle is not accelerating (i.e.,
ay = 0), so there is no force imbalance in the case. Thus, in steady state the net force
on the particle vanishes. The governing equation becomes:
0 = may = Fnet = mg − cd v 2
√ r
÷cd ; mg
−−−−−−−−→ vterm = (terminal velocity) (0.2)
cd

Rewriting equation (0.1) in terms of the terminal velocity yields:


 2
÷g 1 dv cd 2 v
−−−−−→ =1− v =1− (∗)
g dt mg vterm
Separate variables:
dv
 2 = g dt
v
1−
vterm
Integrate from the initial to the final conditions; rewrite:
dṽ
Z v
v
vterm term 2 = gt (0.3)
0 ṽ
1−
vterm
ṽ dṽ v
Let ũ = ; so dũ = . Then u = 0 at v = 0, and u = at v = v. Substitute
vterm vterm vterm
in equation (0.3) and divide by vterm to get:
Z u
dũ gt
2
= (0.4)
0 1 − ũ vterm
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.11

To evaluate this integral, we use the method of partial fractions


1 1 A B
2
= = + (0.5)
1 − ũ (1 − ũ)(1 + ũ) 1 − ũ 1 − ũ
·(1−ũ2 )
−−−−→ 1 = A(1 + ũ) + B(1 − ũ) = (A + B) + (A − B)ũ (0.6)

Since equation (0.6) must hold for all ũ, we can equate coefficients to get
( ( (
A+B =1 2A = 1 A = 21
⇒ ⇒ (0.7)
A−B =0 B=A B = 12

Substituting equation (0.7) into equation (0.5) yields


 
1 1 1 1
= + (0.8)
1 − ũ2 2 1 − ũ 1 + ũ

Next, substitute equation (0.8) into equation (0.4) to arrive at


Z u  
1 1 1 gt
+ dũ =
0 2 1 − ũ 1 + ũ vterm

Multiply by −2 and integrate:


u 2gt
ln |1 − ũ| − ln |1 + ũ| = −

0 vterm
Since 0 ≤ ũ < 1, it follows that 1 + ũ > 0 and 1 − ũ > 0, so the absolute-value signs are
unnecessary. Combine the logs:
  u
1 − ũ 2gt
ln =−
1 + ũ 0 vterm

Evaluate:  
1−u 2gt
ln =−
1+u vterm
Exponentiate:
1−u
= e−2gt/vterm
1+u
Multiply by 1 + u:
1 − u = e−2gt/vterm (1 + u)
Multiply by e2gt/vterm :
e2gt/vterm − e2gt/vterm u = 1 + u
Rearrange:
1 + e2gt/vterm u = e2gt/vterm − 1

AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.12

Solve:
e2gt/vterm − 1 e−gt/vterm
u(t) = ·
e2gt/vterm + 1 e−gt/vterm
egt/vterm − e−gt/vterm 1/2
= gt/vterm · u
e + e−gt/vterm 1/2 u=1 6
 
gt
sinh vterm 
gt

u = tanh
=   vterm
gt
cosh vterm -t
 
gt
= tanh u=−1
vterm
We defined u = v/vterm ; so by back-substituting, we get
 
gt
v(t) = vterm tanh (0.9)
vterm
 
gt
Equation check: v(t) = vterm tanh
vterm
By Fourier’s principles (rules) for dimensional equations, (i) the equation must be di-
mensionally consistent, and (ii) any functions that show up in the equation must have
dimensionless arguments. We now check these conditions:
(i) Since tanh() is a dimensionless quantity (it’s a pure number), the equation is obviously
dimensionally consistent:

[v] = L/T and [vterm ][tanh()] = [vterm ] · 1 = L/T

(ii) The argument of the hyperbolic tangent must be dimensionless:


L
·T
 
gt [g][t] T2 L/T
= = L
= =1
vterm [vterm ] T
L/T

Thus the equation is dimensionally consistent. However, that doesn’t necessarily mean
that it’s correct!
Now, let’s look at the geometric behavior of the solution:
• At t = 0, v(0) = 0. The particle starts from rest, as expected.
• For t > 0, 0 < v(t) < vterm , as expected.
• v(t) increases toward vterm as t → ∞, and the increase is strictly monotonic, as
expected.
The last check is the definitive one. The governing equation (0.1) is of the form:
(
dv k 2
dt
= f (v) (with f (v) = g − m v )
v(0) = 0 (initial condition)

It follows from the existence-uniqueness theorem for first-order differential equations


(initial-value problems) that if

∂f 2k
f (t, v) and = − v,
∂v m
AME 302, sample exam 1 solns-s19 Copyright ©Wayne Hacker 2015. All rights reserved.13

are both continuous on some region of the tv-plane containing the initial condition (point)
(t0 , v0 ) = (0, 0), then the IVP has a unique solution. Thus, if we can find a solution, we
have found the unique solution.
We now check our solution. Before we do this let’s rescale our ODE in terms of u to
put the equation and solution in a little simpler form. While this is unnecessary, it is a
standard trick which I will now show you for completeness sake. Multiplying and dividing
the left-hand side of equation (∗) by vterm gives
 2
1 dv v
=1− (∗)
g dt vterm
   2
rewrite vterm d v v
−−−−−−−→ =1−
g dt vterm vterm
let u=v/vterm vterm du
−−−−−−−−−−−→ = 1 − u2
g dt
It suffices to let  
v gt
u≡ = tanh
vterm vterm
and substitute into the rescaling of equation (∗):

vterm du
= 1 − u2
g dt
to find that u is indeed a solution, where we’ve applied the identities:
d
tanh x = sech2 x
dx

Potrebbero piacerti anche