MODULE 4: CURVE FITTING INTERPOLATION CURVE FITTING • It is the method of constructing a curve or a derived function that will “fit” to the set of data subject to constraints to obtain intermediate estimates. • General approaches for curve fitting: ➢ Least-squares regression ➢ Interpolation CURVE FITTING • Interpolation ➢ It is a process of estimating a value between the data points which are known to be precise and directly pass by the fitted curve or series of curves. ➢ The most common method used is the polynomial interpolation. ➢ Newton’s Divided Difference and Lagrange Interpolating Polynomials. INTERPOLATION INTERPOLATION • Newton’s Divided-Difference Interpolating Polynomials • Linear Interpolation • Quadratic Interpolation • General form of Newton’s divided-difference interpolation INTERPOLATION • Linear Interpolation ➢ Simplest form of interpolation that connects two data points to form a straight line. • 𝑓1 𝑥 −𝑓 𝑥0 𝑥−𝑥0 = 𝑓 𝑥1 −𝑓 𝑥0 𝑥1 −𝑥0 • 𝒇𝟏 𝒙 = 𝒇 𝒙𝟎 + 𝒇 𝒙𝟏 −𝒇 𝒙𝟎 𝒙𝟏 −𝒙𝟎 𝒙 − 𝒙𝟎 • 𝑓1 𝑥 = 𝑎0 + 𝑎1 𝑥 • 𝑓1 𝑥 = 𝑓 𝑥0 − 𝑓 𝑥1 −𝑓 𝑥0 𝑥0 𝑥1 −𝑥0 + 𝑓 𝑥1 −𝑓 𝑥0 𝑥1 −𝑥0 𝑥 INTERPOLATION • Quadratic Interpolation • 𝑓2 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 𝑥 − 𝑥0 𝑥 − 𝑥1 • 𝑓2 𝑥 = 𝑏0 − 𝑏1 𝑥0 + 𝑏2 𝑥0 𝑥1 + 𝑏1 − 𝑏2 𝑥0 − 𝑏2 𝑥1 𝑥 + 𝑏2 𝑥 2 • 𝑏0 = 𝑓 𝑥0 • 𝑏1 = 𝑓 𝑥1 −𝑓 𝑥0 𝑥1 −𝑥0 • 𝑏2 = 𝑓 𝑥2 −𝑓 𝑥1 𝑓 𝑥1 −𝑓 𝑥0 − 𝑥 −𝑥 𝑥2 −𝑥1 1 0 𝑥2 −𝑥0 INTERPOLATION • General form of Newton’s Divided-Difference Interpolation ➢ Fitting an 𝑛th order of polynomial to n+1 data points using finite divided difference ❑ 𝑓𝑛 𝑥 = 𝑏0 + 𝑏1 𝑥 − 𝑥0 + 𝑏2 𝑥 − 𝑥0 𝑥 − 𝑥1 + ⋯ + 𝑏𝑛 𝑥 − 𝑥0 𝑥 − 𝑥1 ⋯ 𝑥 − 𝑥𝑛−𝑧 ➢ Newton’s divided-difference interpolating polynomial ❑ 𝑓𝑛 𝑥 = 𝑓 𝑥0 + 𝑥 − 𝑥0 𝑓 𝑥1 , 𝑥0 + 𝑥 − 𝑥0 𝑥 − 𝑥1 𝑓 𝑥2 , 𝑥1 , 𝑥0 + ⋯ + 𝑥 − 𝑥0 𝑥 − 𝑥1 ⋯ ሺ𝑥 − 𝑥𝑛−1 ሻ𝑓 𝑥𝑛 , 𝑥𝑛−1 , ⋯ , 𝑥2 , 𝑥1 , 𝑥0 INTERPOLATION • Finite Divided Difference ❑ 𝑏0 = 𝑓 𝑥0 ❑ 𝑏1 = 𝑓 𝑥1 , 𝑥0 = 𝑓 𝑥1 −𝑓 𝑥0 𝑥1 −𝑥0 • • • ❑ 𝑏𝑛 = 𝑓 𝑥𝑛 , 𝑥𝑛−1 , ⋯ , 𝑥2 , 𝑥1 , 𝑥0 = 𝑓 𝑥𝑛 ,𝑥𝑛−1 ,⋯,𝑥2 ,𝑥1 −𝑓 𝑥𝑛−1 ,𝑥𝑛−2 ,⋯,𝑥2 ,𝑥1 ,𝑥0 𝑥𝑛 −𝑥0 INTERPOLATION • Lagrange Interpolating Polynomials ➢ The 𝑛th order polynomial can be represented as ❑ 𝑓𝑛 𝑥 = σ𝑛𝑖=0 𝐿𝑖 𝑥 𝑓 𝑥𝑖 ❑ 𝑓𝑛 𝑥 = 𝐿0 𝑥 𝑓 𝑥0 + 𝐿1 𝑥 𝑓 𝑥1 + 𝐿2 𝑥 𝑓 𝑥2 + ⋯ + 𝐿𝑛 𝑥 𝑓 𝑥𝑛 ➢ First-order version 𝑥−𝑥 𝑥−𝑥 ❑ 𝑓1 𝑥 = 𝑥 −𝑥1 𝑓 𝑥0 + 𝑥 −𝑥0 𝑓 𝑥1 0 1 1 0 ➢ Second-order version 𝑥−𝑥 𝑥−𝑥 𝑥−𝑥 𝑥−𝑥 𝑥−𝑥 𝑥−𝑥 ❑ 𝑓2 𝑥 = 𝑥 −𝑥1 𝑥 −𝑥2 𝑓 𝑥0 + 𝑥 −𝑥0 𝑥 −𝑥2 𝑓 𝑥1 + 𝑥 −𝑥0 𝑥 −𝑥1 𝑓 𝑥2 0 1 0 2 1 0 1 2 2 0 2 1 INTERPOLATION • SAMPLE PROBLEM: Find the polynomial that interpolates the points (1, 2) and (4, 5). Evaluate p(1/2) INTERPOLATION • SAMPLE PROBLEM: Using Newton’s divided-difference, determine the parabolic equation of the given data points. x 0 1 2 y 1 4 9 INTERPOLATION INTERPOLATION • SAMPLE PROBLEM: using Newton’s form, show that the interpolating polynomial of the points (-1, 3), 1 1 21 (0, 2), (2, 0), and (4, -1) is 𝑝 𝑥 = 40 𝑥 3 − 40 𝑥 2 − 20 𝑥 + 2 INTERPOLATION INTERPOLATION INTERPOLATION • SAMPLE PROBLEM: Solve problem no. 3 using Lagrange’s Interpolation INTERPOLATION