Assigned: Thursday Aug. 29, 2013 Due: Tuesday Sept. 10, 2013 MATH 373: Homework 1 “Taylor Series, Convergence, & Round-Off Error” Fall 2013 NOTE: • Include a cover page. • Always clearly label all plots (title, x-label, y-label, and legend). • Use the subplot command from MATLAB when comparing 2 or more plots to make comparisons easier and to save paper. 1. Compute the first 5 terms in the Taylor series (constant, linear, quadratic, cubic, and quartic pieces) for the following functions: (a) f (x) = 3 tan(x), (b) f (x) = ecos(x) , about the point x = π/4 about the point x = 0 2. Using the results from Problem 1(b), make a single MATLAB plot which contains all of the following: (a) a graph of f (x) = ecos(x) versus x for x ∈ (−3, 3). (b) a graph of p2 (x). (c) a graph of p4 (x). (d) a title, x-axis label, y-axis label, and a legend. 3. The quotient g(x) = log(1 + xex ) x seems at first glance to be undefined at x = 0. Approximate log(1 + xex ) by a Taylor polynomial of degree 2 about the point x = 0. Use this Taylor approximation to determine a natural definition of g(0). 4. Consider the function g(x) = ex . (a) Derive the general nth order Taylor polynomial (pn (x)) as well the remainder term (Rn (x)) for the function g(x) expanded about the point x = 0. (b) Using the remainder term from part (b), determine the value of n needed to guarantee that |pn (1) − g(1)| < 10−5 . (c) Using the value of n found in part (b), compute the actual error |pn (1) − g(1)|. 5. Compute the following limits and determine the rates of convergence: 1 Assigned: Thursday Aug. 29, 2013 Due: Tuesday Sept. 10, 2013 (a) limh→0 (b) limh→0 h2 −h3 1+2h3 q 1 h +1− q 1 h (c) limh→0 h sin(h−1 ) (d) limh→0 3−h2 7+h+2h2 6. Determine which one of the following sequences converges to 1 faster (clearly explain your reasoning): sin(x2 ) x→0 x2 lim and (sin(x))2 . x→0 x2 lim 7. Consider the following: xn = 1 − cos π n yn = 2 sin2 π 2n NOTE: From trigonometry we know that xn = yn since sin2 (θ) = 1 2 (1 − cos(2θ)). (a) Subplot #1: Plot xn and yn versus n for n = 1, . . . , 1000 on a single log-log plot using the loglog command. Use a solid line for xn and open circles for yn . (b) Subplot #2: Plot the relative error |xn − yn |/|yn | on a log-log plot using the loglog command. (c) As n becomes large, which one (xn or yn ) is more accurate? Why? (HINT: recall the 2 situations that you want to avoid when doing computer arithmetic.) 8. (from [Greebaum & Chartier, 2012]). In the seventh season of the The Simpsons, Homer has a nightmare in which the following equation flies past him: 178212 + 184112 = 192212 . Note that this equation, if true, would contradict Fermat’s last theorem, which states: For n ≥ 3, there do not exist any natural numbers x, y, and z that satisfy xn + y n = z n . Did Homer dream up a counterexample to Fermat’s last theorem? √ (a) Compute 12 178212 + 184112 by typing the following into matlab: format short; (1782^12 + 1841^12)^(1/12) What result does matlab report? Now look at the answer using format long. (b) Determine the absolute and relative errors in the approximation 178212 + 184112 ≈ 192212 . Such an example is called a Fermat near miss. 2