0% found this document useful (0 votes)
28 views8 pages

Midterm (Solutions)

Uploaded by

bbwjoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views8 pages

Midterm (Solutions)

Uploaded by

bbwjoa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Midterm (Solutions)

Chemical Engineering Computer Aided Modeling


Date: April 25, 2023
 NOTE

① All answers must include a process of solving.

② 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?

Data structure of 'data'

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.

True value: f(2.5) = 282.625

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

Using an initial guess of 5, the first iteration yields

1(5) 2 - 2.5 12.5 - 5


x1 = = 12.5 εa = ? 100% 60%
1.8 12.5

Second iteration:

1(11.76) 2 - 2.5 85.4 - 12.5


x1 = = 85.4 εa = ? 100% 85.4%
1.8 85.4
Clearly, this solution is diverging. An alternative is to solve for the second-order x,

1.8 xi + 2.5
xi + 1 = = 1.8 xi + 2.5
1.0

Using an initial guess of 5, the first iteration yields

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

This version is converging. All the iterations can be tabulated as

iteration xi |εa| (%)


0 5
1 3.391165 47.44196
2 2.933274 15.61023
3 2.789246 5.163692
4 2.742379 1.70899
5 2.726955 0.565623
6 2.721859 0.187202
7 2.720174 0.061957
8 2.719616 0.020505
9 2.719432 0.006787

Thus, after 9 iterations, the root estimate is 2.719432 with an approximate error of 0.0068%.

(b) The formula for Newton-Raphson is

5 / 8
- xi2 + 1.8 xi + 2.5
xi + 1 = xi -
- 2 xi + 1.8

Using an initial guess of 5, the first iteration yields

−(5) 2 + 1.8(5) + 2.5


5−
xi +1 = 3.353659
=
−2(5) + 1.8
3.353659 − 5
εa
= 100% 49.1%
×=
3.353659

Second iteration:

−(3.353659) 2 + 1.8(3.353659) + 2.5


3.353659 −
xi +1 = 2.801332
=
−2(3.353659) + 1.8
2.924357 − 3.353659
εa = × 100% 19.7%
2.924357
The process can be continued as tabulated below:

iteration xi f(xi) f'(xi) |εa| (%)


0 5 -13.5 -8.2
1 3.353659 -2.71044 -4.90732 49.09091
2 2.801332 -0.30506 -3.80266 19.71656
3 2.721108 -0.00644 -3.64222 2.948204
4 2.719341 -3.1E-06 -3.63868 0.06498
5 2.719341 -7.4E-13 -3.63868 3.16E-05

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% .

Determine the real root of f ( x) = 4 x 3 - 6 x 2 + 7 x - 2.3:

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% .

(b) First iteration:


0 +1
=xr = 0.5
2
1− 0
εa = × 100% = 100%
1+ 0
f (0) f (0.5) = −2.3(0.2) =
−0.46

Therefore, the new bracket is xl = 0 and xu = 0.5.

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.

iteration xl xr xu f(xl) f(xr) f(xl)×f(xr) εa


1 0 0.5 1 -2.3 0.2 -0.46 100
2 0 0.25 0.5 -2.3 -0.8625 1.98375 100
3 0.25 0.375 0.5 -0.8625 -0.30781 0.265488 33.33333
4 0.375 0.4375 0.5 -0.30781 -0.05098 0.015691 14.28571
5 0.4375 0.46875 0.5 -0.05098 0.074878 -0.00382 6.666667

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

You might also like