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

Mathsassignment

Uploaded by

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

Mathsassignment

Uploaded by

daviddeepa07
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

© DEC 2019 | IRE Journals | Volume 3 Issue 6 | ISSN: 2456-8880

Newton Forward and Backward Interpolation Method


VISHAL VAMAN MEHTRE1, MOHIT PRAJAPATI2
1
Assistant Professor, Department of Electrical Engineering Bharati Vidyapeeth Deemed College of
Engineering, PUNE
2
Department of Electrical Engineering Bharati Vidyapeeth Deemed College of Engineering, PUNE

Abstract- This paper gives us the basic information Example: -


of “Newton forward and backward interpolation Input: - value of sin 52
method”. These methods are used to solve problem a 45° 50° 55° 60°
on newton interpolation by forward or backward a° 0.7071 0.7660 0.8192 0.8660
interpolation method. For different problem we
have different method, this is explained by solving
Output:
problem below on both newton forward and
backward interpolation method. We are also
deriving formula for newton forward interpolation
method and newton backward interpolation method.

I. INTRODUCTION

 Interpolation is the method of finding the value of


a function for any intermediate value for Value at Sin 52 is 0.788003
independent variable, while the process of
calculating the value of the function outside the Below is the implementation of newton forward
given range is called extrapolation. [4] interpolation method.
 Forward Differences: The differences y1 – y0, y2
– y1, y3 – y2… yn – yn–1 when denoted by dy0, CPP Program to interpolate using
dy1, dy2… dyn–1 are respectively, called the first newton forward interpolation
forward differences. #include <bits/stdc++.h>
using namespace std;
// calculating u mentioned in the formula
float u_cal(float u, int n)
{
float temp = u;
for (int i = 1; i < n; i++)
temp = temp * (u - i);
return temp;
}
// calculating factorial of given number n
int fact(int n)
{
II. NEWTON’S GREGORY FORWARD
int f = 1;
INTERPOLATION METHOD
for (int i = 2; i <= n; i++)
f *= i;
This formula is mainly useful for interpolating the
return f;
values of f(x) near the starting of the set of values
}
given. “h” is the common difference and u = (x – a) /
int main()
h, here “a” is first term.

IRE 1701781 ICONIC RESEARCH AND ENGINEERING JOURNALS 12


© DEC 2019 | IRE Journals | Volume 3 Issue 6 | ISSN: 2456-8880

{
// Number of values given  Backward Differences
int n = 4; The differences y1 – y0, y2 – y1, ……, yn – yn–1
float x[] = { 45, 50, 55, 60 }; when denoted by dy1, dy2, ……, dyn, respectively,
// y[][] is used for difference table are named as first backward difference. Thus the first
// with y[][0] used for input backward differences are :
float y[n][n];
y[0][0] = 0.7071;
y[1][0] = 0.7660;
y[2][0] = 0.8192;
y[3][0] = 0.8660;
// Calculating the forward difference
// table
for (int i = 1; i < n; i++) {
for (int j = 0; j < n - i; j++)
y[j][i] = y[j + 1][i - 1] - y[j][i - 1];
}
// Displaying the forward difference table
for (int i = 0; i < n; i++) {
III. NEWTON’S GREGORY BACKWARD
cout << setw(4) << x[i]
INTERPOLATION FORMULA
<< "\t";
for (int j = 0; j < n - i; j++)
This formula is used when the value of f(x) is
cout << setw(4) << y[i][j]
required at the end of the table. h is known as the
<< "\t"; common difference and u = ( x – an ) / h, Here an is
cout << endl; last term in table.[3]
}
// Value to interpolate at Example:Input: Population in 1925
float value = 52;
// initializing u and sum Year(x): 1891 1901 1911 1921 1931
float sum = y[0][0]; Population(y): 46 66 81 93 101
float u = (value - x[0]) / (x[1] - x[0]); (in thousands)
for (int i = 1; i < n; i++) {
sum = sum + (u_cal(u, i) * y[0][i]) /
Output:
fact(i);
}
cout << "\n Value at " << value << " is "
<< sum << endl;
return 0;
}

Output Value in 1925 is 96.8368


45 0.7071 0.0589 - -
0.00569999 0.000699997 Below is the implementation of newton backward
50 0.766 0.0532 - interpolation method.
0.00639999
55 0.8192 0.0468 // CPP Program to interpolate using
60 0.866 // newton backward interpolation
Value at 52 is 0.788003 #include <bits/stdc++.h>

IRE 1701781 ICONIC RESEARCH AND ENGINEERING JOURNALS 13


© DEC 2019 | IRE Journals | Volume 3 Issue 6 | ISSN: 2456-8880

using namespace std; sum = sum + (u_cal(u, i) * y[n - 1][i]) /


// Calculation of u mentioned in formula fact(i);
float u_cal(float u, int n) }
{ cout << "\n Value at " << value << " is "
float temp = u; << sum << endl;
for (int i = 1; i < n; i++) return 0;
temp = temp * (u + i); }
return temp;
} Output:
// Calculating factorial of given n 46
int fact(int n) 66 20
{ 81 15 -5
int f = 1; 93 12 -3 2
for (int i = 2; i <= n; i++)
101 8 -4 -1 -3
f *= i;
Value at 1925 is 96.8368
return f;
}
IV. USE OF NEWTON FORWARD AND
int main()
BACKWARD INTERPOLATION METHOD
{
// number of values given
Forward interpolation formula is used to interpolate
int n = 5;
the values of y nearer to the beginning value of the
float x[] = { 1891, 1901, 1911,
given table. Also this formula is applicable if in case
1921, 1931};
where h (difference in in travel) is constant.
// y[][] is used for difference
// table and y[][0] used for input
Now coming to backward difference formula. [1]
float y[n][n];
y[0][0] = 46;
This formula is used to interpolate the values of y
y[1][0] = 66;
nearer to the end of the table (or) tabular values.
y[2][0] = 81;
y[3][0] = 93;
These are the places, where we need to apply those
y[4][0] = 101;
formulas.
// Calculating the backward difference table
These formulas are used when the in travels for
for (int i = 1; i < n; i++) {
computing a value of a function are equidistant.
for (int j = n - 1; j >= i; j--)
y[j][i] = y[j][i - 1] - y[j - 1][i - 1];
CONCLUSION
}
// Displaying the backward difference table
The degree of the polynomial is one less than the
for (int i = 0; i < n; i++) {
number of pairs of observations. The polynomial that
for (int j = 0; j <= i; j++)
represents the given set of numerical data can be used
cout << setw(4) << y[i][j]
for interpolation at any position of the independent
<< "\t";
variable lying within its two extreme values. The
cout << endl;
approach of interpolation, described here, can be
}
suitably applied in inverse interpolation also.
// Value to interpolate at
Newton’s forward interpolation formula is valid for
float value = 1925;
estimating the value of the dependent variable under
// Initializing u and sum
the following two conditions [2]: 1. The given values
float sum = y [n - 1][0];
of the independent variable are at equal interval. 2.
float u = (value - x [n - 1]) / (x [1] - x[0]);
The value of the independent variable corresponding
for (int i = 1; i < n; i++) {

IRE 1701781 ICONIC RESEARCH AND ENGINEERING JOURNALS 14


© DEC 2019 | IRE Journals | Volume 3 Issue 6 | ISSN: 2456-8880

to which the value of the dependent variable is to be


estimated lies in the first half of the series of the
given values of the independent variable.[2]

Therefore, the formula derived here is valid for


representing a set of numerical data on a pair of
variables by a polynomial under these two conditions
only. Consequently, there is necessity of searching
for some formula for representing a set of numerical
data on a pair of variables by a polynomial if the
value of the independent variable corresponding to
which the value of the dependent variable is to be
estimated lies in the last half of the series of the given
values, which are at equal interval, of the
independent variable. Moreover, there is also
necessity of searching for some formula for
representing a set of numerical data on a pair of
variables by a polynomial if the given values of the
independent variable are not at equal interval.

ACKNOWLEDGEMENT

We would like to express our special thanks of


gratitude to Dr. D.S Bankar Head of
Department of Electrical Engineering for their able
guidance and support for completing my research
paper. I would also like to thank the faculty members
of Department of Electrical Engineering would
helped us with extended support.

REFERENCES

[1] Biswajit Das and Dhritikesh Chakrabarty, “A


Study on Newton Forward and Backward
Interpolation”, Published By: - International
Journal of Statistics and Applied Mathematics
2016; 1(2): 36-41, issued on 12, June, 2016.
[2] Prof. Danny Newton Forward and Backward
Interpolation, sixth edition.
[3] “Polymorphism Measures for early risk
prediction”, “Saida Benlarbi”.
[4] Study of Measurements using Newton Forward
and Backward Interpolation Method “Shivam”
issue 2nd July 2013.

IRE 1701781 ICONIC RESEARCH AND ENGINEERING JOURNALS 15

You might also like