Ame302 Chapter3 Homework Set
Ame302 Chapter3 Homework Set
Ame302 Chapter3 Homework Set
Part 2: There is no partial credit given for multiple-choice problems. Although there is no partial
credit on this assignment, you must show your work on all of the problems. If you fail to
show work you will receive a zero for the problem even if it is correct.
There are 15 problems worth 60% (4 points each) [online-component].
Part 1: Circle your answers here. Do not detach this sheet from the homework.
1. T F 6. T F
2. T F 7. T F
3. T F 8. T F
4. T F 9. T F
5. T F 10. T F
Part 2: Circle your answers here. Do not detach this sheet from the homework.
11. a b c d e 16. a b c d e 21. a b c d e
Problem 1. True or False: If an algorithm uses an open method, then the scheme may
use one or two initial conditions that need not bound the root.
Problem 2. True or False: In general, open methods are more accurate than bracketing
methods.
Problem 3. True or False: In general, provided a root exists in the bounding interval,
bracketing methods are guaranteed to converge.
Problem 6. True or False: The secant method is derived from newton’s method by
replacing the derivative with a forward difference.
Problem 9. True or False: For a continuous function f (x) on a closed interval [a, b],
with f (a) · f (b) < 0, the Newton-Raphson method (algorithm) is guaranteed to converge.
Problem 10. True or False: The False position method uses a tangent line to approx-
imate the next root and advance the iteration scheme.
AME 302 chapter 3 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 3
Problem 11 (Graphical Method). The graph of the function f (x) = sin(x) − x2 over
the interval [0, 1], where x is in radians, is shown below. From the graph it is clear that
the function has a root in the interval [0.5, 1]. If the bisection method is used to find the
root with the initial conditions for the bounding interval being xl = 0.5 and xu = 0.9,
then what will xr be after 3 iterations.
Figure 1: The nontrivial root clears lies in the interval [0.5, 0.9]. The root appears to be
somewhere between [0.8, 0.9], so to be safe we’ll use the interval [0.5, 0.9], since this is
our grid spacing.
(a) xr = 0.8 (b) xr = 0.85
Problem 12 (Bisection Method). For which pair, if any, of bracketing points {xl , xu }
will the bisection method converge to the root of the graph below?
For i = 4 we have
(a) xr = 2.4375 and a = 2.5641 (b) xr = 2.3750 and a = 2.5641
where m is the mass of the ball, g = 9.8 m/s2 is the acceleration due to gravity, and cd
is the drag coefficient. Here we’ve assume a large Reynolds number. Write a script that
calls the function bisect.m to determine the drag coefficient cd needed so that an 20-kg
cannon ball has a velocity of 20 m/s after 5 s of free fall. For definiteness, write your
function f in the form:
r r
mg gcd
f (cd ) = tanh t −v.
cd m
If you take xl = 0.3, xu = 0.5, and maxit = 100, then how many iterations does it take
to satisfy the criteria s = 0.0001%?
(a) 8 (b) 13
(c) 19 (d) 24
(e) None of these
AME 302 chapter 3 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 6
Using techniques from fluid mechanics it can be shown that the velocity of water, v (m/s),
can be computed as √
p 2gH
v = 2gH tanh t ,
2L
where g = 9.81 m/s2 , H = initial head (m), L = pipe length (m), and t = elapsed time
(s). Use this equation to determine the initial head H needed to achieve an exit velocity
v = 5 m/s in 2.5 s for a 4-m long pipe by converting the equation into a roots problem
of the form: √
p 2gH
f (H) = 2gH tanh t − v = 0.
2L
Develop a MATLAB script that uses the bisection program bisect.m together with the
initial bracketing guesses: xl = 0 and xu = 4 m. Use the stopping criterion s = 0.1%.
Round your answer to 6 decimal places. Your code should run for 12 iterations.
(a) H = 1.4643 m (b) H = 1.4649 m
Problem 16 (False-Position Method). Use the M-file false position.m given below
for the false
√ position method to determine the positive nonzero root of the function
f (x) = sin( x) − x. Start with initial guesses of xl = 0.5 and xu = 1.0 and iterate until
the approximate relative error falls below 0.01%. If the scheme converges, then round
the answer to six decimal places.
√
Figure 3: Graph of y = sin( x) − x over the interval [0, 1].
1 f u n c t i o n [ r o o t , ea , i t e r ]= f a l s e p o s ( func , xl , xu , es , maxit , v a r a r g i n )
2 % falsepos : root location zeroes
3 % [ r o o t , ea , i t e r ]= f a l s e p o s ( func , xl , xu , es , maxit , p1 , p2 , . . . ) :
4 % uses f a l s e p o s i t i o n to f i n d the root of func
5 % input :
6 % f u n c = name o f f u n c t i o n
7 % xl , xu = l o w e r and upper g u e s s e s
8 % e s = d e s i r e d r e l a t i v e e r r o r ( d e f a u l t = 0.0001%)
9 % maxit = maximum a l l o w a b l e i t e r a t i o n s ( d e f a u l t = 5 0 )
10 % p1 , p2 , . . . = a d d i t i o n a l p a r a m e t e r s used by f u n c t i o n
11 % output :
12 % root = real root
13 % ea = approximate r e l a t i v e e r r o r (%)
14 % i t e r = number o f i t e r a t i o n s
15 %% i n p u t v a l i d a t i o n
16 i f n a r g i n <3, e r r o r ( ' a t l e a s t 3 i n p u t arguments r e q u i r e d ' ) , end
17 t e s t = f u n c ( xl , v a r a r g i n { : } ) * f u n c ( xu , v a r a r g i n { : } ) ;
18 i f t e s t >0, e r r o r ( ' no s i g n change ' ) , end
19 i f n a r g i n <4| es <=0, e s = 0 . 0 0 0 1 ; end
20 i f n a r g i n <5| maxit <=0, maxit =50; end
21 %% w h i l e l o o p i t e r a t i o n
22 i t e r = 0 ; xr = x l ;
23 while (1)
24 x r o l d = xr ;
25 f l =f u n c ( xl , v a r a r g i n { : } ) ;
26 f u=f u n c ( xu , v a r a r g i n { : } ) ;
27 xr = xu − f u * ( x l − xu ) / ( f l − f u ) ;
28 iter = iter + 1;
29 i f xr ˜= 0 , ea = abs ( ( xr − x r o l d ) / xr ) * 1 0 0 ; end
30 t e s t = f l * f u n c ( xr , v a r a r g i n { : } ) ;
31 i f test < 0
32 xu = xr ;
33 e l s e i f test > 0
34 x l = xr ;
35 else
36 ea = 0 ;
37 end
38 i f ea <= e s | i t e r >= maxit , break , end
39 end
40 r o o t = xr ;
AME 302 chapter 3 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 9
(ii) (locally) diverges away from the location of the root xT S if |g 0 (xT S )| > 1.
Consider the equation cos x = sin x over the interval [0, π/2] that has an exact root (true
solution) xT S = π/4. Convert the equation from the form f (x) = 0 to the form x = g(x)
and use the standard fixed-point iteration method of the form xn+1 = g(xn ) with the
initial condition x0 = 0 to find the approximation x3 for the root of the equation. Make
sure to rewrite the equation in a form where |g 0 (xT S )| < 1, so that the iterations converge.
Round your answer to four significant digits.
Comment: For example, if the equation is recast in the form x = tan x − 1 + x = g(x),
then |g 0 (xT S )| = sec2 (π/4) + 1 = 3 > 1, and the scheme will not converge.
(a) 0.6988 (b) 0.8211
(c) 0.7706 (d) no g exists with |g 0 (xT S )| < 1
(e) None of these
Problem 21 (Secant method). Use the Secant method to find the root of f (x) = xe−x
with the initial guesses x0 = 0.3 and x1 = 0.4. Use three iterations. If the scheme is
converging to the root, round your answer to four significant digits. Otherwise choose
“iteration sequence not converging”.
(a) - 0.1844 (b) 0.08012
(c) 0.01396 (d) iteration sequence not converging
(e) None of these
Step 2: Compute the sum of the roots: x1 + x2 + · · · + xn (do not round yet!).
(x − 4)2 + (y − 4)2 = 5
x2 + y 2 = 16
Observe that the equations are two circles. A graphical approach reveals that one of the
roots is near the point (1.8, 3.6). For computational simplicity, take as your initial guess
(x0 , y0 ) = (2, 4), and compute one iteration (x1 , y1 ) using Newton’s method for nonlinear
systems.
(a) (x1 , y1 ) = (1.8, 3.625) (b) (x1 , y1 ) = (1.8, 3.6)
(c) (x1 , y1 ) = (1.7, 3.6) (d) (x1 , y1 ) = (1.75, 3.625)
(e) None of these
AME 302 chapter 3 hw set Copyright ©Wayne Hacker 2018. All rights reserved. 13
that resides in the first quadrant of the xy-plane. Take the initial guess to be xT0 =
[x0 , y0 ] = [2.5, 2.0]. Compute the first iteration to two decimal place accuracy.
(x − 4)2 + (y − 4)2 = 5
x2 + y 2 = 16
A graphical approach reveals that one of the roots is near the point (1.8, 3.6). Determine
the root to four decimal place accuracy.
(a) (x1 , y1 ) = (1.8058, 3.5692) (b) (x1 , y1 ) = (1.8042, 3.5708)
(c) (x1 , y1 ) = (1.8041, 3.5708) (d) (x1 , y1 ) = (1.8058, 3.5708)
(e) None of these