數值方法 2008 Applied Mathematics, NDHU1  Lagrange polynomial  Polynomial interpolation Lecture 4II.

Slides:



Advertisements
Similar presentations
Lecture 4 Structure plan Program design process Program design process Basic elements of code: Basic elements of code: –Input (assignment of variables)
Advertisements

數值方法 2008, Applied Mathematics NDHU 1 Nonlinear systems Newton’s method The steepest descent method.
數值方法 2008, Applied Mathematics NDHU 1 Spline interpolation.
SECTION 3.6 COMPLEX ZEROS; COMPLEX ZEROS; FUNDAMENTAL THEOREM OF ALGEBRA FUNDAMENTAL THEOREM OF ALGEBRA.
Solving Quadratic Equations Algebraically Lesson 2.2.
CSE 421 Algorithms Richard Anderson Lecture 15 Fast Fourier Transform.
Polynomial Interpolation
Introduction to Algorithms
ON MULTIVARIATE POLYNOMIAL INTERPOLATION
Fast Fourier Transform Irina Bobkova. Overview I. Polynomials II. The DFT and FFT III. Efficient implementations IV. Some problems.
數值方法 2008, Applied Mathematics NDHU1  An iterative approach for root finding  Newton method Lecture 3II Root Finding.
Remainder and Factor Theorem Unit 11. Definitions Roots and Zeros: The real number, r, is a zero of f(x) iff: 1.) r is a solution, or root of f(x)=0 2.)
Warm up Use the Rational Root Theorem to determine the Roots of : x³ – 5x² + 8x – 6 = 0.
數值方法 2008, Applied Mathematics NDHU 1 Simpson rule Composite Simpson rule.
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
數值方法 2008 Applied Mathematics, NDHU1  Bisection method for root finding  Binary search  fzero Lecture 4.
Scientific Computing Linear and Quadratic Splines.
Dividing Polynomials Intro - Chapter 4.1. Using Long Division Example 1: Dividing Polynomials DIVISOR DIVIDEND REMAINDER QUOTIENT.
數值方法 2008, Applied Mathematics NDHU1  Looping for loop while loop  Break and return  Recursion Lecture 2 Iteration.
 Find a polynomial with specified zeros.  For a polynomial function with integer coefficients, find the rational zeros and the other zeros, if possible.
Question and Answer Samples and Techniques. Simplify the expression: (x 4 y -2 )(x -3 y 8 )
Polynomial Interpolation Lagrange Interpolation. Interpolation An Interpolating Function for a set of data: {( x 1, y 1 ),( x 2, y 2 ),( x 3, y 3 )…(
1. Interpolating polynomials Polynomial of degree n,, is a linear combination of Definitions: (interval, continuous function, abscissas, and polynomial)
Introduction to Numerical Analysis I MATH/CMPSC 455 Interpolation.
Mathematics for Business and Economics - I
數值方法 2008, Applied Mathematics NDHU 1 Numerical Integration.
COMPLEX ZEROS: FUNDAMENTAL THEOREM OF ALGEBRA Why do we have to know imaginary numbers?
Computers in Civil Engineering 53:081 Spring 2003 Lecture #15 Spline Interpolation.
Section 4.4 Theorems about Zeros of Polynomial Functions Copyright ©2013, 2009, 2006, 2001 Pearson Education, Inc.
Dear Power point User, This power point will be best viewed as a slideshow. At the top of the page click on slideshow, then click from the beginning.
Copyright © 2012 Pearson Education, Inc. Publishing as Addison Wesley CHAPTER 4: Polynomial and Rational Functions 4.1 Polynomial Functions and Models.
7.1 Polynomial Functions Evaluate Polynomials
數值方法 2008, Applied Mathematics NDHU1 Chaos time series.
Chapter 2 Functions and Graphs Copyright © 2014, 2010, 2007 Pearson Education, Inc Combinations of Functions; Composite Functions.
Chapter 3 Polynomial and Rational Functions Copyright © 2014, 2010, 2007 Pearson Education, Inc Zeros of Polynomial Functions.
Section 4.6 Complex Zeros; Fundamental Theorem of Algebra.
MA2213 Lecture 2 Interpolation.
數值方法 2008, Applied Mathematics NDHU 1 Numerical Differentiation.
2.5 The Fundamental Theorem of Algebra. The Fundamental Theorem of Algebra The Fundamental Theorem of Algebra – If f(x) is a polynomial of degree n, where.
MA4229 Lectures 15, 16 Week 13 Nov 1, Chapter 18 Interpolation by piecewise polynomials.
Evaluating Expressions. S.W.B.A.T  Use the order of operations to evaluate expressions with variables and expressions with numbers.
數值方法, Applied Mathematics NDHU 1 Linear system. 數值方法, Applied Mathematics NDHU 2 Linear system.
Sec Math II 1.3.
Quadratic Functions 2A Polynomials. A polynomial in x is an expression that contains only non-negative, whole number powers of x. The degree of a polynomial.
Computational Methods CMSC/AMSC/MAPL 460 Polynomial Interpolation Ramani Duraiswami, Dept. of Computer Science.
Evaluating and Graphing Polynomial Functions
QUADRATIC EQUATIONS
A polynomial is an expression that can be written in the form
Polynomial Interpolation
Do Now  .
Lecture 5 Polynomial Approximation
Solving for the Roots of Polynomials Golf
Descartes Rule of Signs Positive real zeros = Negative real zeros =
Numerical Analysis Lecture 25.
Roots and Zeros 5.7.
Notes Over 3.4 The Rational Zero Test
FST Chapter 7 Review Questions.
Lecture 3 Taylor Series Expansion
3.8 Complex Zeros; Fundamental Theorem of Algebra
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Evaluating Expressions
Evaluate Polynomial Functions
Warm-up: Find the equation of a quadratic function in standard form that has a root of 2 + 3i and passes through the point (2, -27). Answer: f(x) = -3x2.
Lecture 4 Structure plan
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
Copyright © 2014, 2010, 2007 Pearson Education, Inc.
3.6 Polynomial Functions Part 2
FUNCTIONS.
Differential Equations
Presentation transcript:

數值方法 2008 Applied Mathematics, NDHU1  Lagrange polynomial  Polynomial interpolation Lecture 4II

數值方法 2008 Applied Mathematics, NDHU2 poly Find the polynomial defined by given zeros poly returns coefficients of a polynomial with roots –5,0 and 5 poly([-5 0 5])

數值方法 2008 Applied Mathematics, NDHU3 polyval Polynomial evaluation y stores a result of substituting elements in v to a polynomial defined by roots: 5, 0 and -5 v=linspace(-5,5); p= poly([-5 0 5]); y=polyval(p,v);

p 3 (x)=(x-5)(x+5)(x-0) 數值方法 2008 Applied Mathematics, NDHU4 x=[ ];y=polyval(p,x);hold on;plot(x,y,'ro') Given data, find an interpolating polynomial

Polynomial Interpolation Paired data Each pair (x i,y i ) specifies a point on a target polynomial y i = f(x i ) for all i Given paired data, find an interpolating polynomial 數值方法 2008 Applied Mathematics, NDHU5

Strategy Use a linear combination of Lagrange polynomials determined by all x i to express the interpolating polynomial 數值方法 2008 Applied Mathematics, NDHU6

7 Lagrange polynomial n knots, n Lagrange polynomials

數值方法 2008 Applied Mathematics, NDHU8 Mathematical expression

數值方法 2008 Applied Mathematics, NDHU9 Proof

數值方法 2008 Applied Mathematics, NDHU10 Product form

數值方法 2008 Applied Mathematics, NDHU11 Lagrange polynomial Given n knots, Let L i denote the ith Lagrange polynomial L i is a polynomial of degree n-1 L i has n-1 roots: Normalization: L i satisfies L i (x i )=1

數值方法 2008 Applied Mathematics, NDHU12 Implementation: n-1 roots x is a vector that consists of n distinct knots pi is a polynomial whose roots are all knots except for x i xzeros=[x(1:i-1) x(i+1:n)]; pi=poly(xzeros);

數值方法 2008 Applied Mathematics, NDHU13 Implementation: Normalization c=polyval(pi,x(i)); pi=pi/c; Normalization condition

The ith Lagrange polynomial xzeros=[x(1:i-1) x(i+1:n)]; p_i=poly(xzeros); c=polyval(p_i,x(i)); p_i=p_i/c; STRATEGY I : use matlab functions to determine L i 數值方法 2008 Applied Mathematics, NDHU14

x_knot consists of n knots x_in collects input values Evaluate the ith Lagrange polynomial L i defined by knots in x_knot y= L i (x_in) y=lagrange_poly(x_in,x_knot,i) 數值方法 2008 Applied Mathematics, NDHU15 Evaluation of the ith Lagrange polynomial

數值方法 2008 Applied Mathematics, NDHU16 STRATEGY II : Product form evaluation T=length(x_in); n=length(x_knot); y=ones(1,T); for j=1:n j~=i a=(x_in-x_knot(j))/(x_knot(i)-x_knot(j)); y=y.*a T EXIT

數值方法 2008 Applied Mathematics, NDHU17 function y=lagrange_poly(x_in,x_knot,i) T=length(x_in); y=ones(1,T); n=length(x_knot); for j=1:n if j~=i a=(x_in-x_knot(j))/(x_knot(i)-x_knot(j)); y=y.*a; end return Direct Implementation of the product form

x_in=linspace(-2,3); y=lagrange_poly(x_in,[ ],1); plot(x_in,y); 數值方法 2008 Applied Mathematics, NDHU18 n=4,i=1 (strategy II)

數值方法 2008 Applied Mathematics, NDHU19 n=4,i=1 (strategy I) x=[ ];i=1;n=length(x); xzeros=[x(1:i-1) x(i+1:n)]; p_i=poly(xzeros); p_i=pi/polyval(p_i,x(i)); x_in=linspace(-2,3); plot(x_in,polyval(p_i,x_in),'r');

x_in=linspace(-2,3); y=lagrange_poly(x_in,[ ],2); plot(v,y); 數值方法 2008 Applied Mathematics, NDHU20 n=4,i=2 (strategy II)

數值方法 2008 Applied Mathematics, NDHU21 n=4,i=2 (strategy I) x=[ ];i=2;n=length(x); xzeros=[x(1:i-1) x(i+1:n)]; p_i=poly(xzeros); p_i=p_i/polyval(p_i,x(i)); x_in=linspace(-2,3); plot(v,polyval(p_i,x_in),'r');

Polynomial Interpolation Paired data Each pair (x i,y i ) specifies a point on a target polynomial y i = f(x i ) for all i Given paired data, find an interpolating polynomial 數值方法 2008 Applied Mathematics, NDHU22

數值方法 2008 Applied Mathematics, NDHU23 Input x y A sample from an unknown function

數值方法 2008 Applied Mathematics, NDHU24 Polynomial interpolation Given Find a polynomial that satisfies for all i

Interpolating polynomial is with degree n- 1 數值方法 2008 Applied Mathematics, NDHU25 Interpolating polynomial

數值方法 2008 Applied Mathematics, NDHU26 Verification

數值方法 2008 Applied Mathematics, NDHU27 function y_out=int_poly(x_in,x,y) for i=1:n y_out=zeros(size(x_in)); n=length(x); y_out=y_out+lagrange_poly(x_in,x,i).*y(i); EXIT

數值方法 2008 Applied Mathematics, NDHU28 function y_out=int_poly(x_in,x,y) y_out=zeros(size(x_in)); n=length(x); for i=1:n y_out=y_out+lagrange_poly(x_in,x,i).*y(i); end return