Difference between revisions of "Scilab/C4/Interpolation/English-timed"
From Script | Spoken-Tutorial
Sandhya.np14 (Talk | contribs) |
|||
Line 10: | Line 10: | ||
|- | |- | ||
| 00:02 | | 00:02 | ||
− | | Welcome to the Spoken Tutorial on ''' | + | | Welcome to the Spoken Tutorial on '''Numerical Interpolation'''. |
|- | |- | ||
Line 22: | Line 22: | ||
|- | |- | ||
|00:16 | |00:16 | ||
− | |Calculate new value of '''function''' from given '''data points''' | + | |Calculate new value of '''function''' from given '''data points'''. |
|- | |- | ||
Line 34: | Line 34: | ||
|- | |- | ||
| 00:27 | | 00:27 | ||
− | |and '''Scilab 5.3.3''' version | + | |and '''Scilab 5.3.3''' version. |
|- | |- | ||
| 00:31 | | 00:31 | ||
− | | To | + | | To practice this tutorial, a learner should have |
|- | |- | ||
Line 46: | Line 46: | ||
|- | |- | ||
|00:36 | |00:36 | ||
− | |and should know '''Numerical Interpolation''' | + | |and should know '''Numerical Interpolation'''. |
|- | |- | ||
Line 85: | Line 85: | ||
| 01:12 | | 01:12 | ||
− | ||Then, we find the unique '''N order polynomial y of x'''which '''interpolates''' the '''data''' samples. | + | ||Then, we find the unique '''N order polynomial y of x''' which '''interpolates''' the '''data''' samples. |
|- | |- | ||
Line 126: | Line 126: | ||
| 02:01 | | 02:01 | ||
− | |'''f''' is the '''vector''' containing the values of the '''function''' at | + | |'''f''' is the '''vector''' containing the values of the '''function''' at corresponding '''data points.''' |
− | + | ||
|- | |- | ||
Line 151: | Line 150: | ||
|| Then, we apply '''Lagrange interpolation formula''' | || Then, we apply '''Lagrange interpolation formula''' | ||
− | |||
|- | |- | ||
Line 171: | Line 169: | ||
|- | |- | ||
| 02:53 | | 02:53 | ||
− | |Let us save and execute the file | + | |Let us save and execute the file. |
|- | |- | ||
Line 183: | Line 181: | ||
|- | |- | ||
|03:05 | |03:05 | ||
− | | On the '''console''' | + | | On the '''console''', type: |
|- | |- | ||
Line 193: | Line 191: | ||
| 03:18 | | 03:18 | ||
− | |Press '''Enter''' | + | |Press '''Enter'''. |
|- | |- | ||
| 03:21 | | 03:21 | ||
− | ||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''' | + | ||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''' |
|- | |- | ||
Line 204: | Line 202: | ||
|03:39 | |03:39 | ||
− | ||Press '''Enter ''' | + | ||Press '''Enter '''. |
− | + | ||
|- | |- | ||
Line 211: | Line 208: | ||
| 03:41 | | 03:41 | ||
| Then type '''x zero equal to nine point two''' | | Then type '''x zero equal to nine point two''' | ||
− | |||
− | |||
|- | |- | ||
Line 218: | Line 213: | ||
| 03:46 | | 03:46 | ||
− | | Press '''Enter''' | + | | Press '''Enter'''. |
− | + | ||
|- | |- | ||
Line 226: | Line 220: | ||
| Let us use a '''quadratic polynomial interpolating polynomial.''' | | Let us use a '''quadratic polynomial interpolating polynomial.''' | ||
− | |||
|- | |- | ||
Line 232: | Line 225: | ||
|03:53 | |03:53 | ||
− | ||Type '''n equal to two''' | + | ||Type '''n equal to two'''. |
Line 239: | Line 232: | ||
|03:58 | |03:58 | ||
− | |Press '''Enter''' | + | |Press '''Enter'''. |
− | + | ||
|- | |- | ||
Line 246: | Line 238: | ||
| 04:00 | | 04:00 | ||
− | | To call the '''function,''' type | + | | To call the '''function,''' type: |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
Line 255: | Line 244: | ||
| 04:02 | | 04:02 | ||
− | |'''y equal to Lagrange open | + | |'''y equal to Lagrange open parenthesis x zero comma x comma f comma n close parenthesis''' |
− | + | ||
− | + | ||
|- | |- | ||
Line 276: | Line 263: | ||
||Let us look at '''Newton's Divided Difference Method.''' | ||Let us look at '''Newton's Divided Difference Method.''' | ||
− | |||
|- | |- | ||
Line 295: | Line 281: | ||
|In spite of this, the same '''interpolating polynomial,''' as in '''Lagrange method,''' is generated. | |In spite of this, the same '''interpolating polynomial,''' as in '''Lagrange method,''' is generated. | ||
− | |||
− | |||
|- | |- | ||
Line 303: | Line 287: | ||
|Let us solve this example using '''Divided Difference method.''' | |Let us solve this example using '''Divided Difference method.''' | ||
− | |||
|- | |- | ||
Line 310: | Line 293: | ||
|We are given the '''data points''' and | |We are given the '''data points''' and | ||
− | |||
− | |||
|- | |- | ||
Line 318: | Line 299: | ||
| the corresponding values of the '''function''' at those '''data points.''' | | the corresponding values of the '''function''' at those '''data points.''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
Line 339: | Line 317: | ||
|Open the file '''Newton underscore Divided dot sci''' on '''Scilab Editor.''' | |Open the file '''Newton underscore Divided dot sci''' on '''Scilab Editor.''' | ||
− | |||
|- | |- | ||
Line 346: | Line 323: | ||
|We define the '''function Newton underscore Divided''' with '''arguments x, f''' and '''x zero.''' | |We define the '''function Newton underscore Divided''' with '''arguments x, f''' and '''x zero.''' | ||
− | |||
|- | |- | ||
Line 353: | Line 329: | ||
| '''x''' is a '''vector''' containing the '''data points,''' | | '''x''' is a '''vector''' containing the '''data points,''' | ||
− | |||
|- | |- | ||
Line 360: | Line 335: | ||
|'''f''' is the corresponding '''function value''' and | |'''f''' is the corresponding '''function value''' and | ||
− | |||
− | |||
|- | |- | ||
Line 386: | Line 359: | ||
| 05:57 | | 05:57 | ||
− | | Then we find the '''coefficient list''' of the '''Newton polynomial''' | + | | Then we find the '''coefficient list''' of the '''Newton polynomial'''. |
|- | |- | ||
Line 393: | Line 366: | ||
| We sum the '''coefficient list''' to find the value of the '''function''' at given '''data point.''' | | We sum the '''coefficient list''' to find the value of the '''function''' at given '''data point.''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
Line 407: | Line 377: | ||
| 06:16 | | 06:16 | ||
− | | Switch to '''Scilab console''' | + | | Switch to '''Scilab console'''. |
|- | |- | ||
| 06:19 | | 06:19 | ||
− | |Clear the screen by typing '''c l c''' | + | |Clear the screen by typing '''c l c'''. |
|- | |- | ||
Line 419: | Line 389: | ||
|Press '''Enter.''' | |Press '''Enter.''' | ||
− | |||
|- | |- | ||
Line 425: | Line 394: | ||
| 06:24 | | 06:24 | ||
− | |Let us enter the '''data points vector''' | + | |Let us enter the '''data points vector'''. |
|- | |- | ||
Line 431: | Line 400: | ||
| 06:27 | | 06:27 | ||
− | |Type '''x equal to open square bracket two comma two point five comma three point two five comma four close square bracket ''' | + | |Type: '''x equal to open square bracket two comma two point five comma three point two five comma four close square bracket ''' |
|- | |- | ||
Line 477: | Line 446: | ||
|'''i p equal to Newton underscore Divided open parenthesis x comma f comma x zero close parenthesis''' | |'''i p equal to Newton underscore Divided open parenthesis x comma f comma x zero close parenthesis''' | ||
− | |||
|- | |- | ||
Line 502: | Line 470: | ||
|In this tutorial, | |In this tutorial, | ||
− | |||
|- | |- | ||
Line 509: | Line 476: | ||
|we have learnt to develop '''Scilab''' code for '''interpolation methods.''' | |we have learnt to develop '''Scilab''' code for '''interpolation methods.''' | ||
− | |||
|- | |- | ||
Line 522: | Line 488: | ||
|Solve this problem on your own using '''Lagrange method and Newton's Divided Difference method.''' | |Solve this problem on your own using '''Lagrange method and Newton's Divided Difference method.''' | ||
− | |||
− | |||
|- | |- | ||
|07:54 | |07:54 | ||
− | | Watch the video available at the link shown below | + | | Watch the video available at the link shown below. |
|- | |- | ||
Line 533: | Line 497: | ||
| 07:57 | | 07:57 | ||
− | | It | + | | It summarizes the Spoken Tutorial project. |
− | + | ||
− | + | ||
|- | |- | ||
Line 541: | Line 503: | ||
|08:00 | |08:00 | ||
− | ||If you do not have good bandwidth, you can download and watch it | + | ||If you do not have good bandwidth, you can download and watch it. |
|- | |- | ||
Line 547: | Line 509: | ||
|08:05 | |08:05 | ||
− | ||The spoken tutorial project Team | + | ||The spoken tutorial project Team: |
|- | |- | ||
Line 554: | Line 516: | ||
||Conducts workshops using spoken tutorials | ||Conducts workshops using spoken tutorials | ||
− | |||
|- | |- | ||
Line 560: | Line 521: | ||
|08:10 | |08:10 | ||
− | ||Gives certificates to those who pass an online test | + | ||Gives certificates to those who pass an online test. |
− | + | ||
|- | |- | ||
Line 568: | Line 528: | ||
||For more details, please write to contact@spoken-tutorial.org | ||For more details, please write to contact@spoken-tutorial.org | ||
− | |||
|- | |- | ||
Line 574: | Line 533: | ||
|08:22 | |08:22 | ||
− | |Spoken Tutorial Project is a part of the Talk to a Teacher project | + | |Spoken Tutorial Project is a part of the Talk to a Teacher project. |
− | + | ||
− | + | ||
|- | |- | ||
Line 587: | Line 544: | ||
| 08:33 | | 08:33 | ||
− | |More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro | + | |More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro. |
|- | |- | ||
Line 593: | Line 550: | ||
| 08:38 | | 08:38 | ||
− | |This is Ashwini Patil signing off. | + | |This is Ashwini Patil, signing off. |
|- | |- |
Revision as of 11:04, 2 March 2015
Time | Narration |
00:01 | Dear Friends, |
00:02 | Welcome to the Spoken Tutorial on Numerical Interpolation. |
00:06 | At the end of this tutorial, you will learn how to: |
00:10 | Develop Scilab code for different Numerical Interpolation algorithms |
00:16 | Calculate new value of function from given data points. |
00:21 | To record this tutorial, I am using |
00:24 | Ubuntu 12.04 as the operating system |
00:27 | and Scilab 5.3.3 version. |
00:31 | To practice this tutorial, a learner should have |
00:34 | basic knowledge of Scilab |
00:36 | and should know Numerical Interpolation. |
00:40 | To learn Scilab, please refer to the relevant tutorials available on the Spoken Tutorial website. Spoken Tutorial website. |
00:47 | Numerical interpolation is a method of |
00:51 | constructing new data points |
00:53 | within the range of a discrete set of known data points. |
00:59 | We can solve interpolation problems using numerical methods. |
01:05 | In Lagrange interpolation, |
01:07 | We pass a polynomial of degree N – 1 through N points. |
01:12 | Then, we find the unique N order polynomial y of x which interpolates the data samples. |
01:22 | We are given the natural logarithm values for nine, nine point five and eleven. |
01:29 | We have to find the value of natural logarithm of nine point two. |
01:35 | Let us solve this problem using Lagrange interpolation method. |
01:41 | Let us look at the code for Lagrange interpolation. |
01:46 | We define the function Lagrange with arguments x zero, x, f and n. |
01:53 | X zero is the unknown interpolation point. |
01:57 | x is the vector containing the data points. |
02:01 | f is the vector containing the values of the function at corresponding data points. |
02:08 | And n is the order of the interpolating polynomial. |
02:14 | We use n to initialize m and vector N. |
02:19 | The order of the interpolating polynomial determines the number of nodes created. |
02:25 | Then, we apply Lagrange interpolation formula |
02:29 | to find the value of the numerator and denominator. |
02:35 | Then we divide the numerator and denominator to get the value of L. |
02:41 | We use L to find the value of the function y at the given data point. |
02:48 | Finally we display the value of L and f of x. |
02:53 | Let us save and execute the file. |
02:57 | Switch to Scilab console to solve the example problem. |
03:02 | Let us define the data points vector. |
03:05 | On the console, type: |
03:07 | x equal to open square bracket nine point zero comma nine point five comma eleven point zero close square bracket. |
03:18 | Press Enter. |
03:21 | 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 |
03:39 | Press Enter . |
03:41 | Then type x zero equal to nine point two |
03:46 | Press Enter. |
03:48 | Let us use a quadratic polynomial interpolating polynomial. |
03:53 | Type n equal to two.
|
03:58 | Press Enter. |
04:00 | To call the function, type: |
04:02 | y equal to Lagrange open parenthesis x zero comma x comma f comma n close parenthesis |
04:14 | Press Enter. |
04:16 | The value of the function y at x equal to nine point two is displayed. |
04:22 | Let us look at Newton's Divided Difference Method. |
04:26 | In this method, Divided Differences recursive method is used. |
04:32 | It uses lesser number of computation than Lagrange method. |
04:38 | In spite of this, the same interpolating polynomial, as in Lagrange method, is generated. |
04:47 | Let us solve this example using Divided Difference method. |
04:52 | We are given the data points and |
04:54 | the corresponding values of the function at those data points. |
05:00 | We have to find the value of the function at x equal to three. |
05:05 | Let us look at the code for Newton Divided Difference method. |
05:11 | Open the file Newton underscore Divided dot sci on Scilab Editor. |
05:18 | We define the function Newton underscore Divided with arguments x, f and x zero. |
05:29 | x is a vector containing the data points, |
05:33 | f is the corresponding function value and |
05:36 | x zero is the unknown interpolation point. |
05:41 | We find the length of vector and then equate it to n. |
05:46 | The first value of vector is equated to a of one. |
05:51 | Then we apply divided difference algorithm and compute the divided difference table. |
05:57 | Then we find the coefficient list of the Newton polynomial. |
06:03 | We sum the coefficient list to find the value of the function at given data point. |
06:10 | Save and execute the file Newton underscore Divided dot sci. |
06:16 | Switch to Scilab console. |
06:19 | Clear the screen by typing c l c. |
06:22 | Press Enter. |
06:24 | Let us enter the data points vector. |
06:27 | Type: x equal to open square bracket two comma two point five comma three point two five comma four close square bracket |
06:39 | Press Enter. |
06:41 | Then type values of the function |
06:44 | 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 |
07:01 | Press Enter. |
07:03 | Type x zero equal to three |
07:06 | Press Enter. |
07:08 | Then call the function by typing |
07:11 | i p equal to Newton underscore Divided open parenthesis x comma f comma x zero close parenthesis |
07:23 | Press Enter. |
07:25 | The value of y at x equal to three is shown. |
07:30 | Let us summarize this tutorial. |
07:33 | In this tutorial, |
07:34 | we have learnt to develop Scilab code for interpolation methods. |
07:40 | We have also learnt to find the value of a function at new data point. |
07:46 | Solve this problem on your own using Lagrange method and Newton's Divided Difference method. |
07:54 | Watch the video available at the link shown below. |
07:57 | It summarizes the Spoken Tutorial project. |
08:00 | If you do not have good bandwidth, you can download and watch it. |
08:05 | The spoken tutorial project Team: |
08:07 | Conducts workshops using spoken tutorials |
08:10 | Gives certificates to those who pass an online test. |
08:14 | For more details, please write to contact@spoken-tutorial.org |
08:22 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
08:26 | It is supported by the National Mission on Eduction through ICT, MHRD, Government of India. |
08:33 | More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro. |
08:38 | This is Ashwini Patil, signing off. |
08:41 | Thank you for joining. |