30.01.2015 Views

Test #1 Solutions - The George W. Woodruff School of Mechanical ...

Test #1 Solutions - The George W. Woodruff School of Mechanical ...

Test #1 Solutions - The George W. Woodruff School of Mechanical ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>George</strong> W. <strong>Woodruff</strong> <strong>School</strong> <strong>of</strong> <strong>Mechanical</strong> Engineering<br />

Georgia Institute <strong>of</strong> Technology<br />

ME2016A <strong>Test</strong> <strong>#1</strong> <strong>Solutions</strong><br />

Summer 2007<br />

NAME __________Key________________<br />

______________________________________________________________________________<br />

Problem 1 2 3 4 Total<br />

Points /15 /15 /15 /15 /60<br />

Please read this first:<br />

1. <strong>The</strong> test is closed-book but you are allowed one 8 1 ×<br />

2 11 sheet <strong>of</strong> notes.<br />

2. <strong>The</strong>re are four (4) problems in this test. Read all <strong>of</strong> the problems carefully and start from the<br />

one that is easiest for you.<br />

3. Budget your time -- total exam time is 1 hour and 45 minutes.<br />

4. Make sure you have a clear presentation for the solutions. No answer without justification is<br />

accepted.<br />

5. Sign the pledge <strong>of</strong> honor below -- any act <strong>of</strong> academic dishonesty may result in your failing<br />

the course.<br />

6. Do not forget to write down your NAME.<br />

I pledge on my honor that the work presented in this test is entirely my own; I have neither<br />

given nor received any inappropriate aid in preparation <strong>of</strong> this test.<br />

Signature ________________________________<br />

STOP HERE<br />

Do not turn the page until further instructions


-2-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

Problem 1: A computer stores floating point numbers using 12-bit binary (b=2) words. Of the 10<br />

bits, the first 2 bits are used for the signs <strong>of</strong> the exponent and mantissa, the next 4 bits are used for<br />

the exponent, and the last 6 bits are used for the mantissa as shown below.<br />

s 1 s 2 e 1 e 2 e 3 e 4 d 1 d 2 d 3 d 4 d 5 d 6<br />

a) Convert the following binary floating point number to decimal for all possible values <strong>of</strong> a: (5)<br />

0 1 0 0 1 0 a 0 0 a 0 0<br />

fp number=(ax2 -1 +ax2 -3 )x2 -2<br />

But since a cannot be zero (the 1 st digit <strong>of</strong> the mantissa) it has to be 1. Thus<br />

fp number=(2 -1 +2 -3 )x2 -2 =0.140625<br />

b) What is the largest number (in binary & decimal) that can be stored(4)<br />

binary: 0 0 1 1 1 1 1 1 1 1 1 1<br />

decimal: (0.111111) 2 x2 e , e=(1111) 2 =2 4 -1=15<br />

Largest Number=(1-2 -6 )x2 15 =2 15 -2 9 =32256<br />

c) Fill-in the blanks: Machine epsilon is the largest ___normalized_____round-<strong>of</strong>f error and for<br />

this computer it is equal to 2 -(6-1) =0.03125. (3)<br />

d)What is the final value <strong>of</strong> E in the following script if it is run on this computer (3 pts)<br />

E=1;<br />

while (E+4>4)<br />

E=E/2;<br />

end<br />

E=2*E;<br />

E=4*machine-epsilon=0.125


′′′<br />

-3-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

Problem 2: <strong>The</strong> n-th order Taylor series expansion <strong>of</strong> a function f(x) about x i =1 is given by<br />

2 3<br />

n<br />

h h<br />

n h<br />

f ( xi+ 1)<br />

= 1−<br />

h + − + L + ( −1)<br />

+ Rn<br />

2 3<br />

n<br />

n+<br />

1<br />

h<br />

where h=x i+1 -x i is the step-size and the remainder term satisfies Rn ≤ .<br />

n + 1<br />

a) What are the values <strong>of</strong> the function and its first three derivatives at x i (4)<br />

f ( x ) ______1_____, ′(<br />

) _____ 1______, ′′<br />

i<br />

= f xi<br />

= − f ( xi<br />

) = ____1____, f ( xi<br />

) = _____ − 2 _____<br />

General 3 rd Taylor Series:<br />

2<br />

3<br />

h h<br />

f<br />

3(<br />

xi+ 1)<br />

= f ( xi<br />

) + f ′(<br />

xi<br />

) h + f ′′(<br />

xi<br />

) + f ′′′<br />

( xi<br />

)<br />

123 123 123 2 14243 3!<br />

1<br />

−1<br />

1<br />

3<br />

−h<br />

/ 3<br />

b) Approximate f(1.5) based on the third (3 rd ) order Taylor series expansion <strong>of</strong> f . Estimate the<br />

corresponding approximation error (due to truncating the series) (6)<br />

h=1.5-1=0.5.<br />

2 3<br />

0.5 0.5<br />

f<br />

3(1.5)<br />

= 1−<br />

0.5 + − ⇒ f<br />

3<br />

(1.5) = 0. 58333<br />

2 3<br />

n+<br />

1 4<br />

h 0.5<br />

Max Error = Rn ≤ = ⇒ Max Error = 0. 015625<br />

n + 1 4


-4-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

c) Write a Matlab function TSA(h,emax) that computes the above Taylor series such that the<br />

resulting approximation error (due to truncating the series) is guaranteed to be less than emax<br />

in absolute value.(5)<br />

function y=TSA(h,emax)<br />

y=1;<br />

er=emax+1;<br />

n=1;<br />

hn=-h;<br />

while(er>emax)<br />

y=y+hn/n;<br />

hn=-hn*h;<br />

er=abs(hn/n);<br />

n=n+1;<br />

end


-5-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

Problem 3: We wish to find the root <strong>of</strong> f(x)=4e -x –x+0.2x 2 =0 <strong>of</strong> between 0 and 3 shown below:<br />

4<br />

3<br />

2<br />

f(x)<br />

1<br />

0<br />

x<br />

-1<br />

-2<br />

0 0.5 1 1.5 2 2.5 3<br />

x<br />

a) Use three (3) steps <strong>of</strong> the bisection algorithm to estimate the root <strong>of</strong> f(x)=0.<br />

Approximately how many steps are needed to estimate the root to within 10 -6 <strong>of</strong> the<br />

exact root (5 pts)<br />

Step1: xr=(xl+xu)/2=1.5, f(xr)0⇒xl=xr=0.75<br />

Step3: xr=(xl+xu)/2=1.125<br />

Error≤3(1/2) n =10 -6 ⇒log3-nlog(2)=-6⇒n=22


-6-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

b) Use two (2) iterations <strong>of</strong> the Newton-Raphson method to find the root <strong>of</strong> f(x)=0<br />

starting with the initial guesses <strong>of</strong> 0. Illustrate the procedure graphically. (7 pts.)<br />

[Note: de -x /dx=-e -x ]<br />

i x i f(x i ) f’(x i ) x i+1<br />

0 0 4 -5 0.8<br />

1 0.8 1.1253 -2.4773 1.2542<br />

2 1.2542 0.2015 -1.6395 1.3772<br />

Newton iterations:<br />

x i+1 =x i -f(x i )/f’(x i )=x i -[(4e -x –x+0.2x 2 )/(0.4x-1-4e -x )], i=0,1,2,...<br />

c) For what initial guesses does the Newton-Raphson have possible convergence problems<br />

Explain what happens if you start from there graphically. (3 pts.)<br />

For values <strong>of</strong> x 0 near 3, where f’(x 0 ) is near zero the NR algorithm may diverge


-7-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

Problem 4: Consider the system <strong>of</strong> linear equations Ax=b with<br />

⎡−1<br />

2 0⎤<br />

A =<br />

⎢ ⎥<br />

⎢<br />

a − a 1<br />

⎥<br />

⎢⎣<br />

0 a 2⎥⎦<br />

where a is a nonzero constant.<br />

⎡0⎤<br />

⎥<br />

a) Find x for and b =<br />

⎢<br />

⎢<br />

1 using Gauss elimination method. You are not required to do any<br />

⎥<br />

⎢⎣<br />

2⎥⎦<br />

pivoting if not necessary. (5 pts.)<br />

⎡−1<br />

2 0 0⎤<br />

⎡−1<br />

2 0 0⎤<br />

⎡−1<br />

2<br />

U :<br />

⎢<br />

⎥<br />

→<br />

⎢<br />

⎥<br />

→<br />

⎢<br />

⎢<br />

a − a 1 1<br />

⎥ ⎢<br />

0 a 1 1<br />

⎥ ⎢<br />

0 a<br />

⎢⎣<br />

0 a 2 2⎥⎦<br />

⎢⎣<br />

0 a 2 2⎥⎦<br />

⎢⎣<br />

0 0<br />

x 3 =1<br />

ax 2 +x 3 =1⇒x 2 =0<br />

-x 1 +2x 2 =0⇒x 1 =0<br />

0<br />

1<br />

1<br />

0⎤<br />

1<br />

⎥<br />

⎥<br />

1⎥⎦


-8-<br />

ME2016 Quiz <strong>#1</strong><br />

NAME _____________________________<br />

______________________________________________________________________________<br />

b) Find the LU-decomposition <strong>of</strong> matrix A. You are not required to do any pivoting if not<br />

necessary. (5 pts.)<br />

⎡−1<br />

2 0⎤<br />

⎡−1<br />

U :<br />

⎢ ⎥ ⎢<br />

⎢<br />

a − a 1<br />

⎥<br />

→<br />

⎢<br />

0<br />

⎢⎣<br />

0 a 2⎥⎦<br />

⎢⎣<br />

0<br />

⎡1<br />

0 0⎤<br />

⎡ 1 0<br />

L :<br />

⎢ ⎥<br />

→<br />

⎢<br />

⎢<br />

0 1 0<br />

⎥ ⎢<br />

− a 1<br />

⎢⎣<br />

0 1⎥⎦<br />

⎢⎣<br />

0<br />

2 0⎤<br />

⎡1<br />

a 1<br />

⎥ ⎢<br />

⎥<br />

→<br />

⎢<br />

0<br />

a 2⎥⎦<br />

⎢⎣<br />

0<br />

0⎤<br />

⎡ 1<br />

0<br />

⎥<br />

→<br />

⎢<br />

⎥ ⎢<br />

− a<br />

1⎥⎦<br />

⎢⎣<br />

0<br />

1 0⎤<br />

a 1<br />

⎥<br />

⎥<br />

0 1⎥⎦<br />

0 0⎤<br />

1 0<br />

⎥<br />

⎥<br />

1 1⎥⎦<br />

c) Let A=LU be the LU-decomposition <strong>of</strong> matrix A in (b) and suppose that after performing<br />

⎡1⎤<br />

⎥<br />

forward substitution we get y = Ux =<br />

⎢<br />

⎢<br />

0 . Find the corresponding x and b. (4 pts.)<br />

⎥<br />

⎢⎣<br />

0⎥⎦<br />

⎡1<br />

1 0⎤⎡x1<br />

⎤ ⎡1⎤<br />

Ux=<br />

⎢ ⎥⎢<br />

⎥ ⎢ ⎥<br />

⎢<br />

0 a 1<br />

⎥⎢<br />

x2⎥<br />

=<br />

⎢<br />

0<br />

⎥<br />

⇒ x3<br />

= 0, x<br />

⎢⎣<br />

0 0 1⎥⎦<br />

⎢⎣<br />

x ⎥⎦<br />

⎢⎣<br />

⎥<br />

3<br />

0⎦<br />

⎡ 1 0 0⎤⎡1⎤<br />

⎡ 1 ⎤<br />

Lx=<br />

b ⇒b<br />

=<br />

⎢ ⎥⎢<br />

⎥<br />

=<br />

⎢ ⎥<br />

⎢<br />

−a<br />

1 0<br />

⎥⎢<br />

0<br />

⎥ ⎢<br />

−a<br />

⎥<br />

⎢⎣<br />

0 1 1⎥⎦<br />

⎢⎣<br />

0⎥⎦<br />

⎢⎣<br />

0 ⎥⎦<br />

2<br />

= 0, x<br />

1<br />

= 1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!