<\body> Hi, I'm Andreas Kloeckner, your TA for this course. Feel free to come to my office hours <\quote-env> Tuesdays 2:30-4:30 in Room 004 in the Applied Math Castle at 182 George St. Go in by the main entrance, walk into the hallway behind the mailboxes. Turn left and go down the flight of steps. At the bottom, take a left and then a right. 004 should be straight ahead. (There's a sign on the door.) Every week, you may download solutions (including code) from <\quote-env> Feel free to email me at . The code for the sample solutions is written so that it will run in both Matlab and Octave. (I test it in both.) Octave is a language for scientific computing that is generally very similar to Matlab. Unlike Matlab, Octave is . You may grab a copy at . We are attempting to find > and > such that <\equation*> \|e\|\\\|e\|>. Taking the logarithm of this, we obtain <\equation> \||\>''>>\|\>''>>+|\>''>>\||\>''>> If we look closely, we can see that this reduces the problem to finding a line (given by slope and -intercept ). We need to find two parameters, and since we have three data points for each method, we may write two equations of the form () to find them: <\eqnarray*> \|>||+\*log\|e\|,>>|\|>||+\*log\|e\|.>>>> Subtracting the two, we find <\equation*> \|-log\|e\||log\|e\|-log\|e\|>=\. Knowing >, we solve the first one for >: <\eqnarray*> >||\|-\*log\|e\|,>>|>||\|-\*log\|e\|).>>>> This yields: <\with|par-par-sep|0> From these calculations it seems the orders of convergence are roughly , 4 and 3, respectively. Here's some code to perform this computation: <\with|par-par-sep|0> Let <\equation*> f(x)\+3x*a|3x+a> and observe that )=>. Further, it is not hard to see that <\itemize> for (0,)>, we have x> and ,> for (,\)>, we have x> and >. Convergence of the sequence <\equation*> x\f(x) to > is thus established. Now consider <\eqnarray*> \||\|e\|>>||-x\||\|-x\|>=-+3xa|3x+a>|-x>=-+3xa|3x+a>|*(-x)>>>|||x+a-x-3xa|*(-x)(3x+a)>=-x)|*(-x)(3x+a)>>>|||+a>\=>>>> as \>. The asymptotic error constant is . a) |eps>|10cm|||||> Code: <\with|par-par-sep|0> b) Plot x> and note that it looks a bit like the above. Remember <\equation*> cos(\+\)=cos(\)cos(\)-sin(\)sin(\) or, for our case, <\equation> cos(2x)=cos x-sin x. Also remember <\equation> 1=cos x+sin x. Now compute )-():> <\equation*> 1-cos(2x)=2sin(x), which, after substituting =2x>, yields <\equation*> 1-cos(\)=2sin(\/2) and a much cleaner plot: a) <\equation*> g(x)-f(x)=x|1+sin x>-(1-sin x)=x-(1-sin x)(1+sin x)|1+sin x>=x-(1-sinx)|1+sin x>=0. In preparation for b) and c), we create this table: ||>|>|(x)>>>|/2>>||>|/2>>||>>>> b) Near /2>, 1>, so subtracts two values of order to obtain a result very close to zero, and so it will encounter significant cancellation error. The logical choice is (x)/(1+sin(x))>, for which we observe no such phenomena. c) Near /2>, -1>, so the denominator of (which is ) will encounter cancellation error. The length of the initial interval is . After each iteration, the length of the interval is halved, so we have 2> after the first, 2> after the second, >, 2> after the th. Once we know that the length of our candidate interval is shorter than >, our tolerance, i.e. <\equation*> \|b-a\|\2\\, we are done. We can now compute the number of iterations needed to achieve this precision: <\eqnarray*> 2>|>|>>|>>|>|>>|log >>|>|log 2>>|>|log 2>>|>|>>> a) +x-x-4>. Consider this function in two parts. <\eqnarray*> (x)>||>>|(x)>||+x+4=(x-1/2)-17/4>>|(x)>||(x)-f(x),>>>> so that the zeros we seek are the intersections of the graphs of > and >, as shown below: Using our knowledge of the behavior of the exponential function and of parabolas, it is not hard to see that there will be two zeros, one each in the intervals and . Bisection search results are listed at the end of the problem in one big batch. b) -x-10x+7>. Theory says that this polynomial cannot have more than three zeros. Plot it: It's not hard to see that we have three candidate intervals, , and . c) . Once again consider this function as composed of two parts: <\eqnarray*> (x)>||>|(x)>||>|||(x)-f(x).>>>> Again, we can view the sought zeros as intersections of the graphs of two well-understood functions: We are led to believe that we should look in and ]. Code: <\with|par-par-sep|0> Results: <\with|par-par-sep|0> <\initial> <\collection> <\references> <\collection> > > >