Fall2011-HW2-soln

# Fall2011-HW2-soln - [4 , 6] . Table: Approximation p n and...

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

Homework 2 Solutions Math 371, Fall 2011 Page numbers in the International Edition are +12. Here is an example of two MATLAB scripts which, together, allow you to pass a pass a function into your code. This allows you to reuse your code for other functions. Program 1 function p=myfun(x), p=1/x-cos(x); return Program 2 function p=bisection(myfun, a, b, nmax), for n = 1 : nmax, p(n) = (a+b)/2; if(feval(myfun,p(n))*feval(myfun,a) < 0 ), b=p(n); else a=p(n); end end 1. (Rootﬁnding and Optimization) (a) Suppose f ( x ) is diﬀerentiable on [ a,b ] . Discuss how you might use a rootﬁnding method to identify a local extremum of f ( x ) inside [ a,b ]. Roots of the derivative give possible locations of local extrema. (b) Let f ( x ) = log x - sin x . Prove that f ( x ) has a unique maximum in the interval [4 , 6] . (Note that log means natural logarithm.) f Í (4) > 0, f Í (6) < 0, and the continuity of f Í ( x ) give the existence of at least one maximum. f Í ( x ) < 0 for x [4 , 6] shows the maximum is unique. (c) Approximate this local maximum using six iterations of the Bisection method with starting interval

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.

Unformatted text preview: [4 , 6] . Table: Approximation p n and absolute error | p n-p | versus iteration number n in Bisection method 1 n p n | p n-p | 5.0000000 0.0828141 1 4.5000000 0.4171859 2 4.7500000 0.1671859 3 4.8750000 0.0421859 4 4.9375000 0.0203141 5 4.9062500 0.0109359 6 4.9218750 0.0046891 2. (Order of Convergence) Apply the theorems on pp. 90-91 to the following problems: (a) Section 2.3 #8 g ( √ a ) = √ a . The conditions of the theorem on page 91 hold. g Í ( √ a ) = 0 but g Í ( √ a ) Ó = 0, so α = 2 and the asymptotic error constant is 1 / 2 √ a . (b) Section 2.3 #9 g ( √ a ) = √ a . The conditions of the theorem on page 91 hold. g Í ( √ a ) = g Í ( √ a ) = 0, but g Í ( √ a ) Ó = 0. Thus α = 3 and the asymptotic error constant is 1 / 4 a . 2...
View Full Document

## This note was uploaded on 12/16/2011 for the course MATH 371 taught by Professor Krasny during the Fall '08 term at University of Michigan.

### Page1 / 2

Fall2011-HW2-soln - [4 , 6] . Table: Approximation p n and...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online