# Gaussian forward interpolation

| |

Interpolation refers to the process of creating new data points specified in a given dataset. The code below calculates the required data point in a given range of discrete datasets using a formula given by Gauss, and this method is known as the Gaussian forward method.

# Gaussian forward method:

Gaussian interpolation falls under the Central Difference Interpolation Formulas. Suppose we are given the following value y = f (x) for given values ​​of x:
X: x0 x1 x2 ………. xn
Y: y0 y1 y2 ………… yn
Differences y1 — y0, y2 — y1, y3 — y2, ……, yn — yn - 1, denoted as Δy0, Δy1, Δy2, ……, Δyn - 1, respectively, are called the first forward differences. So the first forward differences are:

Δy 0 = y 1 — y 0

and in the same way we can calculate higher order differences.

And after creating the table, we calculate the value using the following formula:

Now let’s take example and solve it for better understanding.
Problem:
In the following table, find the value of e 1.17, using the Gauss Forward formula.

` `

` x 1.00 1.05 1.10 1.15 1.20 1.25 1.30 ex2.7183 2.8577 3.0042 3.1582 3.3201 3.4903 3.6693 `

Solution:
We have

y p = y 0 + pΔy 0 + (p (p-1) / 2!). Δy 2 0 + ((p + 1) p (p-1) / 3!). Δy 3 0 + ...

where p = (x 1.17 — x 1,15 ) / h
and h = x 1 — x 0 = 0.05
so p = 0.04

Now we need to calculate Δy 0 , Δy 2 0 , Δy 3 0 ... etc.

Put the required values ​​into the formula
y x = 1 , 17 = 3.158 + (2/5) (0.162) + (2/5) (2/5 — 1) / 2. (0.008) ...
y x = 1.17 = 3.2246

Code: Python code to implement Gauss Formula

` `

` # Python3 code for straight Gauss formula # library import import numpy as np   # function to calculate the Y coefficient def p_cal (p, n):    temp = p;  for i in range ( 1 , n):  if (i % 2 = = 1 ): temp * (p - i)   else : temp * (p + i) return temp;  # function for factorial def fact (n):  f = 1   for i in range ( 2 , n + 1 ):  f * = i return f    # storage available small data n = 7 ;  x = [ 1 , 1.05 , 1.10 , 1.15 , 1.20 , 1.25 , 1.30 ];    y = [[ 0 for i in range (n)]  for j in range (n)];  y [ 0 ] [ 0 ] = 2.7183 ;  y [ 1 ] [ 0 ] = 2.8577 ;  y [ 2 ] [ 0 ] = 3.0042 ;  y [ 3 ] [ 0 ] = 3.1582 ;  y [ 4 ] [ 0 ] = 3.3201 ;  y [ 5 ] [ 0 ] = 3.4903 ;  y [ 6 ] [ 0 ] = 3.6693 ;    # Generate a Gaussian triangle for i in range ( 1 , n):  for j in range (n - i):    y [j] [i] = np. round ((y [ j + 1 ] [i - 1 ] - y [j] [i - 1 ]), 4 );    # Print triangle for i in range (n):  print (x [i], end = "" );  for j in range (n - i):  print (y [i] [j], end = "" );  print ("");    # Y value should be predicted to value = 1.17 ;    # embedding the formula sum = y [ int (n / 2 )] [ 0 ];  p = (value - x [ int ( n / 2 )]) / (x [ 1 ] - x [ 0 ])   for i in range ( 1 , n):  # print (y [int ((ni) / 2)] [i])   sum = sum + (p_cal (p, i) * y [ int ((n - i) / 2 )] [i]) / fact (i)   print ( "Value at" , value ,  "is" , round ( sum , 4 )); `

Output:

` 1 2.7183 0.1394 0.0071 0.0004 0.0 0.0 0.0001 1.05 2.8577 0.1465 0.0075 0.0004 0.0 0.0001 1.1 3.0042 0.154 0.0079 0.0004 0.0001 1.15 3.1582 0.1619 0.0083 0.0005 1.2 3.3201 0.1702 0.0088 1.25 3.4903 0.179 1.3 3.6693 at 1.17 is 3.2246 `

## Shop Learn programming in R: courses

\$ Best Python online courses for 2022

\$ Best laptop for Fortnite

\$ Best laptop for Excel

\$ Best laptop for Solidworks

\$ Best laptop for Roblox

\$ Best computer for crypto mining

\$ Best laptop for Sims 4

\$

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

NUMPYNUMPY

How to convert Nonetype to int or string?

NUMPYNUMPY

How to specify multiple return types using type-hints

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

## Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method