DOC PREVIEW
TAMU PETE 301 - Numerical Methods for Engineers Ch. 3 Solutions

This preview shows page 1-2-3 out of 8 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 8 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1 PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual course preparation. If you are a student using this Manual, you are using it without permission. CHAPTER 3 3.1 (a) 5 432 102(101101) (1 2 ) (0 2 ) (1 2 ) (1 2 ) (0 2 ) (1 2 ) 32 8 4 1 45      (b) 210 1 2 32(101.011) (12)(02)(02)(02)(12)(12) 4 1 0.25 0.125 5.375        (c) 123 452(0.01101) (0 2 ) (1 2 ) (1 2 ) (0 2 ) (1 2 ) 0.25 0.125 0.03125 0.40625          3.2 43 2108(71263) (7 8 ) (1 8 ) (2 8 ) (6 8 ) (3 8 ) 28,672 512 128 48 3 29,363     01 2 38(3.147) (38)(18)(48)(78) 3 0.125 0.0625 0.013671875 3.201171875       3.3 Here are VBA and MATLAB implementations of the algorithm: VBA Procedure MATLAB M-FileOption Explicit Sub GetEps() Dim epsilon As Double epsilon = 1 Do If epsilon + 1 <= 1 Then Exit Do epsilon = epsilon / 2 Loop epsilon = 2 * epsilon MsgBox epsilon End Sub function e = geteps e = 1; while(1) if e + 1 <= 1, break, end e = e / 2; end e = 2 * e; Both routines yield a result of 2.22044604925031E–16 on my laptop. For single precision, the result is 1.192093E–07. Note that MATLAB has a built-in function eps that yields the same result. 3.4 Here are VBA and MATLAB implementations of the algorithm: VBA Procedure MATLAB M-FileOption Explicit Sub GetMin() Dim x As Double, xmin As Double x = 1 Do If x <= 0 Then Exit Do xmin = x x = x / 2 Loop MsgBox xmin End Sub function xmin = getmin x = 1; while(1) if x <= 0, break, end xmin = x; x = x / 2; end Both yield a result of 4.94065645841247E–324 on my desktop PC. For single precision, the result is 1.401298E–45.2 PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual course preparation. If you are a student using this Manual, you are using it without permission. 3.5 Here is a VBA Program to compute the series in ascending order Option Explicit Sub SeriesForward() Dim i As Integer, n As Integer Dim sum As Single, pi As Double, truth As Double pi = 4 * Atn(1) truth = pi ^ 4 / 90 sum = 0 n = 10000 For i = 1 To n sum = sum + 1 / i ^ 4 Next i MsgBox sum 'Display true percent relative error MsgBox 100 * Abs((truth - sum) / truth) End Sub This yields a result of 1.0823221 with a true relative error of 1.0283810–4%. VBA Program to compute in descending order: Option Explicit Sub SeriesBackward() Dim i As Integer, n As Integer Dim sum As Single, pi As Double, truth As Double pi = 4 * Atn(1) truth = pi ^ 4 / 90 sum = 0 n = 10000 For i = n To 1 Step -1 sum = sum + 1 / i ^ 4 Next i MsgBox sum 'Display true percent relative error MsgBox 100 * Abs((truth - sum) / truth) End Sub This yields a result of 1.0823232 with a true relative error of 3.7110–6%. The latter version yields a superior result because summing in descending order mitigates the roundoff error that occurs when adding a large and small number. 3.6 For the first series, after 20 terms are summed, the result is3 PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual course preparation. If you are a student using this Manual, you are using it without permission. The result oscillates at first. By n = 20 (21 terms), it is starting to converge on the true value. However, the relative error is still a substantial 0.11%. If carried out further to n = 27, the series eventually converges to within 7 significant digits. In contrast the second series converges much faster. It attains 6 significant digits by n = 20 with a percent relative error of 8.110–6%. 3.7 The true value can be computed as4 PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by McGraw-Hill for their individual course preparation. If you are a student using this Manual, you are using it without permission. 911,352,2)577.031()577.0(6)577.0('22f Using 3-digits with chopping 004.031996.03332.0332929.0577.046.3462.3)577.0(6622chopping2choppingxxxxx 250,216004.046.3)996.01(46.3)577.0('22f This represents a percent relative error of %8.90911,352,2250,216911,352,2t Using 4-digits with chopping 0013.0319987.033329.0332929.0577.0462.3462.3)577.0(6622chopping2choppingxxxxx 521,048,20013.0462.3)9987.01(462.3)577.0('22f This represents a percent relative error of %9.12911,352,2521,048,2911,352,2t Although using more significant digits improves the estimate, the error is still considerable. The problem stems primarily from the fact that we are subtracting two nearly equal numbers in the denominator. Such subtractive cancellation is worsened by the fact that the denominator is squared. 3.8 First, the correct result can be calculated as 321.37 5(1.37) 6(1.37) 0.55 1.956853y    (a) Using 3-digits with chopping5 PROPRIETARY MATERIAL. © The McGraw-Hill Companies, Inc. All rights reserved. No part of this Manual may be displayed, reproduced or distributed in any form or by any means, without the prior written permission of the publisher, or used beyond the limited distribution to teachers and educators permitted by


View Full Document

TAMU PETE 301 - Numerical Methods for Engineers Ch. 3 Solutions

Documents in this Course
Load more
Download Numerical Methods for Engineers Ch. 3 Solutions
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Numerical Methods for Engineers Ch. 3 Solutions and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Numerical Methods for Engineers Ch. 3 Solutions 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?