Engineering Mathematics | CHEN30101 solutions to sheet 1 1. The equation 2x−1 = cos x has a root between x = 0 and x = 1. Compute the root to an accuracy of two digits. Running Newton–Raphson iteration with either starting point gives x∗ = 0.66. Note that f (x) = 2x−1 − cos x and f 0 (x) = 2x−1 ln 2 + sin x. f 0 (x) 1.5346 1.2077 1.1616 1.1607 1.1607 (a) iteration 0 1 2 3 4 x 1.0000 0.7005 0.6607 0.6600 0.6600 f (x) 0.4597 0.0479 0.0009 0.0000 0.0000 (b) iteration 0 1 2 3 4 5 x 0.0000 1.4427 0.8060 0.6690 0.6600 0.6600 f (x) -0.5000 1.2314 0.1817 0.0106 0.0000 0.0000 f 0 (x) 0.3466 1.9339 1.3274 1.1713 1.1607 1.1607 2. A tank is fed at a constant rate and also drains a second tank. In turn, this tank drains into a third tank. The volume of fluid in the tank varies like V = 10 − 9e−t − e−3t . Compute an accurate estimate (correct to 5 digits) of the time when the volume of fluid in the tank is equal to 8. We need to solve the equation 10 − 9e−t − e−3t = 8 so we define f (t) = 9e−t + e−3t − 2 and f 0 (t) = −9e−t − 3e−3t and iterate using Newton (because we want five-digit accuracy). t 0 0.666666667 1.214950133 1.468378342 1.508629153 1.509490221 1.509490604 f (t) 8 2.756089355 0.696648614 0.08490229 0.001742279 7.73946×10−7 1.52767×10−13 f 0 (t) -12 -5.026759921 -2.74889925 -2.109331204 -2.023392486 -2.021595126 -2.021594327 Thus x∗ = 1.50949 (to five decimal digits) 1 3. The coupled equations 2x + y + e− 5x − 2y − 1 10 xy 5 − 11 = 0 sin(x + y) − 14 = 0 have a solution near the point x = 4, y = 3. Construct a Newton iteration to solve these two equations and use this strategy to compute the solution to an accuracy of 5 digits. Editing the function fdef.m and running the function newtonit gives the following output: >> newtonit([4;3],5) Newton iteration in 2 dimensions ... k x_k y_k |f_k| 0 4.00000 3.00000 9.072e-02 1 3.98520 2.93323 1.607e-04 2 3.98514 2.93318 1.934e-10 3 3.98514 2.93318 0.000e+00 4 3.98514 2.93318 0.000e+00 done |g_k| 6.570e-02 2.116e-04 3.325e-10 3.553e-15 3.553e-15 Hence the solution is x∗ = 3.98514, y ∗ = 2.93318. 4. The proportion of two kinds of impurities in a liquid vary with height and temperature as follows: T A = e− 100 /100 + T × sin(πh)/11000 + h/10 T B =e− 60 /80 + T × sin(πh)/5000 + (1 − h)/5. Find a temperature near T = 600K and a position near h = 0.5 where A = 0.1 and B = 0.2.∗ Record your final answer to an accuracy of 3 digits. Editing the function fdef.m and running the function newtonit gives the following output: >> newtonit([600;0.5],5); Newton iteration in 2 dimensions ... k x_k y_k |f_k| 0 600.00000 0.50000 4.570e-03 1 523.57708 0.52358 1.211e-04 2 524.96419 0.52354 5.935e-09 3 524.96415 0.52354 1.665e-16 4 524.96415 0.52354 0.000e+00 done Hence the solution is T ∗ = 525, h∗ = 0.524. 2 |g_k| 2.000e-02 2.865e-04 2.381e-09 3.886e-16 0.000e+00 5. Consider the coupled equation system x2 − 2xy + y 2 − 5 = 0 x2 + 4xy + 4y 2 − 7 = 0 Compute (on paper) the first Newton iteration for solving the system starting from from x0 = 1, y0 = 1. What happens on a computer? Repeat the above experiment, this time starting from the point x0 = 1, y0 = 3. Does the iteration converge? Defining the functions f = x2 − 2xy + y 2 − 5 and g = x2 + 4xy + 4y 2 − 7, the Jacobian matrix associated with the nonlinear system is fx fy 2x − 2y 2y − 2x J= = . gx gy 2x + 4y 4x + 8y If the Jacobian matrix is evaluated at a point where x = y then the first row is zero and so the matrix is singular. The Newton iteration breaks down at this point. Indeed, running newtonit with the starting vector [1;1] gives the error message: Newton iteration in 2 dimensions ... k x_k y_k |f_k| |g_k| 0 1.00000 1.00000 5.000e+00 2.000e+00 Warning: Matrix is singular to working precision. Note that the iteration proceeds to completion (it does not stop at the first step) by generating numbers Inf (∞), -Inf (−∞) and NaN (Not a Number). Starting from a different point [1;3] converges to a root: Newton iteration in 2 dimensions ... k x_k y_k |f_k| 0 1.00000 3.00000 1.000e+00 1 -0.16667 2.08333 6.250e-02 2 -0.53241 1.70370 1.929e-04 3 -0.60575 1.63032 1.860e-09 4 -0.60879 1.62728 1.776e-15 done |g_k| 4.200e+01 9.000e+00 1.266e+00 4.845e-02 8.325e-05 6. Compute a solution to the system of equations x2 + y 2 + z − 40 = 0 x2 − y + 3z 2 − 22 = 0 x + y 2 − 2z 2 − 20 = 0 that is accurate to two decimal places by constructing a Newton iteration and starting from the point x = 5, y = 4, z = 0. Editing the functions fdef.m and itntable and running the function newtonit gives the following output: 3 >> newtonit([5;4;0],6); Newton iteration in 3 dimensions ... k x_k y_k z_k |f_k| 0 5.00000 4.00000 0.00000 1.000e+00 1 5.08642 3.86420 -0.77778 2.591e-02 2 4.99029 3.96682 -0.61883 1.977e-02 3 4.98483 3.97026 -0.61152 4.163e-05 4 4.98482 3.97027 -0.61151 2.544e-10 5 4.98482 3.97027 -0.61151 0.000e+00 done Hence the solution is x∗ = 4.98, y ∗ = 3.97, z ∗ = −0.61. 4 |g_k| 1.000e+00 1.822e+00 8.503e-02 1.901e-04 7.597e-10 0.000e+00 |h_k| 1.000e+00 1.191e+00 4.000e-02 9.504e-05 3.082e-10 3.553e-15
© Copyright 2026 Paperzz