3. LAGRANGE INTERPOLATION METHOD (LAGRANGE POLYNOMIAL):

Slides:



Advertisements
Similar presentations
Numerical Integration
Advertisements

ES 240: Scientific and Engineering Computation. Chapter 17: Numerical IntegrationIntegration  Definition –Total area within a region –In mathematical.
Section 5.7 Numerical Integration. Approximations for integrals: Riemann Sums, Trapezoidal Rule, Simpson's Rule Riemann Sum: Trapezoidal Rule: Simpson’s.
Numerical Integration Lecture (II)1
KFUPM SE301: Numerical Methods Topic 5: Interpolation Lectures 20-22:
Curve-Fitting Polynomial Interpolation
Numerical integration continued --- Simpson’s rules - We can add more segments OR - We can use a higher order polynomial.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 22 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 23 CURVE FITTING Chapter 18 Function Interpolation and Approximation.
1 Chapter 6 NUMERICAL DIFFERENTIATION. 2 When we have to differentiate a function given by a set of tabulated values or when a complicated function is.
Lagrange interpolation Gives the same results as Newton, but different method.
Chapter 6 Numerical Interpolation
CISE-301: Numerical Methods Topic 1: Introduction to Numerical Methods and Taylor Series Lectures 1-4: KFUPM.
NUMERICAL DIFFERENTIATION The derivative of f (x) at x 0 is: An approximation to this is: for small values of h. Forward Difference Formula.
CISE301_Topic7KFUPM1 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM Read Chapter 21, Section 1 Read Chapter 22, Sections 2-3.
CISE301_Topic71 SE301: Numerical Methods Topic 7 Numerical Integration Lecture KFUPM (Term 101) Section 04 Read Chapter 21, Section 1 Read Chapter.
Numerical Integration Formulas
Numerical Integration In general, a numerical integration is the approximation of a definite integration by a “weighted” sum of function values at discretized.
Area of a single trapezoid = h
1 Chapter 5 Numerical Integration. 2 A Review of the Definite Integral.
Numerical Integration Approximating Definite Integral.
MECN 3500 Inter - Bayamon Lecture Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
1 Chapter 7 NUMERICAL INTEGRATION. 2 PRELIMINARIES We use numerical integration when the function f(x) may not be integrable in closed form or even in.
1 Numerical Analysis Lecture 12 Numerical Integration Dr. Nader Okasha.
Numerical Differential & Integration. Introduction If a function f(x) is defined as an expression, its derivative or integral is determined using analytical.
Introduction to Numerical Analysis I
4.6 Numerical Integration Trapezoid and Simpson’s Rules.
4.6 Numerical Integration. The Trapezoidal Rule One method to approximate a definite integral is to use n trapezoids.
CSE 330 : Numerical Methods
Dr. Mubashir Alam King Saud University. Outline Numerical Integration Trapezoidal and Simpson’s Rules (5.1)
1 Numerical Integration Section Why Numerical Integration? Let’s say we want to evaluate the following definite integral:
Interpolation. Interpolation is important concept in numerical analysis. Quite often functions may not be available explicitly but only the values of.
Pre Calc Chapter 2 Section 6. Rational Functions Functions with the independent variable on the bottom of a fraction f(x) = N(x) D(x) Where N(x) & D(x)
Numerical Integration
Solving equations with polynomials – part 2. n² -7n -30 = 0 ( )( )n n 1 · 30 2 · 15 3 · 10 5 · n + 3 = 0 n – 10 = n = -3n = 10 =
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Prentice Hall 5.5 Trapezoidal Rule.
SE301_Topic 6Al-Amer20051 SE301:Numerical Methods Topic 6 Numerical Integration Dr. Samir Al-Amer Term 053.
Quadrature – Concepts (numerical integration) Don Allen.
Numerical Integration
CHAPTER 3 NUMERICAL METHODS
Aim: What are the rational function and asymptotes?
NUMERICAL DIFFERENTIATION Forward Difference Formula
Area of a Region Between 2 Curves
Chapter 7 Numerical Differentiation and Integration
Rational Functions and Their Graphs
MTH1170 Numeric Integration
Copyright © Cengage Learning. All rights reserved.
CHAPTER 3 NUMERICAL METHODS.
Numerical Integration Formulas
Area of a single trapezoid = h
Integration Review Problems
Numerical Analysis Lecture 27.
Interpolation.
Homework Review: Sect 9.1 # 28 – 33
Chapter 7 Numerical Differentiation and Integration
3. LAGRANGE INTERPOLATION METHOD
Numerical Analysis Lecture 26.
Area of a single trapezoid = h
Copyright © Cengage Learning. All rights reserved.
Chapter 6 Applications of Derivatives Section 6.5 Trapezoidal Rule.
Write Polynomial Functions and Models
(4)² 16 3(5) – 2 = 13 3(4) – (1)² 12 – ● (3) – 2 9 – 2 = 7
SKTN 2393 Numerical Methods for Nuclear Engineers
Area of a single trapezoid = h
Numerical Integration
3. LAGRANGE INTERPOLATION METHOD
Calculate the integral with; a) Trapezoidal rule b) Simpson’s rule
Elements of Numerical Integration
Presentation transcript:

3. LAGRANGE INTERPOLATION METHOD (LAGRANGE POLYNOMIAL): An alternate method of interpolation is to use polynomial fits to the available values to interpolate between those values. If there are N data values, a polynomial of degree N-1 can be found that will pass through all the points. The Lagrange polynomials provide a convenient alternative to solving the simultaneous equations that result from requiring the polynomials to pass through the data values. This is a particularly convenient way to interpolate among tabulated values with polynomials. An advantage of Lagrange interpolation is that the method does not need evenly spaced values in x. However, it is usually preferable to search for the nearest value in the table and then use the lowest-order interpolation consistent with the functional form of the data.

Example 3.1: x f(x) 3 2 60 4 90 10 120

Sub lagri_Click () ' Change File li.txt for different problems fl = fl0 + "li.txt": Open fl For Input As 1 Input #1, nx: n=nx-1:ReDim xd(nx), f(nx) For k = 0 To n: Input #1, xd(k), f(k): Next k Input #1, x: Close #1 Call cls1: Print nx: Print For k = 0 To n: Print xd(k), f(k): Next k FX = 0 For k = 0 To n LKX = CDbl(1): LKXK = CDbl(1) For i = 0 To n If i = k Then 55 LKX = LKX * (x - xd(i)): LKXK = LKXK * (xd(k) - xd(i)) 55 Next i FX = FX + (LKX / LKXK) * f(k) Next k Print : Print " RESULT : ", x, FX End Sub 4 0,3 2,60 4,90 10,120 8 li.txt

h Trapezoidal Rule: 4. NUMERICAL INTEGRATION: There are various numerical methods to calculate the definite integrals. The integral gives the area under the curve defined by the function f(x). We use the function values and increment value between to successive points on the x axis in order to calculate the integral. Area of a single trapezoid = h Trapezoidal Rule:

Simpson’s Rule: n=2*m n is always even number. In Simpson’s rule, number of section n must be even! Simpson’s Rule: n=2*m n is always even number.

k x Exp(-x^2) 1 0.25 0.939 2 0.50 0.779 3 0.75 0.570 4 0.368 Example 4.1: Trapezoidal Rule gives: 0.743 Simpson’s Rule gives: 0.747 Sub trapezoidal_Click () ' CHANGE LINES 70 AND 75 FOR DIFFERENT PROBLEMS 70 a = 0: b = 1: n = 10 h = (b - a) / n j = 0: x = a For i = 0 To n c1 = 1: If i = 0 Or i = n Then c1 = .5 75 f = Exp(-x * x) j = j + h * c1 * f: x = x + h Next i Call cls1: Print : Print " RESULT : ", j End Sub

Sub simpson_Click () ' CHANGE LINES 80 AND 85 FOR DIFFERENT PROBLEMS 80 a = 0: b = 1: m = 4 n = 2 * m: h = (b - a) / n j = 0: x = a For i = 0 To n If i = 0 Or i = n Then c1 = 1: GoTo 85 If CInt(i / 2) = i / 2 Then c1 = 2: GoTo 85 c1 = 4 85 f = Exp(-x ^ 2) j = j + (h / 3) * c1 * f: x = x + h Next i Call cls1: Print : Print " RESULT : ", j End Sub