Math 578: Assignment 2

Similar documents
Jim Lambers MAT 460/560 Fall Semester Practice Final Exam

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

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)

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.

CHAPTER 2 POLYNOMIALS KEY POINTS

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

Math Numerical Analysis Mid-Term Test Solutions

Secondary Math 3 Honors - Polynomial and Polynomial Functions Test Review

MA2501 Numerical Methods Spring 2015

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

3.1 Interpolation and the Lagrange Polynomial

1 Solutions to selected problems

Preliminary Examination in Numerical Analysis

A monomial or sum of monomials

Integration, differentiation, and root finding. Phys 420/580 Lecture 7

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

Tropical Polynomials

5.3. Polynomials and Polynomial Functions

Computational Physics

Section 0.2 & 0.3 Worksheet. Types of Functions

November 20, Interpolation, Extrapolation & Polynomial Approximation

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 12: Monday, Apr 16. f(x) dx,

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

Numerical Methods. King Saud University

Chap. 19: Numerical Differentiation

Review 1. 1 Relations and Functions. Review Problems

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

Review: complex numbers

Section 4.1: Polynomial Functions and Models

Math 3 Variable Manipulation Part 3 Polynomials A

Test 2 Review Math 1111 College Algebra

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

Roots and Coefficients Polynomials Preliminary Maths Extension 1

Sections 7.1, 7.2: Sums, differences, products of polynomials CHAPTER 7: POLYNOMIALS

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

Interpolation and extrapolation

LHS Algebra Pre-Test

Solve the problem. Determine the center and radius of the circle. Use the given information about a circle to find its equation.

MATH10001 Mathematical Workshop Graph Fitting Project part 2

Patterns and Relations (Patterns)

The highest degree term is x $, therefore the function is degree 4 (quartic) c) What are the x-intercepts?

Math 9 Practice Final Exam #1

Simplifying Rational Expressions and Functions

Applied Numerical Analysis Homework #3

Applied Numerical Analysis Quiz #2

Extrapolation in Numerical Integration. Romberg Integration

1 Solutions to selected problems

1 Review of Interpolation using Cubic Splines

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

Core Mathematics 1 Quadratics

SPLINE INTERPOLATION

POLYNOMIAL FUNCTIONS. Chapter 5

Unit 1 Vocabulary. A function that contains 1 or more or terms. The variables may be to any non-negative power.

Data Analysis-I. Interpolation. Soon-Hyung Yook. December 4, Soon-Hyung Yook Data Analysis-I December 4, / 1

Chapter 3 Interpolation and Polynomial Approximation

Ch 7 Summary - POLYNOMIAL FUNCTIONS

AB ExamSolutions Texas A&M High School Math Contest November 8, 2014

Fixed point iteration and root finding

Taylor and Maclaurin Series. Approximating functions using Polynomials.

1. Definition of a Polynomial

Interpolation and Approximation

Review. Numerical Methods Lecture 22. Prof. Jinbo Bi CSE, UConn

L1 2.1 Long Division of Polynomials and The Remainder Theorem Lesson MHF4U Jensen

Synthetic Division. Vicky Chen, Manjot Rai, Patricia Seun, Sherri Zhen S.Z.

Examples of solutions to the examination in Computational Physics (FYTN03), October 24, 2016

Final exam (practice) UCLA: Math 31B, Spring 2017

Warm-Up. Use long division to divide 5 into

Ch. 12 Higher Degree Equations Rational Root

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

Taylor and Maclaurin Series. Approximating functions using Polynomials.

Chapter 3-1 Polynomials

AFM Review Test Review

Curve Fitting and Interpolation

1 Solving Algebraic Equations

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

CS 450 Numerical Analysis. Chapter 8: Numerical Integration and Differentiation

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.

Answers to Homework 9: Numerical Integration

Do not turn over until you are told to do so by the Invigilator.

MATH 150 Pre-Calculus

MA2501 Numerical Methods Spring 2015

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series:

MA 3021: Numerical Analysis I Numerical Differentiation and Integration

Cubic Splines; Bézier Curves

Caculus 221. Possible questions for Exam II. March 19, 2002

3.5. Dividing Polynomials. LEARN ABOUT the Math. Selecting a strategy to divide a polynomial by a binomial

Chapter 5: Numerical Integration and Differentiation

Chapter 4: Interpolation and Approximation. October 28, 2005

Vocabulary: I. Inverse Variation: Two variables x and y show inverse variation if they are related as. follows: where a 0

Input: A set (x i -yy i ) data. Output: Function value at arbitrary point x. What for x = 1.2?

AP Physics C Mechanics Calculus Basics

Interpolation. Chapter Interpolation. 7.2 Existence, Uniqueness and conditioning

Inverses. Stephen Boyd. EE103 Stanford University. October 28, 2017

Lecture 10 Polynomial interpolation

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

Advanced Math Quiz Review Name: Dec Use Synthetic Division to divide the first polynomial by the second polynomial.

Math 1314 Lesson 1: Prerequisites. Example 1: Simplify and write the answer without using negative exponents:

Midterm Review. Name: Class: Date: ID: A. Short Answer. 1. For each graph, write the equation of a radical function of the form y = a b(x h) + k.

Calculation of Orthogonal Polynomials and Their Derivatives

Core Mathematics 3 Algebra

Transcription:

Math 578: Assignment 2 13. Determine whether the natural cubic spline that interpolates the table is or is not the x 0 1 2 3 y 1 1 0 10 function 1 + x x 3 x [0, 1] f(x) = 1 2(x 1) 3(x 1) 2 + 4(x 1) 3 x [1, 2] 4(x 2) + 9(x 2) 2 3(x 2) 3 x [2, 3] Solution: Yes. Check conditions as follows. Define 1 + x x 3 := S 0 (x) x [0, 1] f(x) = 1 2(x 1) 3(x 1) 2 + 4(x 1) 3 := S 1 (x) x [1, 2] 4(x 2) + 9(x 2) 2 3(x 2) 3 := S 2 (x) x [2, 3] and Hence, Therefore, Besides, 1 3x 2 x [0, 1] f (x) = 2 6(x 1) + 12(x 1) 2 x [1, 2] 4 + 18(x 2) 9(x 2) 2 x [2, 3] 6x x [0, 1] f (x) = 6 + 24(x 1) x [1, 2] 18 18(x 2) x [2, 3] S 0 (1) = 1 = S 1 (1) S 1 (2) = 0 = S 2 (2) S 0(1) = 2 = S 1(1) S 1 (2) = 4 = S 2(2) S 0 (1) = 6 = S 1 (1) S 1 (2) = 18 = S 2 (2). f (0) = f (3) = 0. Hence, function f is the natural cubic spline of the given table. 1

19. Find a natural cubic spline function whose knots are 1, 0 and 1 and that takes these values: x -1 0 1 y 5 7 9 Solution: Suppose the natural cubic spline function has the form { S0 (x) x [ 1, 0] f(x) = S 1 (x) x [0, 1] Therefore, Assuming that and from the equation S 0 ( 1) = S 1 (1) = 0 = z 0 = z 2. S 0 (0) = z 1, h i 1 z i 1 + 2(h i 1 + h i )z i + h i z i+1 = b(b i b i 1 ) where b i = y i+1 y i h i and i = 1, we can get z 1 = 0. Hence, S 0 (x) = Ax + B, S 1 (x) = Cx + D. Substituting S 0 ( 1) = 5, S 0 (0) = 7, S 1 (0) = 7, S 1 (1) = 9 into the above equations, we have S 0 = S 1 = 2x + 7. Therefore, f(x) = 2x + 7 is the natural cubic spline whose knots and values are given in the table. 2

37. The first U.S. postage stamp was issued in 1885, with the cost to mail a letter set at 2 cents. In 1917, the cost was raised to 3 cents but then was returned to 2 cents in 1919. In 1932, it was upped to 3 cents again, where it remained for 26 years. Then a series of increases took place as follows: 1958 = 4 cents, 1963 = 5 cents, 1968 = 6 cents, 1971 = 8 cents, 1974 = 10 cents, 1978 = 15 cents, 1981 = 18 cents in March and 20 cents in October, 1985 = 22 cents, 1988 = 25 cents, 1991 = 29 cents, 1995 = 32 cents, 1999 = 33 cents, 2001 = 34 cents, 2002 = 37 cents, 2006 = 39 cents, 2007 = 41 cents, 2008 = 42 cents. (1) Determine the Newton interpolation polynomial for these data. (2) Determine the natural cubic spline for these data. (3) Using both results, to answer the questions: when will it cost 50 cents to mail a letter? Currently, the cost is 44 cents. What would each of these two types of interpolation predict? Solution: All codes are in the appix. (1)Suppose x = [1885 1917 1919 1932 1958 2008], y = [2 3 2 3 4 42]. Based on divided difference algorithm, Newton interpolation polynomial is p(x) = d 1 + d 2 (x 1885) + d 2 (x 1885)(x 1917) + + d 22 (x 1885) (x 2007), where the coefficients are [d 1, d 2,, d 22 ] = [2, 0.0313, 0.0156, 0.0012, 2.8944 10 5 2.2085 10 25 ]. (Details are in the algorithm.) The graph is 18 x 1013 Newton interpolation polynomial 16 14 12 10 8 6 4 2 0 2 1880 1900 1920 1940 1960 1980 2000 2020 Figure 1: Newton interpolation polynomial. 3

(2) The second derivatives at each point are: z = [0, 0.0508, 0.1351, 0.0378, 0.0369, 0.0672, 0.2317, 0.1906, 0.5307, 0.8394, 2.5557, 2.7809, 0.9077, 0.0001, 0.2404, 0.0335, 0.3758, 3.0715, 2.6773, 2.1753, 2.0438, 0]. And the exact form of the cubic spline is calculated in the algorithm by formula (5) in our notes. Here is the graph. 45 40 35 30 25 20 15 10 5 0 1880 1900 1920 1940 1960 1980 2000 2020 (3) Figure 2: Interpolation using natural cubic spline. 90 Find when will it cost 50 cents 80 70 60 50 40 30 20 2007 2007.5 2008 2008.5 Figure 3: Find the time for cost of 50 cents using Newton interpolation polynomial. From the figure, it can be seen that it will cost 50 cents in 2008.07, that is at the of the first month of 2008. Since currently the cost is 44 cents, this prediction is not good. 4

54 Find the time for the cost of 50 cents using cubic spline 52 50 48 46 44 42 40 2007 2007.5 2008 2008.5 2009 2009.5 2010 2010.5 2011 Figure 4: Find the time for cost of 50 cents using natural cubic spline. From Fig. 4, it can be seen that it will cost 50 cents in 2010.65, that is at the of July in 2010. However, since currently the cost is 44 cents while the cost is about 53 cents in the figure, this prediction is also not very good. 5

16. Using Taylor series expansions, derive the error term for the formula Proof. For h small enough, we have f (x) 1 [f(x) 2f(x + h) + f(x + 2h)]. h2 f(x + h) = f(x) + f (x)h + f (x) 2 h 2 + f (ξ 1 ) h 3 6 f(x + 2h) = f(x) + 2f (x)h + f (x) (2h) 2 + f (ξ 2 ) (2h) 3 2 6 where ξ 1 (x, x + h) and ξ 2 (x, x + 2h). Hence, substituting the above two equations in to the following formula, we have Hence, f(x) 2f(x + h) + f(x + 2h) h 2 f (x) = 1 h 2 [f (x)h 2 2f (x)h 2 f (ξ 1 ) 3 = f (ξ 1 ) 3 h + 4f (ξ 2 ) h = O(h). 3 f (ξ 1 ) h + 4f (ξ 2 ) h 3 3 is the error term for the approximation. h 3 + 4f (ξ 2 ) h 3 ] f (x) 3 12. Show how to use Richardson extrapolation if. Solution: Denote L = ϕ(h) + a 1 h + a 3 h 3 + a 5 h 5 + L = ϕ(h) + a 1 h + a 3 h 3 + a 5 h 5 + := N 1 (h) + O(h). (0.1) Using h/2 instead of h in the above equation, we get L = ϕ(h/2) + a 1 h/2 + a 3 (h/2) 3 + a 5 (h/2) 5 + (0.2) Multiplying (0.2) by 2 and subtracting (0.1), we obtain L = 2ϕ(h/2) ϕ(h) + O(h 3 ) := N 2 (h) + O(h 3 ). (0.3) Hence N 2 (h) = N 1 (h/2) N 1 (h) = N 1 (h/2) + N 1(h/2) N 1 (h) 2 1 6

where N 1 (h) = ϕ(h). Apply Richardson extrapolation on (0.3), we get: Hence, L = 23 N 2 (h/2) N 2 (h) 2 3 1 N 3 (h) = N 2 (h/2) + N 2(h/2) N 2 (h). 2 3 1 So on and so on, we conclude: where N 1 (h) = ϕ(h). + O(h 5 ) := N 3 (h) + O(h 5 ). (0.4) N j (h) = N j 1 (h/2) + N j 1(h/2) N j 1 (h), (j 2) 2 2j 3 1 7

Appixes % Determine Newton i n t e r p o l a t i o n p o l y n o m i a l u s i n g d i v i d e d d i f f e r e n c e. x =[1885 1917 1919 1932 1958 1963 1968 1971 1974 1978 1981+1/6... 1981+3/4 1985 1988 1991 1995 1999 2001 2002 2006 2007 2 0 0 8 ] ; y =[ 2 3 2 3 4 5 6 8 10 15 18 20... 22 25 29 32 33 34 37 39 41 4 2 ] ; n= l e n g t h ( x ) ; % c o e f f i c i e n t s d=y ; f o r j =2: n ; f o r i =n : 1: j ; d ( i ) = ( d ( i ) d ( i 1 ) ) / ( x ( i ) x ( i j + 1 ) ) ; ; ; %Newton i n t e r p o l a t i o n p o l y n o m i a l t =1885:2008; p=d ( n ) ones ( s i z e ( t ) ) ; f o r i =n 1: 1:1 p =( t x ( i ) ones ( s i z e ( t ) ) ). p+d ( i ) ; p l o t ( x, y, ro ) hold on p l o t ( t, p ) t i t l e ( Newton i n t e r p o l a t i o n p o l y n o m i a l ) % %N a t u r a l c u b i c s p l i n e x =[1885 1917 1919 1932 1958 1963 1968 1971 1974 1978 1981+1/6... 1981+3/4 1985 1988 1991 1995 1999 2001 2002 2006 2007 2 0 0 8 ] ; y =[ 2 3 2 3 4 5 6 8 10 15 18 20... 22 25 29 32 33 34 37 39 41 4 2 ] ; n= l e n g t h ( x ) ; h= z e r o s ( n 1); b= z e r o s ( n 1); f o r i = 1 : ( n 1) h ( i )= x ( i +1) x ( i ) ; b ( i ) = ( y ( i +1) y ( i ) ) / h ( i ) ; A= z e r o s ( n 2,n 2); f o r i =1: n 3 8

A( i, i ) = 2 ( h ( i )+ h ( i + 1 ) ) ; A( i, i +1)= h ( i + 1 ) ; A( i +1, i )= h ( i + 1 ) ; A( n 2,n 2)=2 ( h ( n 2)+h ( n 1 ) ) ; C= z e r o s ( n 2,1); f o r i =1: n 2 C( i ) = 6 ( b ( i +1) b ( i ) ) ; z=a\c ; z = [ 0 ; z ; 0 ] ; p l o t ( x, y, ro ) hold on f o r i = 1 : ( n 1) t =x ( i ) : x ( i + 1 ) ; s= z e r o s ( s i z e ( t ) ) ; s=z ( i + 1 ) / ( 6 h ( i ) ). ( t x ( i ) ). ˆ 3 + z ( i ) / ( 6 h ( i ) ). ( x ( i +1) t ). ˆ 3... +( y ( i + 1 ) / h ( i ) h ( i ) z ( i + 1 ) / 6 ). ( t x ( i ) ) + ( y ( i ) / h ( i ) h ( i ) z ( i ) / 6.... ( x ( i +1) t ) ; p l o t ( t, s ) hold on % % Determine Newton i n t e r p o l a t i o n p o l y n o m i a l u s i n g d i v i d e d d i f f e r e n c e. x =[1885 1917 1919 1932 1958 1963 1968 1971 1974 1978 1981+1/6... 1981+3/4 1985 1988 1991 1995 1999 2001 2002 2006 2007 2 0 0 8 ] ; y =[ 2 3 2 3 4 5 6 8 10 15 18 20... 22 25 29 32 33 34 37 39 41 4 2 ] ; n= l e n g t h ( x ) ; % c o e f f i c i e n t s d=y ; f o r j =2: n ; f o r i =n : 1: j ; d ( i ) = ( d ( i ) d ( i 1 ) ) / ( x ( i ) x ( i j + 1 ) ) ; ; ; %Newton i n t e r p o l a t i o n p o l y n o m i a l t = 2 0 0 7 : 0. 0 1 : 2 0 0 8. 2 5 %1885:2008; p=d ( n ) ones ( s i z e ( t ) ) ; f o r i =n 1: 1:1 9

p =( t x ( i ) ones ( s i z e ( t ) ) ). p+d ( i ) ; % p l o t ( x, y, ro ) % h old on p l o t ( t, p, r ) grid on ; t i t l e ( Find when w i l l i t c o s t 50 c e n t s ) % %N a t u r a l c u b i c s p l i n e x =[1885 1917 1919 1932 1958 1963 1968 1971 1974 1978 1981+1/6... 1981+3/4 1985 1988 1991 1995 1999 2001 2002 2006 2007 2 0 0 8 ] ; y =[ 2 3 2 3 4 5 6 8 10 15 18 20... 22 25 29 32 33 34 37 39 41 4 2 ] ; n= l e n g t h ( x ) ; h= z e r o s ( n 1); b= z e r o s ( n 1); f o r i = 1 : ( n 1) h ( i )= x ( i +1) x ( i ) ; b ( i ) = ( y ( i +1) y ( i ) ) / h ( i ) ; A= z e r o s ( n 2,n 2); f o r i =1: n 3 A( i, i ) = 2 ( h ( i )+ h ( i + 1 ) ) ; A( i, i +1)= h ( i + 1 ) ; A( i +1, i )= h ( i + 1 ) ; A( n 2,n 2)=2 ( h ( n 2)+h ( n 1 ) ) ; C= z e r o s ( n 2,1); f o r i =1: n 2 C( i ) = 6 ( b ( i +1) b ( i ) ) ; z=a\c ; z = [ 0 ; z ; 0 ] ; % p l o t ( x, y, ro ) % h old on i =n 1; t = 2 0 0 7 : 0. 1 : 2 0 1 1 ; s= z e r o s ( s i z e ( t ) ) ; s=z ( i + 1 ) / ( 6 h ( i ) ). ( t x ( i ) ). ˆ 3 + z ( i ) / ( 6 h ( i ) ). ( x ( i +1) t ). ˆ 3... +( y ( i + 1 ) / h ( i ) h ( i ) z ( i + 1 ) / 6 ). ( t x ( i ) ) + ( y ( i ) / h ( i ) h ( i ) z ( i ) / 6 ). ( x ( i +1) t p l o t ( t, s ) 10

grid on t i t l e ( Find t h e time f o r t h e c o s t of 50 c e n t s u s i n g c u b i c s p l i n e ) 11