Nothing Special   »   [go: up one dir, main page]

Problem Set 2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

FALL 2021 THE AMERICAN UNIVERISTY IN CAIRO ENGR 3202 INSTRUCTORS

ENGR 3202: ENGINEERING ANALYSIS AND COMPUTATION I


PROBLEM SET # 2 DUE: OCTOBER 13, 2021 AT 11:59 PM
Roots of nonlinear equations
 You need to submit a PDF that have your answers, analysis, plots. Additionally, you need to
submit all the MATLAB m-files for all problems in a single compressed .zip folder. So in total you
submit two things; PDF file + .zip folder on Black Board.

 Please Keep a hard copy of your solutions which could be requested by the TA.

 Submission after the deadline results in a grade degradation at a rate of -10%/day and up to 5
days. After 5 days, no more submission accepted. For MATLAB-based problems, if .m code files
and/or the results/plots missing, then is no grade for this question.

 Group discussions among students are encouraged but you have to write and submit your own
work independently.
*******
Part I: Numerical Problems and Conceptual Questions
1. Numerical methods done graphically [10 points]:
(a) Graphically using pen/pencil on the two graphs below, perform two iterations to evaluate the root of
the plotted function f(x) using the bisection, and Newton-Raphson methods. Sketch the root estimate
after two iterations using the point (3.2 , 0) marked with a square as a starting point. If the method is
a bracketing method, use the point (2.6 , 0) as another guess for the root. In all cases, denote on the
graph the result of the first iteration by x1 and the result of the second iteration by x2. [Sketch your
graphical analysis with a pen/pencil in your submitted answers document]
Bisection method Newton-Raphson Method

(b) Do you think Newton-Raphson method can be problematic in this case? Why?
(c) Sketch an example for a function f(x) for which the bisection method cannot be used to find its root.
What is the reason for the failure of the bisection method?
******
2. A comparative problem [40 points]: Determine the highest real root of
𝑓(𝑥) = 2𝑥 3 − 11.7𝑥 2 + 17.7𝑥 − 5
(a) Graphically. [Plot with MATLAB and label the axes. Attach your .m script and include the plot in
your submitted answers document].
(b) Using the following numerical methods. For each method, perform 3 iterations and calculate the
approximate relative error at each iteration.
(i) The bisection method with starting guesses xl = 3 and xu = 4.
(ii) The False Position method with starting guesses xl = 3 and xu = 4.

1
Note: False position method is a bracketing method which follows the same procedure as the
bisection method except the iteration value of the root is evaluated as the intersection of the
straight line joining the f(xl) and f(xu) with the x-axis which results in the following iteration
𝑓(𝑥 )(𝑥𝑙 −𝑥𝑢 )
equation: 𝑥𝑟 = 𝑥𝑢 − 𝑓(𝑥𝑢 )−𝑓(𝑥 )
𝑙 𝑢
(iii) Newton Raphson method using xo = 3 as a starting guess.
(iv) Fixed point iteration using xo = 3 as a starting guess but make sure that the method will converge
(Do a test to confirm this).
(v) Secant method with starting guesses x-1 = 3 and xo = 4.
******
3. A nonlinear system [15 points]: In class we learned how to use Taylor expansion up to the 1st order
term to solve a system of two non-linear equations; u(x,y) = 0 and v(x,y) =0. This method is also
called Newton-Raphson method.
(a) Use Newton-Raphosn method to perform one iteration for the following system of equations using
(1.2, 1.2) as an initial guess.
𝑦 = −𝑥 2 + 𝑥 + 0.75
𝑦 + 5xy = 𝑥 2
(b) Calculate the relative approximate error for both x and y.
(c) Substitute your results of the first iteration into the equations and report the discrepancy in the right
hand side between your substitution and the original equation.
(d) Plot the two equations using ezplot MATLAB function (or any other modern utility of MATLAB since
ezplot is outdated!). From the plot estimate the solution of the system. [Attach the MATLAB plot and
the .m script]
*******
Part II: Applications and programming
#4. Water splitting [35 points]:: In converting solar energy into chemical

energy, water vapor (H2O) is heated to sufficiently high temperatures


that a significant portion of the water splits apart to form oxygen (O2)
and hydrogen (H2):
H2O ↔ O2 + H2
The resulting hydrogen can be used as a clean fuel.

[See for example the BBC article https://www.bbc.com/news/science-environment-53238512]

If it is assumed that this is the only reaction involved, the mole fraction x of H2O that dissociate can be
represented by

𝑥 2𝑝
𝐾 = 1−𝑥 √2+𝑥

where K is the reaction equilibrium constant and p is the total pressure of the mixture in units of atm.

(a) If p = 3 atm and K = 0.05 determine the fraction x using Newton Raphson method. [Write a MATLB
function for Newton Raphson and name it engr3202_nr. It is important to include a check on the
derivative being non-zero.].

(b) Report the initial guess(es), the stopping criterion for your method, and the number of iterations. What
is the rational of the choice of the initial guesses? [Please choose a strict stropping criterion of].

2
(c) Modify the Newton Raphson code you developed to compute the fraction of dissociated H2O as a
function of pressure for two cases; K=0.05 and K=0.1. In both cases allow the pressure to vary
between 0 atm and 100 atm. Plot your results (fraction on y-axis and pressure on x-axis). Label the
axes, insert legend, and produce a neat plot. [As usual include the plot in your answers document and
attach your .m plotting script and the updated Newton-Raphson code which you can name
engr3202_nr_updated].

(d) Based on your results in part (c) answer the following:

(i) To achieve more splitting, is it better to reduce or increase the total pressure?
(ii)To achieve more splitting, is it better to have low or high value of K?
********
"To those who do not know mathematics it is difficult to get across a real feeling as to the beauty, the deepest beauty, of nature ... If you
want to learn about nature, to appreciate nature, it is necessary to understand the language that she speaks in." -Richard Feynman in
"The Character of Physical Law"

You might also like