**Narration**
1
00:00:01 --> 00:00:05
Dear Friends, Welcome to the Spoken Tutorial on **Numerical Interpolation**.
2
00:00:06 --> 00:00:09
At the end of this tutorial, you will learn how to:
3
00:00:10 --> 00:00:15
Develop **Scilab code** for different **Numerical Interpolation algorithms**
4
00:00:16 --> 00:00:20
Calculate new value of **function** from given **data points**.
5
00:00:21 --> 00:00:23
To record this tutorial, I am using
6
00:00:24 --> 00:00:26
**Ubuntu 12.04** as the operating system
7
00:00:27 --> 00:00:30
and **Scilab 5.3.3** version.
8
00:00:31 --> 00:00:33
To practice this tutorial, a learner should have
9
00:00:34 --> 00:00:35
basic knowledge of **Scilab**
10
00:00:36 --> 00:00:39
and should know **Numerical Interpolation**.
11
00:00:40 --> 00:00:46
To learn **Scilab,** please refer to the relevant tutorials available on the **Spoken Tutorial** website.
12
00:00:47 --> 00:00:50
**Numerical interpolation** is a method of
13
00:00:51 --> 00:00:52
constructing new **data points**
14
00:00:53 --> 00:00:58
within the range of a **discrete set** of known **data points.**
15
00:00:59 --> 00:01:04
We can solve **interpolation** problems using **numerical methods.**
16
00:01:05 --> 00:01:06
In **Lagrange interpolation,**
17
00:01:07 --> 00:01:11
We pass a **polynomial** of **degree N – 1** through **N** points.
18
00:01:12 --> 00:01:21
Then, we find the unique **N order polynomial y of x** which **interpolates** the **data** samples.
19
00:01:22 --> 00:01:28
We are given the **natural logarithm** values for nine, nine point five and eleven.
20
00:01:29 --> 00:01:34
We have to find the value of **natural logarithm** of nine point two.
21
00:01:35 --> 00:01:40
Let us solve this problem using **Lagrange interpolation method.**
22
00:01:41 --> 00:01:45
Let us look at the code for **Lagrange interpolation.**
23
00:01:46 --> 00:01:52
We define the function **Lagrange** with **arguments x zero, x, f and n.**
24
00:01:53 --> 00:01:56
**X zero** is the unknown **interpolation point.**
25
00:01:57 --> 00:02:00
**x** is the **vector** containing the **data points.**
26
00:02:01 --> 00:02:07
**f** is the **vector** containing the values of the **function** at corresponding **data points.**
27
00:02:08 --> 00:02:13
And **n** is the **order** of the **interpolating polynomial.**
28
00:02:14 --> 00:02:18
We use **n** to initialize **m** and **vector N.**
29
00:02:19 --> 00:02:24
The order of the **interpolating polynomial** determines the number of **nodes** created.
30
00:02:25 --> 00:02:28
Then, we apply **Lagrange interpolation formula**
31
00:02:29 --> 00:02:34
to find the value of the **numerator** and **denominator.**
32
00:02:35 --> 00:02:40
Then we divide the **numerator** and **denominator** to get the value of **L.**
33
00:02:41 --> 00:02:47
We use **L** to find the value of the function **y** at the given data point.
34
00:02:48 --> 00:02:52
Finally we display the value of **L** and **f of x** f(x).
35
00:02:53 --> 00:02:56
Let us **Save and execute** the file.
36
00:02:57 --> 00:03:01
Switch to **Scilab console** to solve the example problem.
37
00:03:02 --> 00:03:04
Let us define the **data points vector.**
38
00:03:05 --> 00:03:06
On the **console**, type:
39
00:03:07 --> 00:03:17
** x equal to open square bracket nine point zero comma nine point five comma eleven point zero close square bracket.**
40
00:03:18 --> 00:03:20
Press **Enter**.
41
00:03:21 --> 00:03:38
Then type: **f equal to open square bracket two point one nine seven two comma two point two five one three comma two point three nine seven nine close square bracket**
42
00:03:39 --> 00:03:40
Press **Enter **.
43
00:03:41 --> 00:03:45
Then type **x zero equal to nine point two**
44
00:03:46 --> 00:03:47
Press **Enter**.
45
00:03:48 --> 00:03:52
Let us use a **quadratic polynomial interpolating polynomial.**
46
00:03:53 --> 00:03:57
Type **n equal to two**.
47
00:03:58 --> 00:03:59
Press **Enter**.
48
00:04:00 --> 00:04:01
To call the **function,** type:
49
00:04:02 --> 00:04:13
**y equal to Lagrange open parenthesis x zero comma x comma f comma n close parenthesis**
50
00:04:14 --> 00:04:15
Press **Enter. **
51
00:04:16 --> 00:04:21
The value of the function **y at x equal to nine point two** is displayed.
52
00:04:22 --> 00:04:25
Let us look at **Newton's Divided Difference Method.**
53
00:04:26 --> 00:04:31
In this method, **Divided Differences recursive method** is used.
54
00:04:32 --> 00:04:37
It uses lesser number of **computation** than **Lagrange method.**
55
00:04:38 --> 00:04:46
In spite of this, the same **interpolating polynomial,** as in **Lagrange method,** is generated.
56
00:04:47 --> 00:04:51
Let us solve this example using **Divided Difference method.**
57
00:04:52 --> 00:04:53
We are given the **data points** and
58
00:04:54 --> 00:04:59
the corresponding values of the **function** at those **data points.**
59
00:05:00 --> 00:05:04
We have to find the value of the **function** at **x equal to three.**
60
00:05:05 --> 00:05:10
Let us look at the code for **Newton Divided Difference method. **
61
00:05:11 --> 00:05:17
Open the file **Newton underscore Divided dot sci** on **Scilab Editor.**
62
00:05:18 --> 00:05:28
We define the **function Newton underscore Divided** with **arguments x, f** and **x zero.**
63
00:05:29 --> 00:05:32
**x** is a **vector** containing the **data points,**
64
00:05:33 --> 00:05:35
**f** is the corresponding **function value** and
65
00:05:36 --> 00:05:40
**x zero** is the unknown **interpolation point.**
66
00:05:41 --> 00:05:45
We find the **length** of **vector** and then equate it to **n.**
67
00:05:46 --> 00:05:50
The first value of **vector** is equated to **a of one** a(1).
68
00:05:51 --> 00:05:56
Then we apply **divided difference algorithm** and compute the **divided difference table.**
69
00:05:57 --> 00:06:02
Then we find the **coefficient list** of the **Newton polynomial**.
70
00:06:03 --> 00:06:09
We **sum** the **coefficient list** to find the value of the **function** at given **data point.**
71
00:06:10 --> 00:06:15
**Save and execute** the file **Newton underscore Divided dot sci.**
72
00:06:16 --> 00:06:18
Switch to **Scilab console**.
73
00:06:19 --> 00:06:21
Clear the screen by typing **c l c**.
74
00:06:22 --> 00:06:23
Press **Enter.**
75
00:06:24 --> 00:06:26
Let us enter the **data points vector**.
76
00:06:27 --> 00:06:38
Type: **x equal to open square bracket two comma two point five comma three point two five comma four close square bracket**
77
00:06:39 --> 00:06:40
Press **Enter.**
78
00:06:41 --> 00:06:43
Then type values of the **function**
79
00:06:44 --> 00:07:00
**f equal to open square bracket zero point five comma zero point four comma zero point three zero seven seven comma zero point two five close square bracket**
80
00:07:01 --> 00:07:02
Press **Enter. **
81
00:07:03 --> 00:07:05
Type **x zero equal to three**
82
00:07:06 --> 00:07:07
Press **Enter.**
83
00:07:08 --> 00:07:10
Then call the **function** by typing
84
00:07:11 --> 00:07:22
**I P equal to Newton underscore Divided open parenthesis x comma f comma x zero close parenthesis**
85
00:07:23 --> 00:07:24
Press **Enter.**
86
00:07:25 --> 00:07:29
The value of **y at x equal to three** is shown.
87
00:07:30 --> 00:07:32
Let us summarize this tutorial.
88
00:07:33 --> 00:07:39
In this tutorial, we have learnt to develop **Scilab** code for **interpolation methods.**
89
00:07:40 --> 00:07:45
We have also learnt to find the value of a **function** at new **data point.**
90
00:07:46 --> 00:07:53
Solve this problem on your own using **Lagrange method and Newton's Divided Difference method.**
91
00:07:54 --> 00:07:56
Watch the video available at the link shown below.
92
00:07:57 --> 00:07:59
It summarizes the Spoken Tutorial project.
93
00:08:00 --> 00:08:04
If you do not have good bandwidth, you can download and watch it.
94
00:08:05 --> 00:08:06
The spoken tutorial project Team:
95
00:08:07 --> 00:08:09
Conducts workshops using spoken tutorials
96
00:08:10 --> 00:08:13
Gives certificates to those who pass an online test.
97
00:08:14 --> 00:08:21
For more details, please write to contact@spoken-tutorial.org
98
00:08:22 --> 00:08:25
Spoken Tutorial Project is a part of the Talk to a Teacher project.
99
00:08:26 --> 00:08:32
It is supported by the National Mission on Eduction through ICT, MHRD, Government of India.
100
00:08:33 --> 00:08:37
More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro.
101
00:08:38 --> 00:08:40
This is Ashwini Patil, signing off.
102
00:08:41 --> 00:08:46
Thank you for joining.