Professional Documents
Culture Documents
Dwnload Full Numerical Methods For Engineers 6th Edition Chapra Solutions Manual PDF
Dwnload Full Numerical Methods For Engineers 6th Edition Chapra Solutions Manual PDF
Dwnload Full Numerical Methods For Engineers 6th Edition Chapra Solutions Manual PDF
https://testbankfan.com/download/numerical-methods-for-engineers-6th-edition-chapr
a-solutions-manual/
CHAPTER 2
2.1 Two possible versions can be developed:
IF x ≥ 10 THEN IF x ≥ 10 THEN
DO DO
x = x – 5 x = x – 5
IF x < 50 EXIT IF x < 50 EXIT
END DO END DO
ELSE ELSEIF x < 5
IF x < 5 THEN x = 5
x = 5 ELSE
ELSE x = 7.5
x = 7.5 ENDIF
END IF
ENDIF
2.2
DO
i = i + 1
IF z > 50 EXIT
x = x + 5
IF x > 5 THEN
y = x
ELSE
y = 0
ENDIF
z = x + y
ENDDO
2.3 Students could implement the subprogram in any number of languages. The following VBA program is
one example. It should be noted that the availability of complex variables in languages such as Fortran
90 would allow this subroutine to be made even more concise. However, we did not exploit this
feature, in order to make the code more compatible with languages that do not support complex
variables.
Option Explicit
Sub Rootfind()
Dim ier As Integer
Dim a As Double, b As Double, c As Double
Dim r1 As Double, i1 As Double, r2 As Double, i2 As Double
a = 7: b = 6: c = 2
Call Roots(a, b, c, ier, r1, i1, r2, i2)
If ier = 0 Then
MsgBox "No roots"
ElseIf ier = 1 Then
MsgBox "single root=" & r1
ElseIf ier = 2 Then
MsgBox "real roots = " & r1 & ", " & r2
ElseIf ier = 3 Then
MsgBox "complex roots =" & r1 & "," & i1 & " i" & "; "_
& r2 & "," & i2 & " i"
End If
End Sub
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.
If a = 0 Then
If b <> 0 Then
r1 = -c / b
ier = 1
Else
ier = 0
End If
Else
d = b ^ 2 - 4 * a * c
If (d >= 0) Then
r1 = (-b + Sqr(d)) / (2 * a)
r2 = (-b - Sqr(d)) / (2 * a)
ier = 2
Else
r1 = -b / (2 * a)
r2 = r1
i1 = Sqr(Abs(d)) / (2 * a)
i2 = -i1
ier = 3
End If
End If
End Sub
The answers for the 3 test cases are: (a) −0.3542, −5.646; (b) 0.4; (c) −0.4167 + 1.4696i; −0.4167 −
1.4696i.
2.4 The development of the algorithm hinges on recognizing that the series approximation of the cosine can
be represented concisely by the summation,
x 2i − 2
n
∑i =1
(−1) i −1
(2i − 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
start
input
x, n
i=1
approx = 0
factor = 1
truth = cos(x)
T
i>n
F
sum = sum + value
count = count + 1
2i – 2
x
approx = approx + (−1)
i–1
factor
true − approx
error = 100 %
true
i = i +1
factor = factor (2i – 3) (2i – 2)
end
(b) Pseudocode:
SUBROUTINE Coscomp(n,x)
i = 1
approx = 0
factor = 1
truth = cos(x)
DO
IF i > n EXIT
approx = approx + (-1)i-1•x2•i-2 / factor
error = (true - approx) / true) * 100
DISPLAY i, true, approx, error
i = i + 1
factor = factor•(2•i-3)•(2•i-2)
END DO
END
2.5 Students could implement the subprogram in any number of languages. The following MATLAB M-
file is one example. It should be noted that MATLAB allows direct calculation of the factorial through
its intrinsic function factorial. However, we did not exploit this feature, in order to make the code
more compatible with languages such as Visual BASIC and Fortran.
function coscomp(x,n)
i = 1;
tru = cos(x);
approx = 0;
f = 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.
Another random document with
no related content on Scribd:
died in bed, knew what his progenitors had been spared. Even in the
soberly civilized eighteenth century there lingered a doubt as to the
relative value of battle-field, gallows and sick-chamber.
“True blue
And Mrs. Crewe”
and how shall we reach him save through the pages of history? It is
the foundation upon which are reared the superstructures of
sociology, psychology, philosophy and ethics. It is our clue to the
problems of the race. It is the gateway through which we glimpse the
noble and terrible things which have stirred the human soul.
A cultivated American poet has said that men of his craft “should
know history inside out, and take as much interest in the days of
Nebuchadnezzar as in the days of Pierpont Morgan.” This is a
spacious demand. The vast sweep of time is more than one man can
master, and the poet is absolved by the terms of his art from severe
study. He may know as much history as Matthew Arnold, or as little
as Herrick, who lived through great episodes, and did not seem to be
aware of them. But Mr. Benét is wise in recognizing the inspiration of
history, its emotional and imaginative appeal. New York and Pierpont
Morgan have their tale to tell; and so has the dark shadow of the
Babylonian conqueror, who was so feared that, while he lived, his
subjects dared not laugh; and when he died, and went to his
appointed place, the poor inmates of Hell trembled lest he had come
to rule over them in place of their master, Satan.
“The study of Plutarch and ancient historians,” says George
Trevelyan, “rekindled the breath of liberty and of civic virtue in
modern Europe.” The mental freedom of the Renaissance was the
gift of the long-ignored and reinstated classics, of a renewed and
generous belief in the vitality of human thought, the richness of
human experience. Apart from the intellectual precision which this
kind of knowledge confers, it is indirectly as useful as a knowledge of
mathematics or of chemistry. How shall one nation deal with another
in this heaving and turbulent world unless it knows something of
more importance than its neighbour’s numerical and financial
strength—namely, the type of men it breeds. This is what history
teaches, if it is studied carefully and candidly.
How did it happen that the Germans, so well informed on every
other point, wrought their own ruin because they failed to understand
the mental and moral make-up of Frenchmen, Englishmen and
Americans? What kind of histories did they have, and in what spirit
did they study them? The Scarborough raid proved them as ignorant
as children of England’s temper and reactions. The inhibitions
imposed upon the port of New York, and the semi-occasional ship