Solutions 2. January 23, x x

Similar documents
CHAPTER 2 POLYNOMIALS KEY POINTS

Two hours. To be provided by Examinations Office: Mathematical Formula Tables. THE UNIVERSITY OF MANCHESTER. 29 May :45 11:45

ECONOMICS 207 SPRING 2006 LABORATORY EXERCISE 5 KEY. 8 = 10(5x 2) = 9(3x + 8), x 50x 20 = 27x x = 92 x = 4. 8x 2 22x + 15 = 0 (2x 3)(4x 5) = 0

Exam 2. Average: 85.6 Median: 87.0 Maximum: Minimum: 55.0 Standard Deviation: Numerical Methods Fall 2011 Lecture 20

Chapter 2 notes from powerpoints

S56 (5.1) Polynomials.notebook August 25, 2016

Applied Numerical Analysis Homework #3

Integration - Past Edexcel Exam Questions

NUMERICAL METHODS. x n+1 = 2x n x 2 n. In particular: which of them gives faster convergence, and why? [Work to four decimal places.

i x i y i

, a 1. , a 2. ,..., a n

ADDITONAL MATHEMATICS

Edexcel GCE Further Pure Mathematics (FP1) Required Knowledge Information Sheet. Daniel Hammocks

MATH 1014 Tutorial Notes 8

(a) Write down the value of q and of r. (2) Write down the equation of the axis of symmetry. (1) (c) Find the value of p. (3) (Total 6 marks)

(0, 0), (1, ), (2, ), (3, ), (4, ), (5, ), (6, ).

5. Hand in the entire exam booklet and your computer score sheet.

Cubic Splines MATH 375. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Cubic Splines

Math Numerical Analysis Mid-Term Test Solutions

Higher Portfolio Quadratics and Polynomials

MA2501 Numerical Methods Spring 2015

Polynomial Functions

Interpolation and Approximation

MA 1128: Lecture 19 4/20/2018. Quadratic Formula Solving Equations with Graphs

Assessment Exemplars: Polynomials, Radical and Rational Functions & Equations

Chapter 4E - Combinations of Functions

5.1 Polynomial Functions

5.6 Logarithmic and Exponential Equations

Math /Foundations of Algebra/Fall 2017 Numbers at the Foundations: Real Numbers In calculus, the derivative of a function f(x) is defined

Ch 7 Summary - POLYNOMIAL FUNCTIONS

MS 2001: Test 1 B Solutions

Functions and Equations

Chapter 4: Interpolation and Approximation. October 28, 2005

CURVE FITTING LEAST SQUARE LINE. Consider the class of linear function of the form

Interpolation and the Lagrange Polynomial

Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

Complex Numbers: Definition: A complex number is a number of the form: z = a + bi where a, b are real numbers and i is a symbol with the property: i

Quadratic Formula: - another method for solving quadratic equations (ax 2 + bx + c = 0)

(2) Dividing both sides of the equation in (1) by the divisor, 3, gives: =

CS412: Introduction to Numerical Methods

Algebra III Chapter 2 Note Packet. Section 2.1: Polynomial Functions

Newton s Method and Linear Approximations

Foundations of Math II Unit 5: Solving Equations

3 What is the degree of the polynomial function that generates the data shown below?

A monomial or sum of monomials

Q 0 x if x 0 x x 1. S 1 x if x 1 x x 2. i 0,1,...,n 1, and L x L n 1 x if x n 1 x x n

Engg. Math. II (Unit-IV) Numerical Analysis

Scientific Computing

Core Mathematics 1 Quadratics

2.3. Polynomial Equations. How are roots, x-intercepts, and zeros related?

Neville s Method. MATH 375 Numerical Analysis. J. Robert Buchanan. Fall Department of Mathematics. J. Robert Buchanan Neville s Method

Empirical Models Interpolation Polynomial Models

Interpolation. s(s 1)(s 2) Δ 3 f ! s(s 1) Δ 2 f 0 + 2! f(x s )=f 0 + sδf 0 +

CURVE FITTING LEAST SQUARE LINE. Consider the class of linear function of the form. = Ax+ B...(1)

APPENDIX : PARTIAL FRACTIONS

A101 ASSESSMENT Quadratics, Discriminant, Inequalities 1

ADVANCED PROGRAMME MATHEMATICS: PAPER I MODULE 1: CALCULUS AND ALGEBRA

6A The language of polynomials. A Polynomial function follows the rule. Degree of a polynomial is the highest power of x with a non-zero coefficient.

5.3. Polynomials and Polynomial Functions

8.3 Numerical Quadrature, Continued

Polynomial Functions. x n 2 a n. x n a 1. f x = a o. x n 1 a 2. x 0, , a 1

4 Problem Set 4 Bifurcations

Math 1311 Section 5.5 Polynomials and Rational Functions

BSM510 Numerical Analysis

Order of convergence

Curve Fitting. Objectives

Newton s Method and Linear Approximations

3.1 Interpolation and the Lagrange Polynomial

Mathematical Olympiad Training Polynomials

Question 1: The graphs of y = p(x) are given in following figure, for some Polynomials p(x). Find the number of zeroes of p(x), in each case.

x x2 2 + x3 3 x4 3. Use the divided-difference method to find a polynomial of least degree that fits the values shown: (b)

SKILL BUILDER TEN. Graphs of Linear Equations with Two Variables. If x = 2 then y = = = 7 and (2, 7) is a solution.

Sect Polynomial and Rational Inequalities

MA2501 Numerical Methods Spring 2015

Integration of Rational Functions by Partial Fractions

MAC 2311 Calculus I Spring 2004

Newton's forward interpolation formula

Section 3.1 Quadratic Functions

LECTURE 16 GAUSS QUADRATURE In general for Newton-Cotes (equispaced interpolation points/ data points/ integration points/ nodes).

UNIT-II INTERPOLATION & APPROXIMATION

Downloaded from

Newton s Method and Linear Approximations 10/19/2011

Lecture Note 3: Polynomial Interpolation. Xiaoqun Zhang Shanghai Jiao Tong University

Book 4. June 2013 June 2014 June Name :

Integration of Rational Functions by Partial Fractions

Interpolation & Polynomial Approximation. Hermite Interpolation I

RF2 Unit Test # 2 Review Quadratics (Chapter 6) 1. What is the degree of a quadratic function?

Practice Test - Chapter 2

you expect to encounter difficulties when trying to solve A x = b? 4. A composite quadrature rule has error associated with it in the following form

Lectures 9-10: Polynomial and piecewise polynomial interpolation

Introduction Linear system Nonlinear equation Interpolation

Honors Advanced Algebra Unit 3: Polynomial Functions October 28, 2016 Task 10: Factors, Zeros, and Roots: Oh My!

Taylor Series and Numerical Approximations

Polynomial Form. Factored Form. Perfect Squares

Interpolation APPLIED PROBLEMS. Reading Between the Lines FLY ROCKET FLY, FLY ROCKET FLY WHAT IS INTERPOLATION? Figure Interpolation of discrete data.

A) (-1, -1, -2) B) No solution C) Infinite solutions D) (1, 1, 2) A) (6, 5, -3) B) No solution C) Infinite solutions D) (1, -3, -7)

Analysis Methods in Atmospheric and Oceanic Science

Polynomial Review Problems

PRINTABLE VERSION. Practice Final. Question 1. Find the coordinates of the y-intercept for 5x 9y + 6 = 0. 2 (0, ) 3 3 (0, ) 2 2 (0, ) 3 6 (0, ) 5

UNC Charlotte Super Competition Level 3 Test March 4, 2019 Test with Solutions for Sponsors

Transcription:

Solutions 2 January 23, 2016 1 Exercise 3.1.1 (a), p. 149 Let us compute Lagrange polynomials first for our case x 1 = 0, x 2 = 2, x 3 = 3: In [14]: from sympy import * init_printing(use_latex=true) x=symbols( x ) L1 = (x-2)*(x-3)/((0-2)*(0-3)) L2 = (x-0)*(x-3)/((2-0)*(2-3)) L3 = (x-0)*(x-2)/((3-0)*(3-2)) Now the interpolating polynomial for y 1 = 1, y 2 = 3, y 3 = 0: In [15]: p = 1*L1 + 3*L2 + 0*L3 expand(p) Out[15]: 4x2 3 + 11x 3 + 1 In [16]: from sympy.plotting import plot %matplotlib inline plot(p,(x,0,3),xlabel= x,ylabel= y,title= Intepolating polynomial for (0,1), (2,3), (3,0) ) 1

Out[16]: <sympy.plotting.plot.plot at 0x106013ef0> 2 Exercise 3.1.1 (b), p. 149 x 1 = 1, x 2 = 2, x 3 = 3, x 4 = 5: In [9]: L1 = (x-2)*(x-3)*(x-5)/((-1-2)*(-1-3)*(-1-5)) L2 = (x+1)*(x-3)*(x-5)/((2+1)*(2-3)*(2-5)) L3 = (x+1)*(x-2)*(x-5)/((3+1)*(3-2)*(3-5)) L4 = (x+1)*(x-2)*(x-3)/((5+1)*(5-2)*(5-3)) Now the interpolating polynomial for y 1 = 0, y 2 = 1, y 3 = 1, y 4 = 2: In [10]: p=0*l1 + 1*L2 + 1*L3 + 2*L4 expand(p) Out[10]: x 3 24 x2 4 + 11x 24 + 3 4 In [12]: plot(p,(x,-1,5),xlabel= x,ylabel= y,title= Intepolating polynomial for (-1,0), (2,1), (3,1), 2

Out[12]: <sympy.plotting.plot.plot at 0x10719c5f8> 3 Exercise 3.1.1 (c), p. 149 x 1 = 0, x 2 = 2, x 3 = 4: In [17]: L1 = (x-2)*(x-4)/((0-2)*(0-4)) L2 = (x-0)*(x-4)/((2-0)*(2-4)) L3 = (x-0)*(x-2)/((4-0)*(4-2)) Now the interpolating polynomial for y 1 = 2, y 2 = 1, y 3 = 4: In [18]: p=-2*l1 + 1*L2 + 4*L3 expand(p) Out[18]: 3x 2 2 In [19]: plot(p,(x,0,4),xlabel= x,ylabel= y,title= Intepolating polynomial for (0,-2), (2,1), (4,4) ) 3

Out[19]: <sympy.plotting.plot.plot at 0x1074cccc0> 4 Exercise 3.1.2 (a), p. 149 Let us compute Newton s divided differences in this case: f[x 1 ] = y 1 = 1 f[x 2 ] = y 2 = 3 f[x 3 ] = y 3 = 0 f[x 1, x 2 ] = f[x 2] f[x 1 ] x 2 x 1 = 3 1 2 0 = 1 f[x 2, x 3 ] = f[x 3] f[x 2 ] x 3 x 2 = 0 3 3 2 = 3 Therefore, the final polynomial is: f[x 1, x 2, x 3 ] = f[x 2, x 3 ] f[x 1, x 2 ] x 3 x 1 = 3 1 3 0 = 4 3 p(x) = f[x 1 ]+f[x 1, x 2 ](x x 1 )+f[x 1, x 2, x 3 ](x x 1 )(x x 2 ) = 1+1 (x 0) 4 3 (x 0)(x 2) = 1+x 4 3 x2 + 8 3 x = 4 3 x2 + 11 3 x+1 5 Exercise 3.1.2 (b), p. 149 f[x 1 ] = y 1 = 0 f[x 2 ] = y 2 = 1 f[x 3 ] = y 3 = 1 f[x 4 ] = y 4 = 2 f[x 1, x 2 ] = 1 0 2 + 1 = 1 3 f[x 2, x 3 ] = 1 1 3 2 = 0 f[x 3, x 4 ] = 2 1 5 3 = 1 2 f[x 2, x 3, x 4 ] = 1/2 0 f[x 1, x 2, x 3 ] = 0 1/3 3 + 1 = 1 12 Therefore, the interpolating polynomial is f[x 1, x 2, x 3, x 4 ] = 1/6 + 1/12 5 + 1 5 2 = 1 6 = 1 24 4

In [8]: expand(0+rational(1,3)*(x+1)-rational(1,12)*(x+1)*(x-2)+rational(1,24)*(x+1)*(x-2)*(x-3)) Out[8]: 6 Exercise 3.1.2 (c), p.149 x 3 24 x2 4 + 11x 24 + 3 4 f[x 1 ] = 2 f[x 2 ] = 1 f[x 3 ] = 4f[x 1, x 2 ] = 1 + 2 2 0 = 3 2 Threefore, the interpolating polynomial is f[x 2, x 3 ] = 4 1 4 2 = 3 2 f[x 3/2 3/2 1, x 2, x 3 ] = = 0 4 0 p(x) = f[x 1 ] + f[x 1, x 2 ](x x 1 ) + f[x 1, x 2, x 3 ](x x 1 )(x x 2 ) = 2 + 3 2 (x 0) = 3 2 x 2. 7 Exercise 3.1.11, p. 150 Let P 1,..., P 4 be four different points lying on a parabola y = ax 2 + bx + c. How many degree 3 polynomials pass through these four points? Solution There is a unique polynomial of degree 3 passing through four different points. Therefore this polynomial must be the given parabola. In other words, there are no cubic polynomials passing through these points, only a quadratic one. 8 Exercise 3.1.12, p. 150 Can a degree 3 polynomial intersect a degree 4 polynomial in exactly five points? Solution Again, owing to the uniqueness of the interpolation polynomial there is only one polynomial of degree 4 (that is, constant, linear, quadratic, cubic, or quartic) passing through five different points. Therefore it is impossible to both cubic and quartic polynomials to pass through some five points. (intersect at exactly five points). 9 Exercise 3.1.15, p. 150 Write a degree 25 polynomial that passes through the points (1, 1), (2, 2),..., (25, 25) and have a constant term equal to 25. Solution It is not difficult to see that a linear polynomial x passes through the given points (1, 1), (2, 2),..., (25, 25). We can then use Newton s form of the interpolation polynomial to add another point, namely x = 0, where the function should attain the value y = 25. Thus p(x) = x + f[1,..., 25, 0](x 1)(x 2)... (x 25) We can now use the condition p(0) = 25 to determine the constant f[1,..., 25, 0]. Substituting x = 0 into the formula for our polynomial gives 25 = p(0) = f[1,..., 25, 0]( 1) 25 25! = f[1,..., 25, 0]25!, and therefore the final formula is p(x) = x (x 1)(x 2)... (x 25)/24!. In [32]: from sympy.mpmath import * from sympy.plotting import plot %matplotlib inline p=-x-nprod(lambda k: (x-k),[1,25])/fac(24) plot(p,(x,0,25),xlabel= x,ylabel= y,title= Intepolating polynomial ) 5

Out[32]: <sympy.plotting.plot.plot at 0x107443160> 10 Exercise 3.2.2, p.156 (a) Given the data points (1, 0), (2, ln 2), (4, ln 4) find the degree 2 interpolating polynomial. Solution Newton s divided differences are: and therefore the interpolating polynomial is f[1] = 0 f[2] = ln 2 f[4] = ln 4 ln 4 ln 2 f[1, 2] = ln 2 f[2, 3] = 4 2 ln 2/2 ln 2 f[1, 2, 3] = 4 1 p(x) = 0 + ln 2(x 1) ln 2 (x 1)(x 2) = 6 (b) Use the result of (a) to approximate ln 3: Solution p(3) = 5 ln 2 1.1552 3 ln(3) 1.0986 = ln 2 2 = ln 2 6 [ 1 6 x2 + 3 2 x 4 ] ln 2. 3 (c) Use Theorem 3.3 to give an error bound for the approximation in part (b) Solution The error bound is ln 3 p(3) = ln (z) (3 1)(3 2)(3 4) 3! = 2 6z 3 2 1 1 = 2 3z 3, 6

for some z [1, 4]. The worst (largest) estimate is when z = 1 leading to (d) Compare with the actual error. Solution The actual error is ln 3 p(3) 2 3. ln(3) p(3) 0.0566 < 2 3 0.667. Thus we overestimate the error by a factor of almost 12. This is because we do not know the actual point on our interval, at which ln (z) should be evaluated. In [27]: f = log(x) p = (-Rational(1,6)*x**2+Rational(3,2)*x-Rational(4,3))*log(2) plot1 = plot(f,(x,1,5),line_color= r,show=false) plot2 = plot(p,(x,1,5),xlabel= x,ylabel= y,title= ln vs interpolating polynomial,line_color= plot2.extend(plot1) plot2.show() 11 Exercise 3.2.4, p.156 Consider the interpolating polynomial for f(x) = 1/(x+5) with interpolation nodes x = 0, 2, 4, 6, 8, 10. Find an upper bound for the interpolation error at (a) x = 1 and (b) x = 5. Solution The upper bound on the interpolation error is given by Theorem 3.3: f(x) p(x) = f (6) (z) (x x 1 )... (x x 6 ) 6!, 7

for some z [0, 10]. f (6) (z) = 6!/(z + 5) 7 with the largest (pessimistic) value occurring at z = 0, when f (6) (0) = 6!/5 7. (a) Here we get (b) Here we get f(1) p(1) 1 (1 0)(2 1)(4 1)(6 1)(8 1)(10 1) 0.012 57 f(5) p(5) 1 (5 0)(5 2)(5 4)(6 5)(8 5)(10 5) 0.0029 57 Thus the estimate for the error in the middle is significantly (by a factor of 4.2) smaller. 12 Exercise 3.3.3, p. 165 Assume that Chebyshev interpolation is used to find a fifth degree interpolating polynomial Q 5 (x) on the interval [ 1, 1] for the function f(x) = e x. Use the interpolation error formula to find a worst case estimate for the error e x Q 5 (x) that is valid for x throughout the interval [ 1, 1]. How many digits after the decimal point will be correct when Q 5 (x) is used to approximate e x? Solution Fifth degree interpolation polynomial implies that at least n = 6 interpolation nodes are used. Using the interpolation error formula for Chebyshev polynomial on [ 1, 1] we get max f(x) Q 5(x) x [ 1,1] f (6) (z) max z [ 1,1] 2 6 1 = max 6! z [ 1,1] Thus at least three digits after the decimal point will be correct. 13 Exercise 3.3.7, p.165 e z 2 5 6! = e 2 5 6! 1.2 10 4. Suppose that we are designing the ln key for a calculator whose display shows six digits to the right of the decimal point. Find the least degree d for which Chebyshev interpolation on the interval [1, e] will approximate within this accuracy. Solution We use formulae (3.6) and (3.14) in the book. Thus for a Chebyshev interpolation polynomial of degree d (d + 1 interpolation nodes) we obtain: max f(x) Q d(x) max x [1,e] z [1,e] f d+1 (z) (e 1) d+1 (d + 1)!2 d 2 d+1 = max z [1,e] d! (e 1) d+1 z d+1 (d + 1)!2 d 2 d+1 = (e 1)d+1 (d + 1)2 2d+1, because the maximum of 1/z on [1, e] occurs at z = 1. We now look for an integer d such that the error is strictly smaller than 10 6 : Thus d = 14 is required. d = 1 error 0.18 d = 2 error 0.053 d = 6 error 7.7 10 4 d = 10 error 1.7 10 5 d = 13 error 1.04 10 6 d = 14 error 4.17 10 7 8