Itro to Scietific Computig: Solutios Dr. David M. Goulet. How may steps does it take to separate 3 objects ito groups of 4? We start with 5 objects ad apply 3 steps of the algorithm to reduce the pile to groups of 5 3 = 4.. How may steps does it take to separate 3 objects ito groups of less tha 3? Note that 4 < 3 < 5, ad i 3 steps of the algorithm, a group of 4 wold be reduced to groups of 4 3 =. Therefor, usig the last problem, it requires 3 steps. 3. If your haystack is origially a meter cube, ad you ca t see the eedle util the stack is a cetimeter cube, how may steps will the bisectio method require? Note that m 3 is ( 3 cm 3, so we eed to split,, ito groups of to be sure that we ve foud the eedle. log 7 3.5. Therefor, we require 4 steps. 4. If you have a set of spheres, cubes ad pyramids each i three differet colors, how may steps of the algorithm will guaratee that they are sorted ito groups of the same geometry ad color? So split the colors ito distict groups you eed steps. Now that each group is of similar color, you eed more steps to separate each ito differet geometries. Aother way to see this is to ote that there will be 9 groups at the ed, so it will require 4 steps because 3 < 9 < 4. 5. A kig is placed somewhere o a chess board but you are ot allowed to look at the board. You are allowed to pick a vertex ad this vertex is defied as the origi of a coordiate system. You are the told which
quadrat the kig lies i. How may iteratios of this quadsectio method will guaratee that you fid the kig. There are 64 total squares. We are essetially beig asked to split these ito groups of. So it requires log 4 64 = 3 steps.. Use the theorem to show that f(x) = x has a root somewhere i the iterval [, 3]. f() = ad f(3) = 8. Use the theorem to show that f(x) = e x (x + ) cos(x) has a root somewhere i the iterval [, π/]. f() = ad f(π/) = e π/ >. 3. If a ruer fiishes a mile race i 6 miutes, was there a mile sectio that the ruer ra i exactly 6 miutes? Let the ruer s distace traveled by time t be give by f(t). Now, defie g(t) = f(t) f(t 6). Note that g() =. Suppose that g(t) < for all t. The = f(6) f() = f(6) f(54) + f(54) f(48) +... + f(6) f() = g(6) + g(54) +... + g(6) < This is a cotradictio. So there is at least oe value of t [, 6] so that g(t). Because g() =, the itermediate value theorem tells us that there is at least oe value of t so that g(t) =.. If f() = ad f(8) =, how may steps of the bisectio method will be required to fid a approximatio to the root of f(x) accurate to.5? The width of the iitial iterval is 8. After 4 steps, the iterval will have width 8 4 =.5. So, choosig our guess to be the midpoit of this iterval, the error ca be o more tha.5.. You ve built a machie that shoots darts at a target. By aimig it at a agle θ = π/3, your first dart lads cm above the ceter of the bulls eye. You adjust the agle to θ = π/4, ad your secod dart lads
cm below the ceter of the bulls eye. Ca the bisectio method be used to fid the correct agle? Ca we say with certaity how may steps will be required? Our rage is iitially uits wide ad our domai is iitially π/ uits wide. I theory, we could keep bisectig domais util we ve arrowed the rage to a uit space aroud the ceter of the target. If there were a liear relatioship betwee θ ad y, the height at which the dart strikes, the we could apply step of the bisectio method ad hit the target i the ceter, usig θ = (π/3 + π/4)/ = 7π/4. Placig the dart machie at the origi of a coordiate system, ad usig Newtoia physics (igorig frictio), gives a equatio for the height at which the dart strikes. y = d ta θ g d sec θ Here d is the x-distace of the target from the machie ad g is the acceleratio of gravity. So, there is a o-liear relatioship betwee the iput, θ, ad the output y. So we ca ot easily coclude how may steps will be required.. Approximate a root of the polyomial x 5 3x 4 6x 3 + 8x + 8x 4 with a accuracy of at least.. From this, guess what the exact value is ad the use this iformatio to factor the polyomial. The apply the algorithm agai to fid aother root. Ca you fid all five roots this way? (Note: I kow that there are other tricks for root fidig, do t use them.) The iteger roots of this equatio are {±, 3}. They should be easy with the bisectio method after plottig the fuctio. Usig polyomial or sythetic divisio, we fid x5 3x 4 6x 3 +8x +8x 4 = x. This (x )(x+)(x 3) is easy to factor.. Obviously f(x) = x 4 has a root at x =. Ca the bisectio method approximate this root? f(x) > for x, so the bisectio method is ot useful because we eed a iterval o which the fuctio chages sig. 3
3. The bisectio method does ot help whe searchig for the roots of f(x) = x +. Why? Ca you thik of a way to modify the bisectio method to fid roots of f(x)? The roots are ot real because x + for real x. Lettig x = ıy gives y which has real roots that ca be foud with the bisectio method.. Does this method appear to coverge for f(x) = x, x = 3, ad x =? Newto s method takes the form x + = x (x )(x x ). The plot x x idicates covergece. 3 x=±.95e 5.5.5.5 3 4 5 6 7 Figure : Newto s method for x.. Ca you thik of a way to apply these ideas to higher dimesioal problems? Apply your idea to fidig the root of f(x, y) = x + y. First pick two guesses, (x, y ) ad (x, y ). The create the lie x = (x x )t + x y = (y y )t + y z = (f(x, y ) f(x, y ))t + f(x, y ) 4
f(x This crosses the x y plae at t =,y ) f(x,y ) f(x,y. This motivates the ) umerical scheme x + = x f(x, y )(x x ) f(x, y ) f(x, y ) y + = y f(x, y )(y y ) f(x, y ) f(x, y ). Does this method appear to coverge for f(x) = x si x, x =, ad x =? The plot idicates covergece. x=.57±8.93e 5.5.5.5.5.5 4 6 8 4 6 Figure : Newto s method for x si x.. Does this method appear to coverge for f(x) = e x, x =, ad x =? What about x = ad x =? I both cases, the iterates do ot coverge.. How ca you combie these two ideas together with Newto s method to fid the correct value of ω? Solvig for ω i the secod equatio ad isertig this ito the first gives θ ds cos(s) cos(θ) τ g/l = 5
8 6 4 4 6 8 4 6 8 Figure 3: Newto s method for e x. Blue o s show the first iitial data iterates, red x s show the secod The left had side ca be defied as g(θ). If Newto s method solves g(θ) = the we use this value of θ to calculate. Give the plot of f(x) = x ω = (g/l)( cos θ) ds, do you thik Newto s cos(s) cos(x) method will coverge? It may help to kow that f( + ) = 49 6.756. From the plot, we see that if τ g/l < 49 6 the there is o solutio to the problem. Otherwise this looks like the problem of fidig whe a parabola-like thig itersects the x-axis, which our experiece tells us may be doable with Newto s method. Be wared that the way this is coded, you ca t choose values for x outside of (, π). Do you thik that this will matter whe usig Newto s method? If we choose some valid value for τ g/l ad pick our iitial guesses i the rage (, π), it appears from the graph that our subsequet guesses will stay i this domai. So it may ot be a problem. Below we show how this ituitio is validated for τ g/l = 3, x =, ad x =. 6
.4 x=.477±.38e 8..8.6.4. 3 4 5 6 7 Figure 4: Covergece of Newto s method for the pedulum problem. 7