CH 4
CH 4
Problem 1
The problem is to …nd the zero of f (x) = x3 75. With f 0 (x) = 3x2 , Newton’s
formula is
x3 75
x x
3x2
Starting with x = 4, succesive iterations yield
43 75
x 4 = 4:229
3(4)2
4:2293 75
x 4:229 = 4:217
3(4:229)2
4:2173 75
x 4:217 = 4:217 J
3(4:217)2
Problem 2
x1 = 4 x2 = 5
x3 = 4:5
if x < x3 : x2 x3
if x > x3 : x1 x3
x3 x
x1 x2 x3 f1 f2 f3 x f (x)
4:000 5:000 4:500 18:850 20:051 10:489 4:907 12:038
4:500 5:000 4:907 10:489 20:051 12:038 4:716 0:818
4:500 4:907 4:716 10:489 12:038 0:818 4:731 0:0582
4:716 4:907 4:731 0:818 12:038 0:0582 4:730
Problem 4
Newton’s formula is
f (x)
x x
f 0 (x)
where
10:489
x 4:5 = 4:804
34:52
4:573
x 4:804 = 4:735
66:31
0:283
x 4:735 = 4:730
58:20
0:001
x 4:730 = 4:730 J
57:65
Problem 5
x f (x) Interval
7:0 0:129
7:4 1:049 (7:0; 7:4)
(7:0 + 7:4)=2 = 7:2 0:305 (7:0; 7:2)
(7:0 + 7:2)=2 = 7:1 0:065 (7:0; 7:1)
(7:0 + 7:1)=2 = 7:05 0:036 (7:05; 7:1)
(7:05 + 7:1)=2 = 7:075 0:013 (7:05; 7:075)
(7:05 + 7:075)=2 = 7:063 0:011 (7:063; 7:075)
(7:063 + 7:075)=2 = 7:069 0:000
x = 7:069 J
Problem 6
f (x)
x x
f 0 (x)
PROBLEM 5 99
Starting with x = 2, successive applications of Newton’s iterative formula
yield
4:1577
x 2 = 0:2015
2:3117
0:7392
x 0:2015 = 0:6693
1:5801
0:2676
x 0:6693 = 0:5682
2:6456
0:0093
x 0:5682 = 0:5644
2:4571
0:0000
x 0:5644 = 0:5644 J
2:445
Starting with x = 2, we get
2:3391
x 2 = 1:2560
3:1440
0:1203
x 1:2560 = 1:2087
2:5430
0:0021
x 1:2087 = 1:2078
2:4512
0:0000
x 1:2078 = 1:2078 J
2:4495
Problem 7
1:5 ( 2)
x2 = 1:5 ( 2:7853) = 0:4852
2:7853 ( 4:1577)
0:4852 ( 1:5)
x3 = 0:4852 (0:1872) = 0:5491
0:1872 ( 2:7853)
0:5491 ( 0:4852)
x4 = 0:5491 (0:0369) = 0:5648
0:0369 0:1872
0:5648 ( 0:5491)
x5 = 0:5648 ( 0:0013) = 0:5643
0:0013 0:0369
0:5643 ( 0:5648)
x6 = 0:5643 (0:0000) = 0:5643 J
0:0000 ( 0:0013)
1:5 2
x2 = 1:5 ( 0:7903) = 1:2449
0:7903 ( 2:3391)
1:2449 1:5)
x3 = 1:2449 ( 0:0921) = 1:2112
0:0921 ( 0:7903)
1:2112 1:2449
x4 = 1:2112 ( 0:0083) = 1:2079
0:0083 ( 0:0921)
1:2079 1:2112
x5 = 1:2079 ( 0:0001) = 1:2079 J
0:0001 ( 0:0083)
Problem 8
(a)
We see from the plot that a root of f (x) = 0 is at approximately x = 4:75.
(b)
The …rst ”improved” value of x predicted by the Newton-Raphson formula is
at the intersection of the tangent at x = 4 and the x-axis. Since the tangent
is almost horizontal, the intersection point is o¤ the right end of the plot (in
x > 8). It is clear that subsequent iterations would keep x away from the root
near 4.75.
PROBLEM 8 101
We can con…rm our …ndings from the Newton-Raphson formula:
f (x) f (4) 18:85
x x =4 =4 = 10:66
f 0 (x) f 0 (4) 2:829
which is indeed ”o¤ the chart”.
Problem 9
Problem 10
The easiest way to handle this problem is to simply replace bisect with ridder
in Example 4.3. We chose a slightly di¤erent approach and wrote the function
rootsRidder loosely based on Example 4.3:
function rootsRidder(func,a,b,dx,tol)
% Computes all the roots of func(x) in the interval (a,b)
% with Ridder’s method.
% USAGE: roots(func,a,b,dx,tol)
% func = handle of function that returns f(x)
% dx = increment of x used in root search
% tol = error tolerance (default is 10.e-6)
Roots:
-4.712389e+000
-3.208839e+000
1.570796e+000
Done
Note the use of MATLAB’s in-line function, which is passed to rootsRidder.
An in-line function can be evaluated by feval in the same manner as a function
stored in a M-…le. The advantage of an in-line function is that it does not
create a new M-…le.
Problem 11
PROBLEM 11 103
if nargin < 6; tol = 1.0e-6; end
fprintf(’Roots:\n’)
while 1
[x1,x2] = rootsearch(func,a,b,dx);
if isnan(x1)
fprintf(’Done’); break
else
a = x2;
x = newtonRaphson(func,dfunc,x1,x2,tol);
if isnan(x); continue
else fprintf(’%16.6e\n’, x); end
end
end
% problem4_1_11
func = inline(’x*sin(x) + 3*cos(x) - x’,’x’);
dfunc = inline(’x*cos(x) - 2*sin(x) - 1’,’x’);
rootsNewton(func,dfunc,-6,6,0.5)
>> Roots:
-4.712389e+000
-3.208839e+000
1.570796e+000
Done
Problem 12
y 250
200
150
100
50
-4 -3 -2 -1 1 2 3 4
x
From the plot of f (x) we see that there are two roots, located in ( 3:2; 2:4). As
the derivative of the function is easily obtained, we use the Newton-Raphson
method due to its superior covergence. The program below calls rootsNewton
listed in Problem 11.
% problem4_1_12
func = inline(’x^4 + 0.9*x^3 - 2.3*x^2 + 3.6*x - 25.2’,’x’);
dfunc = inline(’4*x^3 + 2.7*x^2 - 4.6*x + 3.6’,’x’);
rootsNewton(func,dfunc,-3.2,2.4,2)
>> Roots:
-3.000000e+000
2.100000e+000
Done
Problem 13
PROBLEM 13 105
y
6
0
0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0
x
By inspection of the plot of f (x) we see that the two positive roots are located
in (0:7; 1:7). Again we compute these roots with the function rootsNewton in
Problem 11.
% problem4_1_13
func = inline(’x^4 + 2*x^3 - 7*x^2 + 3’,’x’);
dfunc = inline(’4*x^3 + 6*x^2 - 14*x’,’x’);
rootsNewton(func,dfunc,0.7,1.7,0.5)
>> Roots:
7.912878e-001
1.618034e+000
Done
Problem 14
y
0.5
0.0
2 4 6 8 10 12 14
x
-0.5
-1.0
-1.5
-2.0
>> Roots:
2.852342e+000
7.068174e+000
8.423204e+000
Done
Problem 15
f ( ) = cosh cos + 1
f 0 ( ) = sinh x cos x cosh x sin x
y 20
10
0
1 2 3 4 5
x
-10
The plot of f ( ) reveals that the roots lie in (1:8; 2:0) and (4:6; 4:8). The
following program uses newtonRaphson to compute these roots:
% problem4_1_15
func = inline(’cosh(x)*cos(x) + 1’,’x’);
dfunc = inline(’sinh(x)*cos(x) - cosh(x)*sin(x)’,’x’);
b = 0.025; h = 0.0025; rho = 7850; E = 200e9; L = 0.9;
I = b*h^3/12; m = rho*b*h*L;
C = sqrt(E*I/(m*L^3))/(2*pi);
bracket = [1.8 2; 4.6 4.8];
for i = 1:2
beta = newtonRaphson(func,dfunc,bracket(i,1),bracket(i,2));
PROBLEM 15 107
freq = C*beta^2
end
>> freq =
2.5166
freq =
15.7713
Problem 16
1 s 1
f( ) = sinh = sinh 1:1
L
1 1
f 0( ) = cosh 2 sinh
y
0.05
0.00
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
-0.05
-0.10
According to the plot, the smallest positive root lies in (0:72; 0:80). We use
newtonRaphson to compute this root.
% problem4_1_16
func = inline(’sinh(x)/x - 1.1’,’x’);
dfunc = inline(’cosh(x)/x - sinh(x)/x^2’,’x’);
beta = newtonRaphson(func,dfunc,0.72,0.8)
gamma = 77000; L = 1000; s = 1100;
sigma0 = gamma*L/(2*beta);
max_stress = sigma0*cosh(beta)
>> beta =
0.7634
max_stress =
6.5855e+007
Substituting
ec 85(170) L 7100
= = 0:7166 = = 25:0
r 2
(142)2 2r 2(142)
max 120 106 3
= = 1:6901 10
E 71 109
and using the notation u = =E, the secant formula is
p 3
f (u) = u 1 + 0:7166 sec 25 u 1:6901 10
0.02
y
0.01
0.00
0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.010
x
-0.01
-0.02
The plot of f (u) shows that the smallest root is in the interval (0:0004; 0:0012).
We used Ridder’s method to compute this root:
% problem4_1_17
func = inline(’u*(1 + 0.7166/cos(25*sqrt(u))) - 1.6901e-3’,’u’);
u = ridder(func, 0.0004, 0.0012)
>> u =
8.6032e-004
PROBLEM 17 109
Problem 18
0.0
0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
x
-0.5
-1.0
The plot of f (u) indicates that there are two roots. The smaller root, which is
in (0:4; 0:48), can be determined with the following program:
problem4_1_18
func = inline(’0.10487*(1 - 1/u^2) - u + 0.875’,’u’);
u = ridder(func, 0.4, 0.48)
>> u =
0.4412
h = 0:8263(0:6) = 0:4958 m J
Evidently the ‡uid ‡ow can exist in on of the two states under the given
conditions.
Problem 19
M0
v = u ln gt
M0 mt
_
We want the root of
1
f (t) = u ln gt vsound = 0
1 (m=M
_ 0 )t
where
m_ 13:3 103 1
= = 0:004 75 s
M0 2:8 106
Thus
1
f (t) = 2510 ln 9:81t 335
1 0:004 75t
300
y
200
100
0
10 20 30 40 50 60 70 80 90 100
x
-100
-200
-300
The plot of f (t) locates the root in (68 ; 76) s. The following program was used
for the computation of the root:
PROBLEM 19 111
% problem4_1_19
func = inline(’2510*log(1/(1 - 4.75e-3*t)) - 9.81*t - 335’,’t’);
t = ridder(func, 68, 76)
>> t =
70.8780
Problem 20
With = 0:3, 1 = 2=3 and the notation u = T2 =T1 , the equation becomes
ln u (1 1=u)
f (u) = 0:3 = 0
ln u + 1:5(1 1=u)
0.08
y
0.06
0.04
0.02
0.00
-0.02 3 4 5 6 7 8 9 10
x
-0.04
-0.06
-0.08
-0.10
-0.12
-0.14
-0.16
From the plot of f (u) we see that the root is in (5:2; 5:6). We found this root
with the following program:
% problem4_1_20
func = inline(’(log(u)-(1-1/u))/(log(u)+1.5*(1-1/u))-0.3’...
,’u’);
u = ridder(func,5.2,5.6)
>> u =
5.4125
G= RT ln (T =T0 )5=2
5
f (T ) = G + RT ln(T =T0 )
2
Substituting
5 5
R = (8:314 41) = 20:7860
2 2
we get
f (T ) = 105 + 20:7860T ln(T =4:444 18)
x
y 100 200 300 400 500 600 700 800 900 1000
0
-20000
-40000
-60000
-80000
-1e+5
The plot of f (T ) shows a root in (880; 920). Here is the program that computes
this root:
% problem4_1_21
func = inline(’-1.0e5 + 20.7860*T*log(T/4.44418)’,’T’);
T = ridder(func,880,920)
>> T =
904.9435
Problem 22
(3 2 )2
f( ) = 249:2
(1 )3
PROBLEM 21 113
y
400
200
0
0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0
x
-200
-400
The plot of f ( ) shows a root in (0:7; 0:9), which is computed with the program
% problem4_1_22
func = inline(’x*(3 - 2*x)^2/(1 - x)^3 - 249.2’,’x’);
xi = ridder(func,0.7,0.9)
>> xi =
0.8171
Problem 23
f1 (x; y) = (x 2)2 + y 2 4
f2 (x; y) = x2 + (y 3)2 4
3
2
x
2
The rough locations of the intersection points are (2; 2) and (0; 1). Letting
x = x1 and y = x2 , the following function de…ned the equations:
function y = p4_1_23(x)
Problem 24
Problem 25
tan x y = 1
cos x 3 sin y = 0
PROBLEM 24 115
It is not easy to search for the roots of simultaneous equations. Here we can
overcome the di¢ culty by solving the …rst equation for y and substituting
the result into the second equation. This gives us the single transcendental
equation
f (x) = cos x 3 sin(tan x 1) = 0
y
3
0
0.2 0.4 0.6 0.8 1.0 1.2 1.4
x
-1
-2
From the plot of f (x) we see that there are 5 roots in the interval (0; 1:5). The
…rst root is about x = 0:88; the other roots are closely spaced near the end
of the interval (the spacing of roots becomes in…nitesimal at x = =2). The
program listed below is based on rootsRidder in Problem 10. It searches for
the roots from x = 0:8 to 1:5 in increments of 0:025 (the increment has to be
small in order to catch all the roots).
% problem4_1_25
func = inline(’cos(x) - 3*sin(tan(x) - 1)’,’x’);
n = 5; a = 0.8; b = 1.5; dx = 0.025;
fprintf(’Roots:\n’)
while 1
[x1,x2] = rootsearch(func,a,b,dx);
if isnan(x1)
fprintf(’Done’); break
else
a = x2;
x = ridder(func,x1,x2);
if isnan(x); continue
else
y = tan(x) - 1;
fprintf(’%12.6f %12.6f\n’, x,y);
end
end
end
Problem 26
(x a)2 + (y b)2 R2 = 0
Substituting the coordinates of the given points into the above equation, we
get
(8:21 a)2 + b2 R2 = 0
(0:34 a)2 + (6:62 b)2 R2 = 0
(5:96 a)2 + ( 1:12 b)2 R2 = 0
By plotting the points, we can estimate the parameters of the circle. It appears
that reasonable starting values are a = 5, b = 3 and R = 5.
y
6
4
Center of circle
2
0 x
0 2 4 6 8
-2
The following function uses the notation a = x1 , b = x2 , R = x3 :
function y = p4_1_26(x)
% Equations used in Problem 26, Problem Set 4.1
y = [(8.21 - x(1))^2 + x(2)^2 - x(3)^2;
(0.34 - x(1))^2 + (6.62 - x(2))^2 - x(3)^2;
(5.96 - x(1))^2 + (-1.12 - x(2))^2 - x(3)^2];
>> newtonRaphson2(@p4_1_26,[5;3;5])
ans =
4.8301
3.9699
5.2138
PROBLEM 26 117
Problem 27
C
R=0
1 + e sin( + )
After substituting the three sets of given data, we obtain the simulataneous
equations
C
6870 = 0
1 + e sin( =6 + )
C
6728 = 0
1 + e sin( )
C
6615 = 0
1 + e sin( =6 + )
The starting value C = 6800 seems reasonable, but e and are not easy to
guess. The orbit has some eccentricity, so that e = 0:5 should not be out of
line (e = 0 will not work because it results in a singular Jacobian matrix). We
also used = 0, which was a pure guess.
The minimum value of R is
C
Rmin =
1+e
occuring at
sin( + ) = 1 =
2
function y = p4_1_27(x)
% Equations used in Problem 27, Problem Set 4.1
y = [x(1)/(1 + x(2)*sin(-pi/6 + x(3))) - 6870;
x(1)/(1 + x(2)*sin(x(3))) - 6728;
x(1)/(1 + x(2)*sin(pi/6 + x(3))) - 6615];
x = (v cos )t
1 2
y = gt + (v sin )t
2
dx dy
= v cos = gt + v sin
dt dt
dy gt + v sin
=
dx v cos
Letting denote the time of ‡ight, the speci…ed end conditions are
dy
x( ) = 300 m y( ) = 61 m = 1
dx
(v cos ) 300 = 0
1 2
g + (v sin ) 61 = 0
2
g + v sin
+1 = 0
v cos
To estimate the initial values of the unknowns, we guess = 10 s and = 45 .
Then the …rst of the above equations yields v = 300= ( cos ) 57 m/s.
The following program uses the notation = x1 , v = x2 and = x3 :
function y = p4_1_28(x)
% Equations used in Problem 27, Problem Set 4.1
y = [x(1)*x(2)*cos(x(3)) - 300;
x(1)*x(2)*sin(x(3)) - 9.81*x(1)^2/2 - 61;
(-9.81*x(1) + x(2)*sin(x(3)))/(x(2)*cos(x(3))) + 1];
PROBLEM 28 119
Problem 29
mm
180
y θ2
y
mm
m
200
0m
15
θ1 200 mm θ3
x x
(a) (b)
Here is the function that re…nes de…nes the equations, given that 3 = 75 =
5 =12 rad:
function y = p4_1_29(x)
% Equations used in Problem 29, Problem Set 4.1
y = [150*cos(x(1)) + 180*cos(x(2)) - 200*cos(5*pi/12) - 200;
150*sin(x(1)) + 180*sin(x(2)) - 200*sin(5*pi/12)];
>> newtonRaphson2(@p4_1_29,[pi/3;pi/9])
ans =
9.5960e-001
4.0148e-001
>> newtonRaphson2(@p4_1_29,[pi/9;pi/3])
ans =
3.4939e-001
9.0752e-001
function y = p4_1_30(x)
% Equations used in Prob. 30, Problem Set 4.1
y = [x(4)*(-tan(x(2)) + tan(x(1))) - 16;
x(4)*( tan(x(3)) + tan(x(2))) - 20;
-4*sin(x(1)) - 6*sin(x(2)) + 5*sin(x(3)) + 3;
4*cos(x(1)) + 6*cos(x(2)) + 5*cos(x(3)) - 12];
>> newtonRaphson2(@p4_1_30,[0.8;0.3;0.4;20])
ans =
0.9358
0.4334
0.5800
17.8884
PROBLEM 30 121
122 PROBLEM SET 4.1
PROBLEM SET 4.2
Problem 1
b 1 = a1 = 3
b2 = a2 + rb1 = 7 + ( 5)(3) = 8
b3 = a3 + rb2 = 36 + ( 5)( 8) = 4
) P2 = 3x2 8x + 4 J
Problem 2
b1 = a1 = 1
b2 = a2 + rb1 = 0 + 1(1) = 1
b3 = a3 + rb2 = 3 + 1(1) = 2
b4 = a4 + rb3 = 3 + 1( 2) = 1
) P3 = x 3 + x 2 2x + 1 J
Problem 3
b1 = a1 = 1
b2 = a2 + rb1 = 30 + 6(1) = 24
b3 = a3 + rb2 = 361 + 6( 24) = 217
b4 = a4 + rb3 = 2178 + 6(217) = 876
b5 = a5 + rb4 = 6588 + 6( 876) = 1332
b1 = a1 = 1
b2 = a2 + rb1 = 5 + (2i)(1) = 5 + 2i
b3 = a3 + rb2 = 2 + (2i)( 5 + 2i) = 6 10i
b4 = a4 + rb3 = 20 + (2i)( 6 10i) = 12i
Problem 5
b 1 = a1 = 3
b2 = a2 + rb1 = 19 + (3 2i)(3) = 10 6i
b3 = a3 + rb2 = 45 + (3 2i)( 10 6i) = 3 + 2i
Problem 6
b1 = a1 = 1
b2 = a2 + rb1 = 1:8 + ( 3:3)(1) = 1:5
b3 = a3 + rb2 = 9:01 + ( 3:3)( 1:5) = 4:06
b 1 = a1 = 1
b2 = a2 + rb1 = 6:64 + 0:64(1) = 6
b3 = a3 + rb2 = 16:84 + 0:64( 6:0) = 13
P2 (x) = x2 6x + 13
Problem 8
b 1 = a1 = 2
b2 = a2 + rb1 = 13 + (3 2i) (2) = 7 4i
b3 = a3 + rb2 = 32 + (3 2i) ( 7 4i) = 3 + 2i
Since complex roots come in conjugate pairs, we know that a zero of P2 (x) is
r = 3 + 2i J
b 1 = a1 = 2
b2 = a2 + rb1 = (7 + 4i) + (3 + 2i)(2) = 1
P1 (x) = 1 + 2x
PROBLEM 7 125
Problem 9
b1 = a1 = 1
b2 = a2 + rb1 = 3 + (1 + 3i)(1) = 2 + 3i
b3 = a3 + rb2 = 10 + (1 + 3i)( 2 + 3i) = 1 3i
b4 = a4 + rb3 = 6 + (1 + 3i)( 1 3i) = 2 6i
r=1 3i
b1 = a1 = 1
b2 = a2 + rb1 = ( 2 + 3i) + (1 3i)(1) = 1
b3 = a3 + rb2 = ( 1 3i) + (1 3i)( 1) = 2
P2 (x) = x2 x+ 2
Problem 10
Problem 12
Problem 13
PROBLEM 11 127
Problem 14
Problem 15
Note that the complex roots do not appear in conjugate pairs if the coe¢ cients
of the polynomial are not real.
Problem 16
2
c 3 k c k k
!4 + 2 ! + 3 !2 + !+ =0
m m mm m
1
With c=m = 12 s and k=m = 1500 s 2 , we get
0:0623 s 1 ; 24:03 s 1
and ( 11:38 s 1 ; 61:35 s 1 ) J
Problem 17
We could …nd the our roots of this equation with the function polyroots, but
this is unnecessary. Because the slope of the beam is zero at supports, we know
that two of the roots are = 0 and = 1. Factoring out these roots, we have
2
P4 ( ) = ( 1)(b1 + b2 + b3 )
b 1 = a1 = 5
b2 = a2 + rb1 = 0 + 1(5) = 5
b3 = a3 + rb2 = 9 + 1(5) = 4
We have now reduced the problem to …nding the roots of the quadratic equation
2
5 +5 4=0
PROBLEM 17 129