[go: up one dir, main page]

0% found this document useful (0 votes)
103 views7 pages

De La Salle Lipa College of Information Technology and Engineering Electrical Engineering Department

This document provides information about Lagrange interpolation. It defines interpolation as a technique for adding new data points within a range of known data points. Lagrange interpolation specifically finds a polynomial that passes through a set of known data points. The steps of the Lagrange interpolation algorithm are described. The Lagrange interpolation formula is presented. A flowchart of the Lagrange interpolation process is shown. A sample problem demonstrates applying Lagrange interpolation to estimate the value of a function between given points. The problem interpolates 5 points of the function f(x) = sin(3x) and estimates f(1.5), achieving an approximate value accurate to within 0.0002 of the true value.

Uploaded by

aira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views7 pages

De La Salle Lipa College of Information Technology and Engineering Electrical Engineering Department

This document provides information about Lagrange interpolation. It defines interpolation as a technique for adding new data points within a range of known data points. Lagrange interpolation specifically finds a polynomial that passes through a set of known data points. The steps of the Lagrange interpolation algorithm are described. The Lagrange interpolation formula is presented. A flowchart of the Lagrange interpolation process is shown. A sample problem demonstrates applying Lagrange interpolation to estimate the value of a function between given points. The problem interpolates 5 points of the function f(x) = sin(3x) and estimates f(1.5), achieving an approximate value accurate to within 0.0002 of the true value.

Uploaded by

aira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

DE LA SALLE LIPA

COLLEGE OF INFORMATION TECHNOLOGY AND ENGINEERING


ELECTRICAL ENGINEERING DEPARTMENT

HOMEWORK #1
(LAGRANGE INTERPOLATION)

SUBMITTED BY: SUBMITTED TO:


LINGAO, AIRA SHAYNE P. ENGR. DAVIDSON DIMAANO

V3A
NUMMETH
LAGRANGE INTERPOLATION

i. DEFINITION

1. What is Interpolation?
Interpolation is a technique for adding new data points within a
range of a set of known data points. You can use interpolation to fill-in
missing data, smooth existing data, make predictions, and more. Also it is the
problem of constructing a function which goes through a given set of data
points. In some applications, these data points are obtained by sampling a
function or process.
The goal of interpolation is to find a linear combination of n known
functions to fit a set of data that imposes n constraints, thus guaranteeing a
unique solution that fits the data exactly, rather than approximately.
Interpolation, The simplest kind of interpolation, in which most
development has been made, is interpolation by means of univariate
polynomials. Multiple formulae for polynomial interpolation have been
given, notably those of Newton and Lagrange

2. What is Lagrange Interpolation?


Lagrange interpolation is a well-known, classical technique for
interpolation. It is also called Waring-Lagrange interpolation, since Waring
actually published it 16 years before Lagrange. More generically, the term
polynomial interpolation normally refers to Lagrange interpolation. In the
first-order case, it reduces to linear interpolation.
ii. ALGORITHM

1. What are the steps for Lagrange Interpolation?

First Step: Read n, x


Second Step: Perform for i = 1 to (n + 1) in steps of 1 do Reaf xi, fi
endfor, read as xis and the corresponding values of fis
Third Step: Sum zero
Fourth Step: for i = 1 to (n + 1) in steps of 1 do
Fifth Step: prodfunc zero
Sixth Step: for i = 1 to (n + 1) in steps of 1 do
Seventh Step: If (j is not equal to i) the prodfunc prodfunc
multiplied to (x-xj)/(xi-xj)
Eight Step: sum sum + fi times prodfunc; where sum is the value of
f at x endfor
Ninth Step: Write x, sum
Tenth Step: End

2. What is Lagrange Interpolation Formula?

Source: photo from https://mat.iitm.ac.in/home/sryedida/public_html/caimna/interpolation/lagrange.html


3. Flowchart of Lagrange Interpolation

START

Read n, x

Read xi, fi i=0 to n

sum = 0

for i=0 to n

prod = 0
for i=0 to n

Is j=i

prod = prod (x-xj)/(xi-xj)

Next j

sum = sum + prod * fi

Next i

Print sum, x

END
iii. SAMPLE

Problem: We wish to find the polynomial interpolating the points


x 1 1.3 1.6 1.9 2.2
f(x) 0.1411 -0.6878 -0.9962 -0.5507 0.3115

Where f(x) = sin (3x). estimate f(1.5)


FIRST: Find Lagrange Polynomials Lk, k=1…5
(x−1.3)( x−1.6)(x−1.9)(x−2.2)
L1(x) =
(1−1.3)(1−1.6)(1−1.9)(1−2.2)

(x−1)( x−1.6)(x−1. 9)( x−2.2)


L2(x) =
(1 .3−1)(1.3−1.6)(1.3−1. 9)(1.3−2.2)

(x −1)( x−1.3)(x−1.9)( x−2.2)


L3(x) =
(1 .6−1.3)(1 .6−1.3)(1 .6−1.9)(1 .6−2.2)

(x−1)( x−1.3)( x−1.6)(x −2.2)


L4(x) =
(1 .9−1)(1.6−1.3)(1.6−1. 6)(1.6−2.2)

( x−1)( x −1.3)(x −1.6)( x−1.9)


L5(x) =
(2.2−1.3)(2.2−1.3)(2.2−1. 6)(2.2−1.9)

Graphs:
Source: photos from
http://www1.maths.leeds.ac.uk/~kersale/2600/Notes/appendix_E.pdf

The interpolating polynomial approximates accurately the function f(x) = sin(3x)


in the interval [1, 2.2], with five points only.
So, P(1.5) ≈ −0.9773 is an approximate to f(1.5) = sin(4.5) ≈ −0.9775 accurate within
E ≈ 2 × 10−4

FINAL ANSWER: f(1.5) = sin(4.5) ≈ −0.9775 approximate error of E ≈ 2 × 10−4

You might also like