Numerical Methods Charudatt Kadolkar Lectures on Numerical Methods

  • Slides: 10
Download presentation
Numerical Methods Charudatt Kadolkar Lectures on Numerical Methods Copyright 1996 -98 © Dale Carnegie

Numerical Methods Charudatt Kadolkar Lectures on Numerical Methods Copyright 1996 -98 © Dale Carnegie & Associates, Inc. 6/16/2021 1

Interpolation Problem – In general the function is known only for a few points

Interpolation Problem – In general the function is known only for a few points or provided as a table. – Example: A log table only mentions following values. x 1 1. 5 2 3 3. 5 4 Log(x) 0. 0 0. 17609 0. 30103 0. 47712 0. 54407 0. 60206 – The problem is to find log(2. 5). We may use a straight line interpolation between points 2 and 3. – The straight line interpolation may be extended to a polynomial, since the straight line uses only two datapoints, when we have several data points available with us. – We will find a polynomial which passes through all these points. Lectures on Numerical Methods 6/16/2021 2

Polynomials Forms of Polynomials Lectures on Numerical Methods 6/16/2021 3

Polynomials Forms of Polynomials Lectures on Numerical Methods 6/16/2021 3

Polynomials • Nested Multiplication Algorithm – Want to evaluate a polynomial P(x) given in

Polynomials • Nested Multiplication Algorithm – Want to evaluate a polynomial P(x) given in Newton form, at x = z. – 1. bn = an 2. For i = n – 1 to 0 step – 1 3. bi = ai + ( z – ci+1 )* bi+1 4. Print the answer P(z) = b 0. – Lectures on Numerical Methods 6/16/2021 4

Polynomials • Nested Multiplication Algorithm Example Lectures on Numerical Methods 6/16/2021 5

Polynomials • Nested Multiplication Algorithm Example Lectures on Numerical Methods 6/16/2021 5

Polynomials – To interpolate a function (unknown) whose values at n+1 distinct points are

Polynomials – To interpolate a function (unknown) whose values at n+1 distinct points are known, we will use a polynomial of degree <= n. • Uniqueness – If two polynomials P(x) and Q(x) of degrees less than or equal to k agree at k+1 distinct points, then P(x) and Q(x) are identical. • Existence – Lagranges polynomial given below is the proof of existence. Lectures on Numerical Methods 6/16/2021 6

Lagrange’s Polynomial • Algorithm – The data is given as ( xi , fi

Lagrange’s Polynomial • Algorithm – The data is given as ( xi , fi ). To calculate p(x) 1. p = 0 2. For i = 1 to n 3. t = 1 4. For j = 0 to n 5. If j i then 6. t = t * ( x – xi ) / ( xi – xj ) 7. p = p + t * fi 8. P is the required value of p(x) Lectures on Numerical Methods 6/16/2021 7

Method of Divided Differences Lectures on Numerical Methods 6/16/2021 8

Method of Divided Differences Lectures on Numerical Methods 6/16/2021 8

Method of Divided Differences • Table Lectures on Numerical Methods 6/16/2021 9

Method of Divided Differences • Table Lectures on Numerical Methods 6/16/2021 9

Method of Divided Differences • Algorithm – To create the table of divided differences.

Method of Divided Differences • Algorithm – To create the table of divided differences. 1. For i = 1 to n 2. di, 0 = fi 3. For i = 1 to n 4. 5. For j = 1 to n-i dj, i = (dj+1, i-1 – dj, i-1 ) / (xj+i – xj) 6. D would be required table Lectures on Numerical Methods 6/16/2021 10