Midterm (Solutions)
Midterm (Solutions)
Midterm (Solutions)
② The perfect score is 100 points, and the points assigned to the question are displayed in each question.
1. (10 points) A parachutist of mass 68.1 kg jumps out of a stationary hot air balloon. Derive the velocity until 6
s prior to opening the chute using numerical method. The drag coefficient is equal to 12.5 kg/s. Employ a step
size of 2 s for the calculation.
Answer
1. Derivation
2. Calculation
1 / 8
2. (5 points) Draw the symbol for the following function.
(a) Represents a comparison, question, or decision that determines alternative paths to be followed.
(b) Represents calculations or data manipulations.
Answer
(a)
(b)
3. (5 points) Fill in the blank to get the below result ( z = [30 80] ).
Answer: .*
4. (5 points) When you use the given example code ([dr,dc] = size(data) ) after loading the data in MATLAB,
what variable names and values you can get from it?
Answer: dr = 7, dc = 4
Or variable names: dr, dc / values: 7, 4
5. (5 points) Write the result which would be shown when you type the below code in MATLAB
[5 10 15] > 12
Answer: 0 0 1
6. (10 points) Assume that you have “density” data as below. When you want to draw 7 data points of ‘density’ in
a plot, write the code for the plot in MATLAB with considering Constraints. (Constraints: Use ‘for’ loop to repeat
the lines (4 to 7) in the below figure, and define the ‘loop counter’ as ‘idx’)
2 / 8
Data structure of 'density' The given example code
Answer
for idx = 1:7
hold on
plot(idx,density(idx),'*')
hold off
pause(0.2)
end
3 / 8
7. (15 points) Use zero- through third-order Taylor series expansions to predict f (2.5) for
f (x) = 25x3 − 6x2 + 7x − 88
using a base point at x = 1. Compute the true percent relative error εt for each approximation.
Answer
Use zero- through third-order Taylor series expansions to predict f (2.5) for
f ( x) = 25 x 3 - 6 x 2 + 7 x - 88
using a base point at x = 1. Compute the true percent relative error εt for each approximation.
zero order:
282.625 − ( − 62)
f (2.5) = f (1) = −62 =εt = × 100% 121.94%
282.625
first order:
f (2.5) = −62 + f '(1)(2.5 − 1) = −62 + 105 =43 ε t = 84.79%
second order:
f "(1)
f (2.5) = 43 + (2.5 − 1) 2 = 43 + 155.25 =198.25 ε t = 29.85%
2
third order:
f (3) (1) 3
f (2.5)
= 198.25 + (2.5 − 1)= 198.25 + 84.375
= 282.625 ε t = 0%
6
Thus, the third-order result is perfect because the original function is a third-order polynomial. All subsequent terms are
proportional to the 4th and higher derivatives that are all zero.
4 / 8
8. (25 points) Determine a root of f(x) = -x2 + 1.8x + 2.5 using x0 = 5. Perform the computation until εa is less
than εs = 0.01%.
(a) fixed-point iteration and (b) the Newton-Raphson method.
Use (a) fixed-point iteration and (b) the Newton-Raphson method to determine a root of
f ( x) = - x 2 + 1.8 x + 2.5 using x0 = 5. Perform the computation until εa is less than εs = 0.01%. Also perform an error check of
your final answer.
Answer
(a) The function can be set up for fixed-point iteration by solving it for x in two different ways. First, it can be solved for the linear
x,
xi2 - 2.5
xi + 1 =
1.8
Second iteration:
1.8 xi + 2.5
xi + 1 = = 1.8 xi + 2.5
1.0
3.391- 5
xi + 1 = 1.8(5) + 2.5 = 3.391 εa = ? 100% 47.4%
3.391
Second iteration:
2.933 - 3.391
xi + 1 = 1.8(3.391) + 2.5 = 2.933 εa = ? 100% 15.61%
2.933
Thus, after 9 iterations, the root estimate is 2.719432 with an approximate error of 0.0068%.
5 / 8
- xi2 + 1.8 xi + 2.5
xi + 1 = xi -
- 2 xi + 1.8
Second iteration:
After 5 iterations, the root estimate is 2.719341 with an approximate error of 3.16E-05%.
6 / 8
9. (10 points) Determine the real root of f ( x) = 4 x 3 - 6 x 2 + 7 x - 2.3: using bisection to locate the root. Employ
initial guesses of xl = 0 and xu = 1 and iterate until the estimated error ε a falls below a level of ε s = 10% .
Answer
(a) Using bisection to locate the root. Employ initial guesses of xl = 0 and xu = 1 and iterate until the estimated error ε a falls
below a level of ε s = 10% .
The process can be repeated until the approximate error falls below 10%. As summarized below, this occurs after 5 iterations
yielding a root estimate of 0.46875.
7 / 8
10. (15 points) Explain the Bisection method, False method, Newton-Raphson method, and Secant method by
suggesting (a) formulation (b) graphical interpretation (c) errors and stopping criteria.
Answer
8 / 8