solucionario metodos numericos v 3

Upload: javier-ignacio-velasquez-bolivar

Post on 30-Oct-2015

352 views

Category:

Documents


2 download

TRANSCRIPT

  • Sample

    Student Solutions Manual

    to accompany

    NUMERICAL METHODS, Third Edition

    J. Douglas Faires and Richard L. Burden

    Youngstown State University

    September 22, 2002

  • ii

  • Contents

    1 Mathematical Preliminaries 1EXERCISE SET 1.2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1EXERCISE SET 1.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6EXERCISE SET 1.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

    iii

  • iv CONTENTS

    This is a Sample of the Student Solutions Manual for Numerical Methods, ThirdEdition, by Faires and Burden. It contains worked out exercises for all the techniquesdiscussed in the rst Chapter of the book. The full Student Solutions Manual containsworked out exercises for all the techniques discussed in the entire book. The answersto the odd exercises are in the back of the text, but the results listed in this StudyGuide go well beyond the answers listed in the text, and the exercises that are solvedin this Student Solutions Manual were carefully chosen as those requiring insight intothe methods presented in the text.

    In addition to the solutions to numerous exercises, the Student Solutions Manualcontains a listing of the instructions for the program disk that accompanies NumericalMethods, together with a copy of the CD that contains the programs in the program-ming languages C, Pascal, and FORTRAN and for the Computer Algebra SystemsMaple, Mathematica, and Matlab. These programs can be extremely valuable in yourstudy of approximation techniques since they permit you to see the calculations thatneed to be performed without the necessity of performing the calculations by hand.

    If you are interested in obtaining the entire Student Solutions Manual, it can likelybe obtained at your local bookstore. If not, you can obtain a copy from the publisherat

    http://www.brookscole.com/math d/

    J. Douglas [email protected]

    Richard L. Burden Youngstown State [email protected] September 22, 2002

  • Chapter 1

    Mathematical Preliminaries andError Analysis

    EXERCISE SET 1.2 (Page 13 )

    1. d. Show that the equationx (ln x)x = 0

    has at least one solution in the interval [4, 5].Solution: It is not possible to algebraically solve for the solution x , but this is notrequired in the problem, we must only show that a solution exists. Let

    f (x) = x (ln x)x = x exp(x(ln(ln x))).Since f is continuous on [4, 5] with f (4) 0.3066 and f (5) 5.799, the Interme-diate Value Theorem implies that a number x must exist in (4, 5) with

    0 = f (x) = x (ln x)x .

    2. c. Find intervals that contain a solution to

    x3 2x2 4x + 3 = 0.

    1

  • 2 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    Solution: Letf (x) = x3 2x2 4x + 3.

    The critical points of f occur when0 = f (x) = 3x2 4x 4 = (3x + 2)(x 2),

    that is, when x = 23 and x = 2. Relative maximum and minimum values of fcan occur only at these values. There are at most three solutions to f (x) = 0, sincef (x) is a polynomial of degree three. Since f (2) = 5 and f (1) = 4; f (0) = 3and f (1) = 2 and f (2) = 5 and f (4) = 19, solutions lie in the intervals [2,1],[0, 1], and [2, 4].

    4. a. Find max0x1 | f (x)| when

    f (x) = 2 ex + 2x3

    .

    Solution: First note thatf (x) = (ex + 2)/3

    so the only critical point of f occurs at x = ln 2, which lies in the interval [0, 1]. Themaximum for | f (x)| must consequently be

    max{| f (0)|, | f (ln 2)|, | f (1)|} = max{1/3, (2 ln 2)/3, (4 e)/3}=(2 ln 2)/3 0.4620981.

    7. Find the second Taylor polynomial for

    f (x) = ex cos xabout x0 = 0.Solution: Since

    f (x) = ex (cos x sin x), f (x) = 2ex (sin x),and

    f (x) = 2ex (sin x + cos x),we have f (0) = 1, f (0) = 1, and f (0) = 0. So

    P2(x) = 1 + x and R2(x) = 2e (sin + cos )

    3! x3.

  • EXERCISE SET 1.2 3

    a. Use P2(0.5) to approximate f (0.5), nd an upper bound for| f (0.5) P2(0.5)|,

    and compare this to the actual error.

    Solution: P2(0.5) = 1 + 0.5 = 1.5 and

    | f (0.5) P2(0.5)| max[0.0.5]

    2e (sin + cos )3! (0.5)2

    13(0.5)2 max

    [0,0.5]|e (sin + cos )|.

    To maximize this quantity on [0, 0.5], rst note thatDx ex (sin x + cos x) = 2ex cos x > 0

    for all x in [0, 0.5]. This implies that the maximum and minimum values of ex (sin x +cos x) on [0, 0.5] occur at the endpoints of the interval, and

    e0(sin 0 + cos 0) = 1 < e0.5(sin 0.5 + cos 0.5) 2.2373.Hence

    | f (0.5) P2(0.5)| 13 (0.5)3(2.273) 0.093222.

    Since P2(0.5) = 1.5 and f (0.5) = 1.446889, the actual error is 0.053111.

    b. Find a bound for the error | f (x) P2(x)|| for x in [0, 1]Solution: A similar analysis to that in part (a) gives

    | f (x) P2(x)| 13 (1.0)3e1(sin 1 + cos 1) 1.252.

    c. Approximate 10

    f (x) dx using 1

    0P2(x) dx .

  • 4 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    Solution: 10

    f (x) dx 1

    01 + x dx =

    [x + x

    2

    2

    ]10= 1.5.

    d. Find an upper bound for the error in part (c).

    Solution: From part (b), 10

    |R2(x)| dx 1

    0

    13

    e1(cos 1 + sin 1)x3 dx = 1

    01.252x3 dx = 0.313.

    Since 10

    ex cos x dx =[

    ex

    2(cos x + sin x)

    ]10= e

    2(cos 1 + sin 1) 1

    2(1 + 0) 1.378,

    the actual error is |1.378 1.5| 0.12.

    9. Use the error term of a Taylor polynomial to estimate the error involvedin using

    sin x xto approximate sin 1.

    Solution: First we need to convert the degree measure for the sine function to radians.We have 180 = radians, so 1 = 180 radians. Since,

    f (x) = sin x, f (x) = cos x, f (x) = sin x, and f (x) = cos x,we have f (0) = 0, f (0) = 1, and f (0) = 0. The approximation sin x x is given by

    f (x) P2(x), and R2(x) = cos 3! x3.

    If we use the bound | cos | 1, thensin 180 180 = R2 ( 180

    ) = cos 3!(

    180

    )3 8.86 107.

    11. a. Letf (x) = ex/2 sin x

    3.

    Use Maple to determine the third Maclaurin polynomial P3(x).

  • EXERCISE SET 1.2 5

    Solution: Dene f (x) with>f:=exp(x/2)*sin(x/3);

    f := e(1/2x) sin(

    13

    x

    )Find the rst three terms of the Taylor series with

    >g:=taylor(f,x=0,4);

    g := 13

    x + 16

    x2 + 23648

    x3 + O(x4)Extract the third Maclaurin polynomial with

    >p3:=convert(g,polynom);

    p3 := 13

    x + 16

    x2 + 23648

    x3

    b. Determine f (4)(x), and bound the error | f (x) P3(x)| on [0, 1].Solution: First we determine the fourth derivative.

    >f4:=diff(f,x,x,x,x);

    f 4 := 1191296

    e(x/2) sin(

    13

    x

    )+ 5

    54e(x/2) cos

    (13

    x

    )Next we nd the fth derivative.

    >f5:=diff(f4,x);

    f 5 := 1992592

    e(x/2) sin(

    13

    x

    )+ 61

    3888e(x/2) cos

    (13

    x

    )Then we see if the fourth derivative has any critical points in [0, 1].>p:=fsolve(f5=0,x,0..1);

    p := .6047389076The extreme values of the fourth derivative will occur at x = 0, 1, or p.>c1:=evalf(subs(x=p,f4));

    c1 := .09787176213

  • 6 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    >c2:=evalf(subs(x=0,f4));

    c2 := .09259259259>c3:=evalf(subs(x=1,f4));

    c3 := .09472344463The maximum absolute value of f (4)(x) is c1 and the error is given by>err:=c1/24;

    err := .004077990089

    EXERCISE SET 1.3 (Page 20 )

    3. e. Use three-digit rounding arithmetic to compute

    1314 67

    2e 5.4and determine the absolute and relative errors.

    Solution: Using three-digit rounding arithmetic gives 1314 = 0.929, 67 = 0.857, ande = 2.72. So

    1314

    67

    = 0.0720 and 2e 5.4 = 5.44 5.40 = 0.0400.

    Hence,1314 67

    2e 5.4 =0.07200.0400

    = 1.80.The correct value is approximately 1.954, so the absolute and relative errors to threedigits are

    |1.80 1.954| = 0.154 and |1.80 1.954|1.954

    = 0.0788,respectively.

  • EXERCISE SET 1.3 7

    7. a. Use the rst three terms of the Maclaurin series for the arctangent functionto approximate

    = 4[

    arctan12

    + arctan 13

    ]and determine the absolute and relative errors.

    Solution: Let P(x) = x 13 x3+ 15 x5. Then P(

    12

    )= 0.464583 and P

    (13

    )= 0.3218107,

    so

    = 4[

    arctan12

    + arctan 13

    ] 3.145576.

    The absolute and relative errors are, respectively,

    | 3.145576| 3.983 103 and | 3.145576|| | 1.268 103.

    10. The Taylor polynomial of degree n for

    f (x) = ex isn

    i=0

    xi

    i ! .

    Use the Taylor polynomial of degree nine and three-digit choppingarithmetic to nd an approximation to e5 by each of the followingmethods. Which formula, (a) or (b), gives the most accuracy, andwhy?

    a. e5 9

    i=0

    (5)ii ! =

    9i=0

    (1)i 5ii !

    Solution: The Taylor polynomial of degree nine gives

    e5 9

    i=0

    (1)i 5ii !

    = 1 5 + 252

    1256

    + 62524

    3120120

    + 15600720

    780005040

    + 39000040300

    1950000362000

  • 8 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    = 1 5 + 12.5 20.8 + 26.0 26.0 + 21.6 15.4 + 9.67 5.38= 1.81

    b. e5 = 1e5

    19i=0 5

    i

    i !.

    Solution: The reciprocal of the Taylor polynomial of degree nine gives

    e5 19i=0 5

    ii !

    = 11 + 5 + 12.5 + 20.8 + 26.0 + 26.0 + 21.6 + 15.4 + 9.67 + 5.38

    = 1141

    = 7.09 103

    An approximate value of e5 correct to three digits is 6.74 103. Part (b) is moreaccurate since subtraction is not involved.

    11. A rectangular parallelepiped has sides 3 cm, 4 cm, and 5 cm, measuredto the nearest centimeter.

    Solution: Let the sides be x , y, and z, and suppose that the measurements givex = 3 cm, y = 4 cm, and z = 5 cm. Since the measurements are accurate to thenearest centimeter, it follows that the actual values satisfy the inequalities

    2.5 x 3.5, 3.5 y 4.5, and 4.5 z 5.5

    a. What are the best upper and lower bounds for the volume of this paral-lelepiped?

    Solution: Since the volume is V = xyz we have(2.5)(3.5)(4.5) V (3.5)(4.5)(5.5) and 39.375 V 86.625

    b. What are the best upper and lower bounds for the surface area?

    Solution: Since the surface area is S = 2xy + 2xz + 2yz we have2(2.5)(3.5) + 2(2.5)(4.5) + 2(3.5)(4.5) S

  • EXERCISE SET 1.4 9

    andS 2(3.5)(4.5) + 2(3.5)(5.5) + 2(4.5)(5.5),

    so 71.5 S 119.50.

    EXERCISE SET 1.4 (Page 27 )

    1. c. (i) Use four-digit rounding arithmetic and the formulas of Example 1 tond the most accurate approximations to the roots of

    1.002x2 11.01x + 0.01265 = 0.

    (ii) Compute the absolute error and relative error.

    Solution: Since b = 11.01 is negative, we use the formulas

    x1 = b +

    b2 4ac2a

    and x2 = 2cb b2 4ac

    to avoid the subtraction of nearly equal numbers. Using four-digit rounding arithmeticgives

    x1 = b +

    b2 4ac2a

    = (11.01) +

    (11.01)2 4(1.002)(0.01265)2a

    = 11.01 +

    121.2 4.008(0.01265)2.004

    = 11.01 +

    121.2 0.050702.004

    = 11.01 +

    121.12.004

    = 11.01 + 11.002.004

    = 22.012.004

    = 10.98

    The actual root is 10.98687488, so the absolute error is |10.98687488 10.98| =6.87488 103, and the relative error is

    6.87488 10310.98687488

    = 6.25736 104.

    Also,

    x2 = 2cb b2 4ac =

    2(0.01265)11.01 (11.01)2 4(1.002)(0.01265)

  • 10 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    = 0.0253011.01 11.00 =0.0253022.01 = 0.001149.

    The actual root is 0.001149076 so the absolute error of this approximation is

    |0.001149076 0.001149| = 7.566 108,and the relative error is

    7.566 1080.001149076

    = 6.5844 105.

    2. c. Repeat Exercise 1 using four-digit chopping arithmetic.

    Solution: Since b = 11.01 is negative, we use the formulas

    x1 = b +

    b2 4ac2a

    and x2 = 2cb b2 4ac

    to avoid the subtraction of nearly equal numbers. Using four-digit chopping arithmeticgives

    x1 = b +

    b2 4ac2a

    = (11.01) +

    (11.01)2 4(1.002)(0.01265)2a

    = 11.01 +

    121.2 4.008(0.01265)2.004

    = 11.01 +

    121.2 0.050702.004

    = 11.01 +

    121.12.004

    = 11.01 + 11.002.004

    = 22.012.004

    = 10.98

    The actual root is 10.98687488, so the absolute error is |10.98687488 10.98| =6.87488 103, and the relative error is

    6.87488 10310.98687488

    = 6.25736 104.

    Also,

    x2 = 2cb b2 4ac =

    2(0.01265)11.01 (11.01)2 4(1.002)(0.01265)

    = 0.0253011.01 11.00 =0.0253022.01 = 0.001149.

  • EXERCISE SET 1.4 11

    The actual root is 0.001149076 so the absolute error of this approximation is

    |0.001149076 0.001149| = 7.566 108,and the relative error is

    7.566 1080.001149076

    = 6.5844 105.

    5. The fth Maclaurin polynomials for e2x and e2x are

    P5(x) =((((

    415

    x + 23

    )x + 4

    3

    )x + 2

    )x + 2

    )x + 1

    and

    P5(x) =((((

    415

    x + 23

    )x 4

    3

    )x + 2

    )x 2

    )x + 1

    a. Approximate e0.98 using P5(0.49) and four-digit rounding arithmetic.

    Solution: Using four-digit rounding arithmetic to evaluate P5(0.49) gives

    P5(0.49) = (((((0.2667)(0.49) + 0.6667)(0.49) 1.333)(0.49) + 2)(0.49) 2)(0.49) + 1

    = ((((0.1307 + 0.6667)(0.49) 1.333)(0.49) + 2)(0.49) 2)(0.49) + 1

    = ((((0.5360)(0.49) 1.333)(0.49) + 2)(0.49) 2)(0.49) + 1= (((0.2626 1.333)(0.49) + 2)(0.49) 2)(0.49) + 1= (((1.070)(0.49) + 2)(0.49) 2)(0.49) + 1= (((0.5243) + 2)(0.49) 2)(0.49) + 1= ((1.476)(0.49) 2)(0.49) + 1= (0.7232 2)(0.49) + 1= (1.277)(0.49) + 1= 0.6257 + 1= 0.3743

  • 12 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    b. Compute the absolute and relative error for the approximations in part(a).

    Solution: The absolute error is |e0.98 0.3743| = 1.011 103, and the relativeerror is

    1.011 103e0.98

    = 2.694 103.

    c. Approximate e0.98 using 1/P5(0.49) and four-digit rounding arithmetic.

    Solution: We have

    1P5(0.49)

    = 1(((((0.2667)(0.49) + 0.6667)(0.49) + 1.333)(0.49) + 2)(0.49) + 2)(0.49) + 1

    = 12.663

    = 0.3755.

    d. Compute the absolute and relative errors for the approximations in part(c).

    Solution: The absolute error is

    |e0.98 0.3755| = 1.889 104,and the relative error is

    1.889 104e0.98

    = 5.033 104.

    6. a. Show that the polynomial nesting technique can be used to evaluate

    f (x) = 1.01e4x 4.62e3x 3.11e2x + 12.2ex 1.99.

    Solution: Since enx = (ex )n , we can writef (x) = ((((1.01)ex 4.62)ex 3.11)ex + 12.2)ex 1.99.

  • EXERCISE SET 1.4 13

    b. Use three-digit rounding arithmetic and the formula given in the state-ment of part (a) to evaluate f (1.53).Solution: Using e1.53 = 4.62 and three-digit rounding gives e2(1.53) = (4.62)2 =21.3, e3(1.53) = (4.62)2(4.62) = (21.3)(4.62) = 98.4, and e4(1.53) = (98.4)(4.62) = 455.So

    f (1.53) = 1.01(455) 4.62(98.4) 3.11(21.3) + 12.2(4.62) 1.99= 460 455 66.2 + 56.4 1.99= 5.00 66.2 + 56.4 1.99= 61.2 + 56.4 1.99 = 4.80 1.99 = 6.79.

    c. Redo the calculations in part (b) using the nesting form of f (x) that wasfound in part (a).

    Solution:

    f (1.53) = (((1.01)4.62 4.62)4.62 3.11)4.62 + 12.2)4.62 1.99= (((4.67 4.62)4.62 3.11)4.62 + 12.2)4.62 1.99= ((0.231 3.11)4.62 + 12.2)4.62 1.99= (13.3 + 12.2)4.62 1.99 = 7.07.

    d. Compare the approximations in parts (b) and (c).

    Solution: The exact result is 7.61, so the absolute errors in parts (b) and (c) are,respectively, | 6.79 + 7.61| = 0.82 and | 7.07 + 7.61| = 0.54. The relative errorsare, respectively, 0.108 and 0.0710.

  • 14 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    7. Use three-digit chopping arithmetic to compute the sum

    10i=1

    1i2

    rst by11

    + 14

    + + 1100

    and then by1

    100+ 1

    81+ + 1

    1,

    adding left to right. Which method is more accurate, and why?

    Solution: Using three-digit chopping arithmetic on10

    i=1 1i2 in the order 1+ 14 + +1

    100 gives

    1.00 + 0.250 + 0.111 + 0.0625 + 0.0400 + 0.0277+ 0.0204 + 0.0156 + 0.0123 + 0.0100

    = 1.25 + 0.111 + 0.0625 + 0.0400 + 0.0277 + 0.0204 + 0.0156 + 0.0123 + 0.0100= 1.36 + 0.0625 + 0.0400 + 0.0277 + 0.0204 + 0.0156 + 0.0123 + 0.0100= 1.42 + 0.0400 + 0.0277 + 0.0204 + 0.0156 + 0.0123 + 0.0100= 1.46 + 0.0277 + 0.0204 + 0.0156 + 0.0123 + 0.0100= 1.48 + 0.0204 + 0.0156 + 0.0123 + 0.0100= 1.50 + 0.0156 + 0.0123 + 0.0100= 1.51 + 0.0123 + 0.0100= 1.52 + 0.0100= 1.53.

    In the reverse order we sum 1100 + 181 + + 14 + 1 as0.0100+ .0123+0.0156+0.0204+0.0277+0.0400+0.0625+0.111+0.25+1.00 = 1.54The actual value is 1.549. The problem of adding a very small number to an accumu-lated sum causes signicant round-o errors in the rst method.

  • EXERCISE SET 1.4 15

    8. a. Determine the number n of terms of the series

    arctan x = limn Pn(x) =

    i=1

    (1)i+1 x2i1

    (2i 1)

    that are required to ensure that |4Pn(1) | < 103.Solution: Since the terms of the series

    = 4 arctan 1 = 4

    i=1(1)i+1 1

    2i 1

    alternate in sign, the error produced by truncating the series at any term is less thanthe magnitude of the next term. To ensure signicant accuracy we need to choose nso that

    42(n + 1) 1 < 10

    3 or 4000 < 2n + 1.To ensure this accuracy requirement we need n 2000.

    b. How many terms are required to ensure the 1010 accuracy needed for anapproximation to ?

    Solution: In this case we need

    42(n + 1) 1 < 10

    10 or n > 20, 000, 000, 000.

    Clearly, a more rapidly convergent method is needed for this approximation.

    10. b. Find the rate of convergence of

    limn sin

    (1n2

    )= 0

    as n .Solution: The second Taylor polynomial for f (x) = sin x about x0 = 0 and itsremainder term are sin x = x 16 (cos x )x3. We let x = 1n2 to obtain

    sin1n2

    = 1n2

    (

    16

    cos

    )(1n2

    )3

  • 16 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    where is between 0 and 1n2

    . Since | cos | 1 we have 1n2 (

    16

    cos

    )1n6

    2n2 .Thus, sin 1n2 0

    2 1n2

    and the rate of convergence of sin 1

    n2is O

    (1

    n2

    ).

    12. a. How many calculations are needed to determine a sum of the form

    ni=1

    ij=1

    ai b j ?

    Solution: For each i the inner sumi

    j=1 ai b j requires i multiplications and i 1additions, for a total of

    ni=1

    i = n(n + 1)2

    Multiplications

    andn

    i=1i 1 = n(n + 1)

    2 n Additions.

    Once the n inner sums are computed, n 1 additions are required for the nal sum.The nal total is:

    n(n + 1)2

    Multiplications and(n + 2)(n 1)

    2Additions.

    b. Re-express the series in a way that will reduce the number of calculationsneeded to determine this sum.

    Solution: By rewriting the sum as

    ni=1

    ij=1

    ai b j =n

    i=1ai

    ij=1

    b j

  • EXERCISE SET 1.4 17

    we can signicantly reduce the amount of calculation. For each i we now need i 1additions to sum b j s for a total of

    ni=1

    i 1 = n(n + 1)2

    n Additions.

    Once the b j s are summed we need n multiplications by the ai s, followed by n 1additions of the products.

    The total additions by this method is still (n+2)(n1)2 , but the number of multipli-cations has been reduced from n(n+1)2 to n.

    13. Consider the Fibonacci sequence dened by

    F0 = 1, F1 = 1, and Fn+2 = Fn+1 + Fn, if n 0,and dene

    xn = Fn+1/Fn.Assuming that

    limn xn = x

    converges, show that the limit is the golden ratio:

    x = 1 +

    52

    .

    Solution: Since

    limn xn = limn xn+1 = x and xn+1 = 1 +

    1xn

    ,

    we havex = 1 + 1

    xwhich implies that x2 x 1 = 0.

    The only positive solution to this quadratic equation is x = (1 + 5)/2.

    14. The Fibonacci sequence also satises the equation

    Fn Fn = 15

    [(1 + 5

    2

    )n(

    1 52

    )n].

  • 18 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    a. Write a Maple procedure to calculate F100.

    Solution: We have

    >n:=98;f:=1;s:=1;

    n :=98f :=1s :=1

    >for i from 1 to n do> l:=f+s;f:=s;s:=l;>od;

    l :=2f :=1s :=2l :=3f :=2s :=3l :=5

    ...

    l :=218922995834555169026f :=135301852344706746049s :=218922995834555169026l :=354224848179261915075

    b. Use Maple with the default value of Digits followed by evalf to calculateF100.

    Solution: We have

    > F100:=(((1+sqrt(5))/2)^100-((1-sqrt(5))/2)^100)/sqrt(5);

    F100 := 15

    ((12

    + 12

    5)100

    (

    12

    12

    5)100)

    5

  • EXERCISE SET 1.4 19

    >evalf(F100);

    .3542248538 1021

    c. Why is the result from part (a) more accurate than the result from part(b)?

    Solution: The result in part (a) is computed using exact integer arithmetic, and theresult in part (b) is computed using 10-digit rounding arithmetic.

    d. Why is the result from part (b) obtained more rapidly than the resultfrom part (a)?

    Solution: The result in part (a) required traversing a loop 98 times.

    e. What results when you use the command simplify instead of evalf tocompute F100?

    Solution: The result is the same as the result in part (a).

    15. The harmonic series

    1 + 12

    + 13

    + 14

    + diverges, but the sequence

    n = 1 + 12 + +1n

    ln n

    converges, since {n} is a bounded, nonincreasing sequence. The limit 0.5772156649 . . . of the sequence {n} is called Eulers constant.

    a. Use the default value of Digits in Maple to determine the value of n for to be within 102.

    b. Use the default value of Digits in Maple to determine the value of n for to be within 103.

  • 20 CHAPTER 1. MATHEMATICAL PRELIMINARIES

    c. What happens if you use the default value of Digits in Maple to deter-mine the value of n for to be within 104?

    Solution: The following Maple procedure is used:

    >g:=proc(t);> dne:=1;> n:=1;> sm:=0;> while dne=1 do> sm:=sm+evalf(1/n);> gam:=evalf(sm-ln(n));> err:=abs(evalf(gamma)-gam);> if err else n:=n+1;> fi;> od;> n;>end;>g(0.01);>g(0.001);>g(0.0001);

    The results from the procedure area. n = 50, b. n = 500, and c. n = 5001.If a procedure is not used, as in the following code, the program fails.

    >restart;>tol:=0.0001;>dne:=1;>n:=1;>sm:=0;>while dne=1 do> sm:=sm+evalf(1/n);> gam:=evalf(sm-ln(n));> err:=abs(evalf(gamma)-gam);> if err else n:=n+1;> fi;>od;>n;