{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Project 2 Solutions

# Project 2 Solutions - Project 2 1 > x=2 c=1 while x ~= Inf...

This preview shows pages 1–4. Sign up to view the full content.

Project 2 1. >> x=2; c=1; while x ~= Inf & c < 1500, x=2*x; c=c+1;end >> 2^c ans = Inf >> 2^(c-1) ans = 8.9885e+307 >> x=1/2; c=-1; while x ~= 0 & -1500 < c, x=x/2; c=c-1;end >> 2^c ans = 0 >> 2^(c+1) ans = 4.9407e-324 __________________________________________________________________________________________________ 2. come back later __________________________________________________________________________________________________ 3. (1) (2) >> x=1; fy=[]; while x <= 30, fy = [fy f(1/(2^x))]; x=x+1; end >> fy fy = Columns 1 through 7 0.4721 0.4924 0.4981 0.4995 0.4999 0.5000 0.5000 Columns 8 through 14 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 15 through 21 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 22 through 28 0.5000 0.5000 0.5000 0.5000 0 0 0

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Columns 29 through 30 0 0 (3) >> x=1; gy=[]; while x <= 30, gy = [gy g(1/(2^x))]; x=x+1; end >> gy gy = Columns 1 through 7 0.4721 0.4924 0.4981 0.4995 0.4999 0.5000 0.5000 Columns 8 through 14 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 15 through 21 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 22 through 28 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 0.5000 Columns 29 through 30 0.5000 0.5000 (4) Method Number 2 is more stable for computing this limit. (5) >> ulp=2^-53 ulp = 1.1102e-016 >> r=sqrt(ulp) r = 1.0537e-008 >> fy=f(r) fy = 0 >> gy=g(r) gy = 0.5000 __________________________________________________________________________________________________ 4. >> n=7
n = 7 >> A=ones(n)+eps*eye(n) A = 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 >> B=grmsch(A) B = 0.3780 -0.6667 -0.6667 -0.6667 -0.6667 -0.6667 -0.6667 0.3780 0 -0.0000 -0.0000 -0.0000 -0.0000 -0.0000 0.3780 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 0.3780 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 0.3780 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 0.3780 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 0.3780 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 -0.3333 >> B'*B ans = 1.0000 -0.8819 -0.8819 -0.8819 -0.8819 -0.8819 -0.8819 -0.8819 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 -0.8819 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 -0.8819 1.0000 1.0000 1.0000 1.0000 1.0000 1.0000 -0.8819

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}