Uploaded by Kyle Schluben

Final Exam-2021F-FormA-sol

advertisement
Numerical Methods for Engineers, ME 325, Fall 2021
Numerical Methods for Engineers (ME 325), Final Exam, Solution
Assigned Date and Time: 12/8, 11:00-12:50 pm
Last Name:
First Name:
WSUID:
INTRUCTIONS for EXAM
1. Turn in BOTH bubble sheet with your answers (for the multiple choice problems) AND written exam
solution (for problem solving problems).
2. For the multiple choice problems, provide the best answers by marking in the bubble sheet. You do not
need to provide the step-by-step solution. However, for the problem solving problems, to receive full
credit, provide BOTH (reasonable) step-by-step solution AND final answer in given space. No partial
credit will be given in the multiple choice problems, while the partial credit will be given for the problem
solving problems depending on the solutions. The solution WITHOUT step-by-step solution will be
considered as “unsatisfactory”, i.e., No credit.
3. CLOSE book and note test.
4. Calculator is allowed to use (calculator with basic functions only, NO OTHER electronics are allowed
to use).
5. The formula sheet is provided from the instructor.
6. NO CREDIT will be given for the student’s cheating activities/attempts.
7. The extra problems are given. Thus, the full credit of the final exam is 120 pt, but the maximum credit
will be 100 pt (the credit above 100 pt will be capped at 100 pt).
8. No make-up exam will be given based on the class policy. Instead, extra questions are given.
1
Numerical Methods for Engineers, ME 325, Fall 2021
Q1 (5 pt). “f(x) = ln (x) at x0 = 1” can be expanded given as
( x − 1) ( x − 1) 2 ( x − 1)3
.
ln( x) 
+
+
a
b
c
What is the b in above equation?
(A) 6 (B) 4 (C) 3 (D) 2 (E) None of (A) to (D)
Solution:
Using the Taylor series expansion,
f '' ( x0 )
f ''' ( x0 )
'
2
f ( x) = f ( x0 ) + f ( x0 )( x − x0 ) +
( x − x0 ) +
( x − x0 )3 +
2!
3!
''''
(n)

f ( x0 )
f ( x0 )
( x − x0 ) 4 + ... = 
( x − x0 ) n
4!
n!
n =0
we have
1
1 1
2 1
( x − 1) 2 ( x − 1)3
ln( x) x =1  f (1) + ( x − 1) − 2 ( x − 1) 2 + 3 ( x − 1)3 = ( x − 1) −
+
0
1
1 2!
1 3!
2
3
Answer: (E)
(Questions 2-3) Amy measured the travelled distance of her mustang, x(t) in [m], as a function of
time, t in [s], given as
x(t) = 2t2 + ln(t + 1) for 0 ≤ t ≤ 3 s.
Q2 (5 pt). What is the velocity, v(t) in [m/s], of her mustang using Forward Difference
Approximation (FDA) at t = 1 s. Use t = 0.1 s.
(A) 4.6879
(B) 4.8545
(C) 4.9529
(D) 5.1292
(E) None of (A) to (D)
Solution:
Using the forward difference approximation we have:
x(t + t ) − x(t )
t
x(1.1) − x(1.0) [2  1.12 + ln(2.1)] − [2  12 + ln(2)]
(t = 1) =
=
0.1
0.1
= 4.6879 m/s
(t ) =
Answer: A)
Q3 (5 pt). What is the acceleration, a(t) in [m/s2], of her mustang using Central Difference
Approximation (CDA) at t = 1 s. Use t = 0.1 s.
(A) 3.7497
(B) 3.9325
(C) 4.0524
(D) 4.1253
2
(E) None of (A) to (D)
Numerical Methods for Engineers, ME 325, Fall 2021
Solution:
Using the central difference approximation we have:
x(t + t ) − 2 x(t ) + x(t − t )
t 2
x(1.1) − 2 x(1.0) + x(0.9)
a (t = 1) =
0.12
[2(1.1) 2 + ln(2.1)] − 2[2(1.0) 2 + ln(2)] + [2(0.9) 2 + ln(1.9)]
a (t = 1) =
0.12
= 3.7497 m/s 2
a (t ) =
Answer: A)
Q4 (5 pt). Mike measures a time-dependent velocity of a vehicle, v(t) = 1 - e-2t [m/s], 0 ≤ t ≤  [s].
Assume the travelled distance, x(t), is zero at t = 0. Use t = 0.5 s. What is the total travelled distance
of the vehicle, x(t) at t = 2 s using the trapezoidal rule?
(A) 3.5192
(B) 3.0892
(C) 2.4592
(D) 2.0689
(E) None of (A) to (D)
Solution:
Using the trapezoidal rule, we have:
N
1
v(ti ) + v(ti −1 )  t
i =1 2
1
1
1
1
=  (0.5)  v(0.5) + v(0)  +  (0.5)  v(1) + v(0.5)  +  (0.5)  v(1.5) + v(1)  +  (0.5)  v(2) + v(1.5) 
2
2
2
2
1
= [(0.63212) + (1.49678) + (1.81487) + (1.93189)]
4
1
= (5.87566) = 1.4689 m
4
x(t ) = 
Answer: (E)
Q5 (5 pt). Kate measured the velocity of a Ford Fusion, v(t), as a function of time as shown in Table
below, and she would like to estimate the velocity of the vehicle every second from the measured
data.
t, s
v(t), m/s
0
0
3
Numerical Methods for Engineers, ME 325, Fall 2021
3
8
6
30
What is the vehicle velocity at t = 2 s, using a quadratic interpolation method, in m/s?
(A) 4.278
(B) 3.778
(C) 3.125
(D) 2.625
(E) None of (A) to (D)
Solution:
To determine a0, a1, and a2 for v(t) = a0 + a1t + a2t2 using the data above for the quadratic interpolation,
we have
v(t = 0) = 0 = a0
v(t = 3) = 8 = 3a1 + 9a2
v(t = 6) = 30 = 6a1 + 36a2
 3 9   a1   8 
6 36   a  = 30  

 2  
1
3
a2 = 0.778
a1 =
1
v(t ) = 0.7778t 2 + t
3
To calculate the velocity v(t) at t = 2 s, in m/s using the quadratic equation above, we have
v(t ) = 3.778 m/s
Answer: B)
Q6 (5 pt). Consider an objective function f(x) = x2 + 2x + 3. We would like to find the minimum value of the
objective function using golden section search method with the initial guesses, xl = -2 and xu = 0. What is the
f(x2)?
(A) -0.7082
(B) 0
(C) 0.7639
(D) 2.0557
(E) None of (A) to (D)
Solution:
x2 = xl + c( xu − xl ) = −2 + 0.61803  [0 − (−2)]
= −0.7639
f ( x2 ) = x22 + 2 x2 + 3 = 2.0557
Answer: (D)
4
Numerical Methods for Engineers, ME 325, Fall 2021
Q7 (15 pt). Find a square root of 7 using bisection method using a prescribed absolute relative
approximation error, s = 10 %. Use your own initial guesses.
Show step-by-step approach to receive full credit
To use bisection method, we define f(x) given as
f ( x) = x 2 − 7
To find the root, f(xm) = 0 using bisection method, we use the following relation given as
xm =
xl + xu
2 .
Using the initial guesses, xl = 2.0 and xu = 3.0 and iterative calculation for xm, we have the solution x = 1.414795
with a = 0.051769%. Note that you can use different initial guesses.
After one iteration, the bisection method reaches xm = 2.75, allowing for the absolute relative error a < 9.09%.
Thus, we have
7
2.75 .
To receive full credit, show the predicted results of xl, xm, xu, f(xl)×f(xm), and a for each iteration
Iteration Number
xl
xu
xm
f(xl)×f(xm)
a , %
0
2
3
2.5
2.25
20.0
1
2.5
3
2.75
-0.42875
9.09
2
3
Final Answer
2.5
3
2.75
-0.42875
9.09
5
Numerical Methods for Engineers, ME 325, Fall 2021
Q8 (20 pt) Amy models the instantaneous water height h(t) in the water tank using the first order
ordinary differential equation as given
dh
= − 2 e −4 t .
dt
Initial water height is 1 [m], i.e., h(t) = 1 [m] at t = 0 s. She would like to predict the water height at
given time t using finite difference method with forward difference approximation and t = 0.1 s.
What is the water height h in [m] at t = 0.3 s? To receive full credit, finite difference method MUST
be used.
Show step-by-step approach
Solution:
dh
h(t + t ) - h(t )
= −2e−4t →
= −2e −4t → h(t + t ) = h(t ) − 2e −4t  t
dt
t
At t = 0 [s], we have h(0) = 1 [m] using initial condition.
At t = 0.1 [s], using the above equation by plugging t = 0, into the equation, we have
h(0.1) = h(0) - (0.1)(2)e-4×0 = 1 - 0.2 = 0.8 [m]
At t = 0.2 [s], using the above equation with t = 0.1, we have
h(0.2) = h(0.1) - 0.1×2e4×0.1 = 0.8 - 0.13406 = 0.66594 [m]
At t = 0.3 [s], using the above equation with t = 0.2, we have
h(0.3) = h(0.2) - 0.1×2e-4×0.2 = 0.66594 - 0.089866 = 0.57607 [m]
Thus, the water height at t = 0.3 [s] is h = 0.57607 [m]
Final Answer: h(t = 0.3 [s]) = 0.57607 [m]
6
Numerical Methods for Engineers, ME 325, Fall 2021
Q9 (20 pt). Newton models the instantaneous displacement of undamped
spring attached to a mass, using 2nd order ordinary differential equation
given below (also see Figure). x, k, and m are the instantaneous displacement,
spring constant, and mass, respectively.
d2 x
m 2 + kx = 0
dt
He would like to predict the displacement at given time, t, using Finite
Difference Method with t =  s. Initially, i.e., at t = 0, the spring is initially
stretched at 0.1 m away from the equilibrium position, i.e., initially it is stretched upward 0.1 m,
and the velocity is zero. Note that at the equilibrium position, no force acts on the spring, i.e., spring
sits at rest. Use m = 10 kg, and k = 50 N. What is the displacement of the mass, x(t) at t = 0.4 s? To
receive full credit, finite difference method MUST be used.
Show step-by-step approach
Solution:
To work with the FDM, the given ODE is rewritten in the discretized form given below
x - 2 xi + xi −1
d2 x
d2 x k
m 2 + kx = 0 → 2 + ( ) x = 0 → i +1
+ 5 xi = 0
dt
dt
m
(t ) 2
xi +1 - 2 xi + xi −1 = −5 xi (t ) 2
xi +1 = [2 − 5(t ) 2 ]xi − xi −1
At t = 0 s, from the first initial condition, i.e., x(t = 0) = 0.1 [m], we have x1 = 0.1 [m].
At t = 0.1 s, from the second initial condition, i.e., v(t = 0) = x′(t = 0) = 0, we have
x −x
x(t = 0) = 2 2 = 0
t
x2 = x1 = 0.1[m]
Thus, x(t = 0.1) = 0.1 [m].
At t = 0.2 s, from the above equation, we have
x3 = [2 − 5() 2 ]x2 -x1
= [2 − 5  0.12 ]  0.1 − 0.1
=0.095[m]
Solving similarly for nodes 4 and 5 we get the results tabulated below
i
ti , s
1
0
2
0.1
3
0.2
4
0.3
5
0.4
Final Answer: x(t = 0.4 [s]) = 0.071237 [m]
7
xi, m
0.1
0.1
0.095
0.08525
0.071237
Numerical Methods for Engineers, ME 325, Fall 2021
Q10 (15 pt). Newton, WSU ME student, builds a rectangle using a string with a fixed length, L in
[m]. Find the maximum rectangle area, Amax. Use L = 4 [m].
Show step-by-step approach to receive full credit
Solution:
The total peripheral length of the rectangle becomes
2x + 2 y = L
(1)
The enclosed area by the string is
A = xy
Since y = 0.5(L - 2x), the area can be rearranged as
1
1
A = x  ( L − 2 x) = ( Lx − 2 x 2 )
2
2
Let’s consider the area A, as an objective function f(x).
1
f ( x) = ( Lx − 2 x 2 )
2
To maximize f(x), we take a derivative with respect to x.
1
f '( x) = ( L − 4 x)
2
To determine the point where f(x) is maximum, we calculate f ′(x) = 0.
Thus, we have x = L/4 = 1.
By plugging x = 1 into equation (1), we have y = 1. Thus, when x = y = 1 m, it will result in the maximum area
by the rectangle, Amax = 1 m2.
Show final answer to receive full credit
Amax = 1 m2.
8
Numerical Methods for Engineers, ME 325, Fall 2021
Extra Credit Question (20 pt) Write a script to display either even or odd number for each element
for given vector “a”. Consider the vector “a = [1 6 3 7 10];”
Note: To receive the full credit, both loop and conditional statements MUST be used in the script.
Also, the script MUST be fully functional and free of errors in Matlab/Octave.
When you run the script, the following texts should appear in command windows
a(1) is odd number
a(2) is even number
a(3) is odd number
a(4) is odd number
a(5) is even number
Clearly write the Matlab/Octave script
a = [1 6 3 7 10];
for i = 1:length(a)
if mod(a(i),2) == 0
fprintf('a(%d) is even number\n',i);
else
fprintf('a(%d) is odd number\n',i);
end
end
9
Download