Chapter 3| three.two 3.v iii.6 3.eleven

Chapter 4| 4.3 4.5 iv.8 4.12 iv.17 4.18

Trouble 3.2

Convert the following base-8 numbers to base ten: 71,563 and 3.fourteen

Answer

%iii.ii base of operations 8 or octal   %a) 71563  7*viii^four+one*viii^iii+5*8^2+6*8^1+3*8^0  %OR  ten =  base2dec('71563', 8)  %b) iii.xiv  3*8^0+one*8^-1+4*viii^-ii            

71563base 8 =   29555

iii.fourteenbase 8 = 3.1875

Trouble 3.5

The infinite series

converges on a value of f (n) = πfour/ninety as northward approaches infinity. Write a program in single precision to calculate f (n) for due north = 10,000 by calculating the sum from i = 1 to 10,000. So
repeat the calculation simply in contrary guild—that is, from i = ten,000 to ane using increments of −i. In each case, compute the true percent relative error. Explain the results.

Reply

n = 10000 i = (1:northward); f_n_big2small = sum (ane./i.^iv)  i = (n:-1:one);  f_n_small2big = sum (ane./i.^four)  f_true = pi^4/90  f_n_big2small = (f_true-f_n_big2small)/f_true   %error going from big to minor f_n_small2big = (f_true-f_n_small2big)/f_true   %error going from small to big            

f_n_big2small = 1.0823

f_n_small2big = one.0823

f_true = one.0823

f_n_big2small = 2.5583e-13

f_n_small2big = three.0773e-13

Problem iii.6

Evaluate e−5 using 2 approaches

and compare with the truthful value of six.737947 × 10−3. Use 20 terms to evaluate each series and compute true and approximate relative errors as terms are added.

%Trouble iii.6 northward = (0:19) %fix to evaluate 20 terms x = five; %Setting the exponent of east to v s = (-1).^n; %used to alternate signs in terms xn = x.^n; e_1 = cumsum(due south.*xn./factorial(due north)) e_2 = 1../(cumsum(xn./factorial(n)))  m = 1:.001:10; tv = 6.737947 * 10^-3; %our truthful value agree on plot(e_1); plot(e_2, 'r'); plot(m, tv); hold off title('Taylor Series Graphs')            

Problem iii.xi

Employ 5-digit arithmetics with chopping to determine the roots of the post-obit equation with Eqs. (iii.12) and (3.13)

three.12

3.13

xii − 5000.002x + x
Compute percent relative errors for your results.

Answer

%Problem 3.11 %x2 − 5000.002x + 10  a = chop(i,5); b = chop(-5000.002,5); c = chop(10,5);  %Equation 3.12 x1 = chop((-b+sqrt(b^2-4*a*c))/(ii*a), 5) x2 = chop((-b-sqrt(b^2-iv*a*c))/(2*a), 5)  %Equation 3.thirteen y1 = chop((-2*c)/(b+sqrt(b^2-4*a*c)), 5) y2 = chop((-2*c)/(b-sqrt(b^ii-4*a*c)), 5)  %Percent error p_x1 = ((5000 - x1)/5000) * 100 p_x2 = ((.002 - x1)/.002) * 100 p_y1 = ((5000 - y1)/5000) * 100 p_y2 = ((.002 - y1)/.002) * 100            

x1 = 5000
x2 = 0.0020
y1 = 5000
y2 = 0.0020
p_x1 = 0
p_x2 = -ii.5000e+08
p_y1 = 0
p_y2 = -2.5000e+08

Problem 4.3

The following infinite series can be used to approximate ex :

(a) Prove that this Maclaurin series expansion is a special case of the Taylor series expansion [(Eq. (iv.7)] with xi = 0 and h = x.
(b) Use the Taylor series to judge f (ten) = eastward−x at xi+ane = 1 for xi = 0.2. Employ the nil-, first-, 2d-, and third-order versions and compute the |εt | for each case.

Answer

%Trouble 4.3  a = .2;  x = -5:.01:5;  f_0 =@(a) exp(-a); f_1 =@(a) -exp(-a); f_2 =@(a) exp(-a); f_3 =@(a) -exp(-a);  T_0 = f_0(a) * ten.^0; T_1 = T_0 + f_1(a) + (x - a); T_2 = T_1 + ((f_2(a))/factorial(2)) * (x - a).^2; T_3 = T_2 + ((f_3(a))/factorial(iii)) * (x - a).^3;  hold on plot(x,f_0(x)) plot(10,T_0) plot(x,T_1,'b') plot(10,T_2,'g') plot(x,T_3,'r') title('Taylor Series Estimates')            

Problem 4.5

Employ zero- through third-social club Taylor series expansions to predict f (3) for
f (x) = 25x3 − 6xii + 7x − 88
using a base point at 10 = 1. Compute the true per centum relative error εt for each approximation.

Answer

%Problem 4.5 f = @(ten) x*x;  x = 0:.01:3.5;  f_x = @(ten) 25*x.^3-half-dozen*x.^ii+vii*10-88; f1_x = @(x) 3*25*10.^two-2*half-dozen*x+7; f2_x = @(x) 2*iii*25*x-2*6; f3_x = @(x) ii*3*25;  T_0 = f_x(one) * x.^0 T_1 = T_0 + f1_x(i) * (ten-i).^1 T_2 = T_1 + f2_x(1) * (x-1).^2/2 T_3 = T_2 + f3_x(one) * (x-1).^three/6  concord on; plot(x,f_x(x)) plot(x,T_0, 'c') plot(x,T_1, 'g') plot(ten,T_2, 'b') plot(10,T_3, 'thousand') hold off  title('Taylor Series Expansions')            

Problem 4.8

The Stefan-Boltzmann law can exist employed to estimate the rate of radiation of free energy H from a surface, as in
H = AeσT4
where H is in watts, A = the surface expanse (mii), e = the emissivity that characterizes the emitting backdrop of the surface (dimensionless), σ = a universal constant called the Stefan-Boltzmann constant (= five.67 × 10−8 Wm−2 K−iv), and T = absolute temperature (K). Determine the error of H for a steel plate with A = 0.15m2, e = 0.xc, and T = 650 ± xx. Compare your results with the exact error. Repeat the computation but with T = 650 ± forty. Translate your results.

%Problem 4.8  sigma = 5.67e-8 A = 0.fifteen e = 0.ix T = 650 +(-20:20) %T = 650 +(-xl:40) figure(1) H = @(T) A*e*sigma*T.^iv;  concur on  plot(T,H(T),'c')  H_dT = @(T) A*eastward*sigma*iv * T.^3;  df_x = abs(H_dT(T)) .* (T - 650)  plot(T,df_x, 'r')            

Here is the work on this problem from grade that I could not become to work.

                sigma = 5.67e-viii A = 0.15 e = 0.ix T = 650 +(-20:20) figure(1) H = @(T) A*e*sigma*T.^iv; hold on plot(T,H(T),'c')  H_dT = @(T) A*e*sigma*4 * T.^three;  %formula 4.25 deltaf_xt = @(xt,deltaT) H_dT(xt) *deltaT  deltaT = 20; xt1 = 650-deltaT; error1 = deltaf_xt(xt1, deltaT);  xt2 = 650+deltaT; error2 = deltaf_xt(xt2, deltaT);  hold on plot(xt1,error1 + H(xt1), '*r') plot(xt2,error2 + H(xt2), '*r')  figure(2) T = 650 +(-xl:40) H = @(T) A*east*sigma*T.^4; H_dT = @(T) A*e*sigma*4 * T.^3;  %formula 4.25 deltaf_xt = @(xt,deltaT) H_dT(xt) *deltaT  deltaT = forty; xt1 = 650-deltaT; error1 = deltaf_xt(xt1, deltaT);  xt2 = 650+deltaT; error2 = deltaf_xt(xt2, deltaT);  plot(xt1,error1 + H(xt1), '*m') plot(xt2,error2 + H(xt2), '*m') plot(T, H(T), 'thousand') hold off            


Problem four.12

Evaluate and interpret the condition numbers for

%Problem 4.12  e = exp(1) %A - f(x) = sqrt(abs(10-1)) + 1 x1 = -2:.001:2; f1 = sqrt(abs(x1-1)) + 1; d_f1 = (-i+x1)/(ii.*((-1+x1).^2).^(3/iv)); cn1 = x1.*d_f1./f1; hold on %plot(x1,f1) %plot(x1,cn1, 'r') hold off  %B - f(x) = east^-ten x2 = -10:1:10; f2 = e.^-x2; d_f2 = -e.^-x2; cn2 = x2.*d_f2./f2;  concur on %plot(x2,f2) %plot(x2,cn2, 'r') concur off  %C - f(x) = sqrt(x^2+1) x3 = 0:ten:300; f3 = sqrt(x3.^2+1) - x3; d_f3 = -i+x3./sqrt(1+x3.^2); cn3 = x3.*d_f3./f3  agree on %plot(x3,f3) %plot(x3,cn3, 'r') agree off  %D - f(x) = (e^-x - ane)/x x4 = -.5:0.001:.05; f4 = (e.^-x4-i)./x4; d_f4 = -eastward.^(-ane-x4); cn4 = x4.*d_f4./f4;  concord on %plot(x4,f4) %plot(x4,cn4, 'r') hold off  %Eastward - f(x) = sin(x)/1+cos(ten) x5 = -1*pi:.0001*pi:2*pi; f5 = sin(x5)./(1+cos(x5)); d_f5 = 1./(ane+cos(x5)); cn5 = x5.*d_f5./f5;  hold on plot(x5,f5) plot(x5,cn5, 'r') hold off            





Problem 4.17

A missile leaves the ground with an initial velocity v0; forming an bending φ0 with the vertical every bit shown in Fig. P4.17.

The maximum desired distance is αR where R is the radius of the world.
The laws of mechanics can be used to evidence that where ve = the escape velocity of the missile. It is desired to fire the missile and achieve the blueprint maximum altitude inside an accuracy of ±2%. Decide the range of values for φ0 if ve/50 = 2 and α = 0.25.

                %Problem 4.17 %knowns v_e_2_v0 = two authentic = .02 %+/- 2 percentage alpha = (0.25 - 0.02 * 0.25:0.001:0.25+0.02*.25) % alpha_R is the desired distance  sin_theta_alpha = @(alpha) ... (one+alpha).*sqrt(1-alpha ./(1+alpha)*v_e_2_v0^2); agree off plot(alpha,sin_theta_alpha(alpha)) hold on plot(blastoff,asin(sin_theta_alpha(blastoff)), 'r')            

alpha = 0.2450 0.2460 0.2470 0.2480 0.2490 0.2500 0.2510 0.2520 0.2530 0.2540 0.2550

Problem 4.18

To calculate a planet's space coordinates, nosotros have to solve the office
f (ten) = x − 1 − 0.5 sin 10
Let the base point be a = 10i = π/ii on the interval [0, π]. Make up one's mind the highest-gild Taylor series expansion resulting in a maximum error of 0.015 on the specified interval. The mistake is equal to the accented value of the difference between the given function and the specific Taylor series expansion. (Hint: Solve graphically.)

%Trouble iv.18 f_x = @(x) x-1-0.5*sin(x) f1_x = @(x) i-0.five*cos(x) f2_x = @(x) 0.5*sin(ten) f3_x = @(x) 0.5*cos(x) f4_x = @(x) -0.5*sin(x) f5_x = @(x) -0.5*cos(x) f6_x = @(x) 0.v*sin(x)  a = pi/2 x = (0:0.01:pi); concur off plot(x,f_x(10))  T_0_a = @(ten) f_x(a) * (x-a).^0/factorial(0); T_1_a = @(10) T_0_a + f1_x(a) * (x-a).^1/factorial(1); T_2_a = @(10) T_1_a + f2_x(a) * (x-a).^two/factorial(2); T_3_a = @(x) T_2_a + f3_x(a) * (10-a).^3/factorial(three); T_4_a = @(x) T_3_a + f4_x(a) * (x-a).^4/factorial(4); T_5_a = @(ten) T_4_a + f5_x(a) * (x-a).^5/factorial(5); T_6_a = @(10) T_5_a + f6_x(a) * (x-a).^vi/factorial(6);  error = abs(f_x(x) - T_6_a(10)) plot(10,error, 'r')