N R Programming Part
N R Programming Part
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
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)