0% found this document useful (0 votes)
20 views

N R Programming Part

This document discusses Lagrange interpolation, which generates a polynomial that passes through a set of given data points to obtain values within or outside the existing data ranges. It presents the Lagrange interpolation formula and describes an algorithm and Python program to implement Newton-Raphson interpolation on a small dataset. The program takes user inputs for the initial guess x0 and error tolerance, performs iterations to calculate the root, and outputs the interpolated polynomial values at x0=2.2 and a calculated root of 2.498, matching the known values from the provided data table.

Uploaded by

Arunav Verma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

N R Programming Part

This document discusses Lagrange interpolation, which generates a polynomial that passes through a set of given data points to obtain values within or outside the existing data ranges. It presents the Lagrange interpolation formula and describes an algorithm and Python program to implement Newton-Raphson interpolation on a small dataset. The program takes user inputs for the initial guess x0 and error tolerance, performs iterations to calculate the root, and outputs the interpolated polynomial values at x0=2.2 and a calculated root of 2.498, matching the known values from the provided data table.

Uploaded by

Arunav Verma
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

LAGRANGE

INTERPOLATION

By: Arunav
Introduction
Interpolation is the process of finding arbitrary data points within the range of a given set of Data
Points. The Fundamental use of Interpolation is to Obtain extra Data outside the ranges of what
has been obtained.

Lagrange Interpolation basically, Generates a Polynomial that passes over a set of data points
that are already given and takes some random values.
Lag. Interpolation Formula

Products
THE PROGRAMMING
PART
Newton – Raphson Method
Algorithm of the Program
Step 1 –
Real x0, e, i
( x0 is the initial guess , ‘e’ is the relative error, ‘i’ is the number of iterations performed)

Step 2 –
Real external :: f, fd
( External is way to call functions that are declared outside the program. Here we have provided
two functions, where f is a functions and fd is the differentiation of f )

Step 3 –
print “Enter the value of x0”
Read x0
Print “Enter the value of error”
Read e
( Here we take the input from user i.e. the value of initial approximation ‘x0’ & error ‘e’ )
Defining Arrays & variables

Data Points Declaration (X,Y)

No: of data points we have & The


Interpolating Point

Formula for calculating products

The Sum after multiplying with their corresponding ‘Y’ values


The Total sum ‘s’ as Final Output
Data Table
X Y

1.9 1.3784

2.1 1.4491

2.3 1.5166

2.5 1.5811

2.7 1.6432

Output Values -:

At ‘x0 = 2.2’----------------------‘1.4832’

At ‘x0’ = ‘2.498’----------------’1.5804’
No: of Data Points & Interpolating Point (n &
x0)
Usr Input Polynomial Value at ‘2.2’ (1.4832)

Calculated root (n & x0)


Iterations performed
Polynomial Value at ‘2.498’ (1.5804)
Thank you!
Presented by Arunav Verma

You might also like