Introduction to scientific Computing A Matrix Vector Approach Using Matlab Written by Charles FVan Loan 陈文斌 Wbchen(fudan. edu. cn 复日大学
Introduction to Scientific Computing -- A Matrix Vector Approach Using Matlab Written by Charles F.Van Loan 陈 文 斌 Wbchen@fudan.edu.cn 复旦大学
Chapter2 Polynomial Interpolation The vandermonde approach ° The Newton Approach Properties Special Topics
Chapter2 Polynomial Interpolation • The vandermonde Approach • The Newton Approach • Properties • Special Topics
Polynomial interpolation problem Given x…,xn( listinct)amdy…yn find a polynomialpmn(x)of degree n-1 (or less) such that pn(x)=y, for i=l: n
Polynomial interpolation problem (or less) such that p (x ) y for i :n find a polynomial p (x) of ree nGiven x ,...,x (distinct) and y ,...,y , n - i i n - n n 1 deg 1 1 1 1 1 = =
Vandermonde Approach B ase x, X pn-(x)=a+a,x+a3x+.+anx pn=1(x)=a1+02x+a3x12+…+anx 2 VI 2 2 V2 x 2 X n
Vandermonder Approach 2 1 1 1 2 3 ( ) ... − − = + + + + n n n p x a a x a x a x i n n i i i n i p x = a + a x + a x + + a x = y − − 2 1 1 1 2 3 ( ) ... = − − − − n n n n n n n n n y y y y a a a a x x x x x x x x x x x x 3 2 1 3 2 1 2 1 1 3 2 3 3 1 2 2 2 2 1 1 2 1 1 1 1 1 1 Base 1, x, x2 , … V
n= length(x);v=ones(n, n) for j=l: n n= length (x); V= ones(n, n); forⅰ=1:n Set up row i Set up row i for j=1: n V(i)=X()^j-1) V(i =(X(*ones(1, n)). c 1) end end end n=length (x) V=ones(n, n) n= length (x); V= ones(n, n)I for j=1: n for j=2: n Set up column i Set up column i for j=l: n for j=l: n V(i)=X()^j-1) V(】)=x()xV(j-1) end end end end
n = length(x); V = ones(n,n) for i=1:n % Set up row i. for j=1:n V(i,j) = x(i)^(j-1); end end n = length(x); V = ones(n,n); for i=1:n % Set up row i. V(i,:) = (x(i)*ones(1,n)).^(j- 1); end n = length(x); V = ones(n,n) for j=1:n % Set up column i. for i=1:n V(i,j) = x(i)^(j-1); end end n = length(x); V = ones(n,n) for j=2:n % Set up column i. for i=1:n V(i,j) = x(i)*V(i,j-1); end end