Difference between revisions of "Scilab/C4/ODE-Euler-methods/English-timed"
From Script | Spoken-Tutorial
PoojaMoolya (Talk | contribs) (Created page with '{| Border=1 || Time || Narration |- | 00.01 |Dear Friends, |- | 00.02 | Welcome to the Spoken Tutorial on '''“Solving ODEs using Euler Methods” ''' |- | 00.09 | At the …') |
PoojaMoolya (Talk | contribs) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{| Border=1 | {| Border=1 | ||
− | | | + | |'''Time''' |
− | + | |'''Narration''' | |
− | + | ||
|- | |- | ||
− | | 00 | + | | 00:01 |
− | |Dear Friends, | + | |Dear Friends, Welcome to the Spoken Tutorial on '''Solving ODEs using Euler Methods'''. |
|- | |- | ||
− | | 00 | + | | 00:09 |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
| At the end of this tutorial, you will learn how to: | | At the end of this tutorial, you will learn how to: | ||
|- | |- | ||
− | |00 | + | |00:12 |
|Solve '''ODEs''' using '''Euler''' and '''Modified Euler methods''' in '''Scilab''' | |Solve '''ODEs''' using '''Euler''' and '''Modified Euler methods''' in '''Scilab''' | ||
|- | |- | ||
− | |00 | + | |00:18 |
− | |Develop '''Scilab''' code to solve '''ODEs''' | + | |Develop '''Scilab''' code to solve '''ODEs'''. |
|- | |- | ||
− | | 00 | + | | 00:22 |
|To record this tutorial, I am using | |To record this tutorial, I am using | ||
|- | |- | ||
− | |00 | + | |00:25 |
|'''Ubuntu 12.04''' as the operating system | |'''Ubuntu 12.04''' as the operating system | ||
− | |||
|- | |- | ||
− | | 00 | + | | 00:28 |
− | |and '''Scilab 5.3.3''' version | + | |and '''Scilab 5.3.3''' version. |
|- | |- | ||
− | | 00 | + | | 00:32 |
− | | To | + | | To practice this tutorial, a learner |
|- | |- | ||
− | |00 | + | |00:34 |
|should have basic knowledge of '''Scilab''' | |should have basic knowledge of '''Scilab''' | ||
|- | |- | ||
− | |00 | + | |00:37 |
|and should know how to solve '''ODEs.''' | |and should know how to solve '''ODEs.''' | ||
|- | |- | ||
− | | 00 | + | | 00:40 |
| To learn '''Scilab,''' please refer to the relevant tutorials available on the '''Spoken Tutorial''' website. | | To learn '''Scilab,''' please refer to the relevant tutorials available on the '''Spoken Tutorial''' website. | ||
|- | |- | ||
− | | 00 | + | | 00:48 |
| In '''Euler method,''' we get an accurately approximate solution of the '''ODE.''' | | In '''Euler method,''' we get an accurately approximate solution of the '''ODE.''' | ||
|- | |- | ||
− | |00 | + | |00:55 |
|It is used to solve initial value problems where initial values of the '''differential equation''' are given. | |It is used to solve initial value problems where initial values of the '''differential equation''' are given. | ||
|- | |- | ||
− | |01 | + | |01:03 |
| It can be used to solve '''continuous functions.''' | | It can be used to solve '''continuous functions.''' | ||
|- | |- | ||
− | + | |01:08 | |
− | |01 | + | |
− | + | ||
|Let us solve an example using '''Euler method.''' | |Let us solve an example using '''Euler method.''' | ||
|- | |- | ||
− | + | |01:12 | |
− | |01 | + | |
|We are given an initial value problem - | |We are given an initial value problem - | ||
|- | |- | ||
− | + | | 01:15 | |
− | | 01 | + | |
− | + | ||
|'''y dash is equal to minus two t minus y.''' | |'''y dash is equal to minus two t minus y.''' | ||
− | |||
|- | |- | ||
− | + | | 01:20 | |
− | | 01 | + | ||The initial value of y is given as '''minus one'''(-1) |
− | ||The initial value of y is given as '''minus one''' | + | |
|- | |- | ||
− | + | |01:25 | |
− | |01 | + | || and the '''step length''' is given as '''zero point one'''(0.1). |
− | + | ||
− | || and the '''step length''' is given as '''zero point one | + | |
− | + | ||
|- | |- | ||
− | + | |01:29 | |
− | |01 | + | |
− | + | ||
| We have to find the value of '''y''' at time '''t equal to zero point five.''' | | We have to find the value of '''y''' at time '''t equal to zero point five.''' | ||
|- | |- | ||
− | |01 | + | |01:36 |
|Let us look at the code for '''Euler method.''' | |Let us look at the code for '''Euler method.''' | ||
− | |||
|- | |- | ||
− | + | |01:39 | |
− | |01 | + | |
− | + | ||
|Open '''Euler underscore o d e dot sci''' on '''Scilab editor.''' | |Open '''Euler underscore o d e dot sci''' on '''Scilab editor.''' | ||
|- | |- | ||
− | + | |01:47 | |
− | |01 | + | ||We define the function '''Euler underscore o d e''' with arguments '''f, t init, y init, h''' and '''N''' |
− | + | ||
− | + | ||
− | ||We define the function '''Euler underscore o d e with arguments f, t init, y init, h and | + | |
− | + | ||
|- | |- | ||
− | |01 | + | |01:58 |
− | |'where '''f''' denotes the function to be solved, | + | |'where: '''f''' denotes the function to be solved, |
− | + | ||
|- | |- | ||
− | + | | 02:01 | |
− | | 02 | + | |
|'''t init''' is the initial value of time '''t''', | |'''t init''' is the initial value of time '''t''', | ||
|- | |- | ||
− | + | |02:05 | |
− | |02 | + | ||'''y init''' is the initial value of '''y''', |
− | + | ||
− | ||'''y init''' is the initial value of '''y''' | + | |
|- | |- | ||
− | + | |02:09 | |
− | |02 | + | | '''h''' is the '''step length''' and '''n''' is the number of '''iterations.''' |
− | + | ||
− | | '''h''' is the '''step length | + | |
|- | |- | ||
− | + | |02:14 | |
− | |02 | + | | Then we initialize the values of '''t''' and '''y''' to vectors of '''zeros.''' |
− | + | ||
− | | Then we initialize the values of '''t''' and '''y to vectors of zeros. ''' | + | |
|- | |- | ||
− | + | | 02:21 | |
− | | 02 | + | |
− | + | ||
|| We place the initial values of '''t''' and '''y''' in '''t of one''' and '''y of one''' respectively. | || We place the initial values of '''t''' and '''y''' in '''t of one''' and '''y of one''' respectively. | ||
|- | |- | ||
− | | 02 | + | | 02:29 |
| Then we '''iterate''' from '''one to N''' to find the value of '''y'''. | | Then we '''iterate''' from '''one to N''' to find the value of '''y'''. | ||
|- | |- | ||
− | |02 | + | |02:33 |
| Here we apply '''Euler method''' to find the value of '''y. ''' | | Here we apply '''Euler method''' to find the value of '''y. ''' | ||
|- | |- | ||
− | |02 | + | |02:39 |
− | | Finally we end the '''function. ''' | + | | Finally we '''end''' the '''function.''' |
|- | |- | ||
− | | 02 | + | | 02:42 |
− | |Save and execute the file '''Euler underscore o d e dot sci''' | + | |'''Save and execute''' the file '''Euler underscore o d e dot sci'''. |
− | + | ||
|- | |- | ||
− | | 02 | + | | 02:49 |
|Switch to '''Scilab console''' to solve the example problem. | |Switch to '''Scilab console''' to solve the example problem. | ||
− | |||
− | |||
|- | |- | ||
− | | 02 | + | | 02:54 |
|We define the ''' function ''' by typing | |We define the ''' function ''' by typing | ||
− | |||
|- | |- | ||
− | | 02 | + | | 02:56 |
− | |'''d e f f open | + | |'''d e f f open parenthesis open single quote open square bracket y dot close square bracket equal to f of t comma y close single quote comma open single quote y dot equal to open parenthesis minus two asterisk t close parenthesis minus y close single quote close parenthesis ''' |
− | + | ||
|- | |- | ||
− | |03 | + | |03:26 |
|Press '''Enter. ''' | |Press '''Enter. ''' | ||
|- | |- | ||
− | |03 | + | |03:28 |
− | | Then type '''t init is equal to zero. ''' | + | | Then type: '''t init is equal to zero. ''' |
− | + | ||
|- | |- | ||
− | + | | 03:31 | |
− | | 03 | + | |Press '''Enter.''' |
− | + | ||
− | |Press '''Enter. ''' | + | |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | + | | 03:33 | |
− | | 03 | + | ||Type: '''y init is equal to minus one.''' |
− | ||Type '''y init is equal to minus one. | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | + | |03:38 | |
− | |03 | + | ||Press '''Enter '''. |
− | + | ||
− | ||Press '''Enter ''' | + | |
− | + | ||
|- | |- | ||
− | + | | 03:40 | |
− | | 03 | + | | Type: '''step length h is equal to zero point one.''' |
− | | Type '''step length h is equal to zero point one. ''' | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | + | | 03:44 | |
− | | 03 | + | | Press '''Enter'''. |
− | + | ||
− | | Press '''Enter''' | + | |
− | + | ||
|- | |- | ||
− | + | | 03:46 | |
− | | 03 | + | | The '''step length''' is zero point one and we have to find the value of '''y''' at '''zero point five.''' |
− | + | ||
− | | The '''step length is zero point one | + | |
− | + | ||
|- | |- | ||
− | + | |03:53 | |
− | |03 | + | |
− | + | ||
||So, the number of '''iterations''' should be '''five.''' | ||So, the number of '''iterations''' should be '''five.''' | ||
− | |||
|- | |- | ||
− | + | |03:59 | |
− | |03 | + | |
− | + | ||
|At each '''iteration,''' the value of '''t''' will be increased by '''zero point one.''' | |At each '''iteration,''' the value of '''t''' will be increased by '''zero point one.''' | ||
− | |||
|- | |- | ||
− | + | | 04:05 | |
− | | 04 | + | | So type capital '''N is equal to five''' (N=5) |
− | + | ||
− | | So type ''' | + | |
− | + | ||
− | + | ||
− | + | ||
|- | |- | ||
− | + | | 04:09 | |
− | | 04 | + | |and press '''Enter.''' |
− | + | ||
− | | | + | |
− | + | ||
|- | |- | ||
− | + | | 04:11 | |
− | | 04 | + | | To '''call''' the '''function,''' type: |
− | + | ||
− | | To '''call''' the '''function,''' type | + | |
|- | |- | ||
− | + | | 04:14 | |
− | | 04 | + | | '''open square bracket t comma y close square bracket equal to Euler underscore o d e open parenthesis f comma t init comma y init comma h comma capital N close parenthesis ''' |
− | + | ||
− | | '''open square bracket t comma y close square bracket equal to Euler underscore o d e open | + | |
|- | |- | ||
− | + | | 04:33 | |
− | | 04 | + | |
− | + | ||
||Press '''Enter.''' | ||Press '''Enter.''' | ||
− | |||
|- | |- | ||
− | + | | 04:35 | |
− | | 04 | + | |
− | + | ||
||The value of '''y at t equal to zero point five''' is shown. | ||The value of '''y at t equal to zero point five''' is shown. | ||
|- | |- | ||
− | + | | 04:41 | |
− | | 04 | + | |
− | + | ||
||Now let us look at '''Modified Euler method. ''' | ||Now let us look at '''Modified Euler method. ''' | ||
|- | |- | ||
− | + | | 04:45 | |
− | | 04 | + | |
− | + | ||
|It is a '''second order method''' and is a '''stable two step method. ''' | |It is a '''second order method''' and is a '''stable two step method. ''' | ||
− | |||
|- | |- | ||
− | + | | 04:51 | |
− | | 04 | + | |
− | + | ||
|We find the '''average''' of the '''function''' at the beginning and end of '''time step.''' | |We find the '''average''' of the '''function''' at the beginning and end of '''time step.''' | ||
− | |||
|- | |- | ||
− | + | |04:56 | |
− | |04 | + | |
− | + | ||
|Let us solve this example using '''Modified Euler method.''' | |Let us solve this example using '''Modified Euler method.''' | ||
− | |||
− | |||
|- | |- | ||
− | + | | 05:02 | |
− | | 05 | + | |
− | + | ||
|We are given a '''function y dash is equal to t plus y plus t y. ''' | |We are given a '''function y dash is equal to t plus y plus t y. ''' | ||
− | |||
− | |||
− | |||
|- | |- | ||
− | + | | 05:08 | |
− | | 05 | + | |
− | + | ||
| The initial value of '''y''' is '''one''' | | The initial value of '''y''' is '''one''' | ||
|- | |- | ||
− | + | | 05:12 | |
− | | 05 | + | |
− | + | ||
| and the '''step length''' is '''zero point zero one.''' | | and the '''step length''' is '''zero point zero one.''' | ||
|- | |- | ||
− | + | | 05:16 | |
− | | 05 | + | |
− | + | ||
|We have to find the value of '''y''' at '''time t equal to zero point one ''' using '''Modified Euler's method.''' | |We have to find the value of '''y''' at '''time t equal to zero point one ''' using '''Modified Euler's method.''' | ||
− | |||
− | |||
|- | |- | ||
− | | 05 | + | | 05:25 |
− | | Let us look at the code for '''Modified Euler method on Scilab Editor''' | + | | Let us look at the code for '''Modified Euler method''' on '''Scilab Editor'''. |
|- | |- | ||
− | | 05 | + | | 05:31 |
− | |We define the '''function''' with '''arguments f, t init, y init, h and n''' | + | |We define the '''function''' with '''arguments f, t init, y init, h''' and '''n''' |
|- | |- | ||
− | + | | 05:39 | |
− | | 05 | + | | where: '''f''' is the '''function''' to be solved, |
− | + | ||
− | | ''' | + | |
− | + | ||
|- | |- | ||
− | + | | 05:42 | |
− | | 05 | + | |
− | + | ||
| '''t init''' is the intial '''time''' value, | | '''t init''' is the intial '''time''' value, | ||
|- | |- | ||
− | + | | 05:45 | |
− | | 05 | + | | '''y init''' is the inital value of '''y''', |
− | + | ||
− | | '''y init''' is the inital value of '''y''' | + | |
|- | |- | ||
− | + | | 05:49 | |
− | | 05 | + | |
− | + | ||
| '''h''' is the '''step length''' and | | '''h''' is the '''step length''' and | ||
− | |||
− | |||
|- | |- | ||
− | + | | 05:51 | |
− | | 05 | + | | '''N''' is the number of '''iterations.''' |
− | + | ||
− | | ''' | + | |
|- | |- | ||
− | + | | 05:54 | |
− | | 05 | + | |
− | + | ||
| Then we initialize the '''arrays''' for '''y''' and '''t.''' | | Then we initialize the '''arrays''' for '''y''' and '''t.''' | ||
|- | |- | ||
− | + | | 05:58 | |
− | | 05 | + | |
− | + | ||
|We place the initial values of '''t''' and '''y''' in '''t of one''' and '''y of one''' respectively. | |We place the initial values of '''t''' and '''y''' in '''t of one''' and '''y of one''' respectively. | ||
|- | |- | ||
− | + | | 06:07 | |
− | | 06 | + | |
− | + | ||
|We implement '''Modified Euler Method''' here. | |We implement '''Modified Euler Method''' here. | ||
− | |||
|- | |- | ||
− | + | | 06:11 | |
− | | 06 | + | |
− | + | ||
|Here we find the average value of '''y''' at the beginning and end of '''time step.''' | |Here we find the average value of '''y''' at the beginning and end of '''time step.''' | ||
|- | |- | ||
− | + | | 06:17 | |
− | | 06 | + | |'''Save and execute''' the file '''Modi Euler underscore o d e dot sci.''' |
− | + | ||
− | |Save and execute the file '''Modi Euler underscore o d e dot sci.''' | + | |
|- | |- | ||
− | + | | 06:23 | |
− | | 06 | + | |
− | + | ||
|Switch to '''Scilab console.''' | |Switch to '''Scilab console.''' | ||
|- | |- | ||
− | + | | 06:26 | |
− | | 06 | + | |
− | + | ||
|Clear the screen by typing '''c l c.''' | |Clear the screen by typing '''c l c.''' | ||
|- | |- | ||
− | + | | 06:30 | |
− | | 06 | + | |
− | + | ||
|Press '''Enter.''' | |Press '''Enter.''' | ||
− | |||
|- | |- | ||
− | + | | 06:32 | |
− | | 06 | + | |Define the '''function''' by typing '''d e f f open parenthesis open single quote open square bracket y dot close square bracket equal to f of t comma y close single quote comma open single quote y dot equal to t plus y plus t asterisk y close single quote close parenthesis''' |
− | |Define the '''function''' by typing '''d e f f open | + | |
|- | |- | ||
− | + | | 07:01 | |
− | | 07 | + | |
− | + | ||
|Press '''Enter.''' | |Press '''Enter.''' | ||
− | |||
|- | |- | ||
− | + | | 07:03 | |
− | | 07 | + | |Then type: '''t init equal to zero''', press Enter. |
− | + | ||
− | |Then type '''t init equal to zero''', press Enter | + | |
− | + | ||
|- | |- | ||
− | + | | 07:08 | |
− | | 07 | + | |Type: '''y init equal to one''' and press '''Enter.''' |
− | + | ||
− | |Type '''y init equal to one''' and press '''Enter.''' | + | |
− | + | ||
|- | |- | ||
− | + | | 07:12 | |
− | | 07 | + | |Then type: '''h equal to zero point zero one''' press '''Enter.''' |
− | + | ||
− | |Then type '''h equal to zero point zero one''' press '''Enter.''' | + | |
|- | |- | ||
− | + | | 07:19 | |
− | | 07 | + | |Type: capital '''N equal to ten''' |
− | + | ||
− | |Type ''' | + | |
− | + | ||
|- | |- | ||
− | + | | 07:22 | |
− | | 07 | + | |since the number of '''iterations''' should be '''ten''' to '''time t equal to zero point one''' with '''step length''' of '''zero point zero one.''' |
− | + | ||
− | | | + | |
|- | |- | ||
− | + | | 07:34 | |
− | | 07 | + | |
− | + | ||
|Press '''Enter.''' | |Press '''Enter.''' | ||
|- | |- | ||
− | + | | 07:36 | |
− | | 07 | + | |Then call the '''function Modi Euler underscore o d e''' by typing: |
− | + | ||
− | |Then call the '''function | + | |
|- | |- | ||
− | + | | 07:41 | |
− | | 07 | + | |'''open square bracket t comma y close square bracket equal to Modi Euler underscore o d e open parenthesis f comma t init comma y init comma h comma capital N close parenthesis''' |
− | + | ||
− | |'''open square bracket t comma y close square bracket equal to | + | |
− | + | ||
|- | |- | ||
− | + | | 08:03 | |
− | | 08 | + | |
− | + | ||
|Press '''Enter. ''' | |Press '''Enter. ''' | ||
− | |||
|- | |- | ||
− | + | | 08:05 | |
− | | 08 | + | |
− | + | ||
|The value of '''y at t equal to zero point one''' is shown. | |The value of '''y at t equal to zero point one''' is shown. | ||
|- | |- | ||
− | + | | 08:10 | |
− | | 08 | + | |
− | + | ||
|Let us summarize this tutorial. | |Let us summarize this tutorial. | ||
|- | |- | ||
− | + | | 08:14 | |
− | | 08 | + | |
− | + | ||
|In this tutorial we have learnt to develop Scilab code for '''Euler''' and '''modified Euler methods.''' | |In this tutorial we have learnt to develop Scilab code for '''Euler''' and '''modified Euler methods.''' | ||
|- | |- | ||
− | + | | 08:21 | |
− | | 08 | + | |
− | + | ||
|We have also learnt to solve '''ODEs''' using these methods in '''Scilab.''' | |We have also learnt to solve '''ODEs''' using these methods in '''Scilab.''' | ||
− | |||
− | |||
|- | |- | ||
− | |08 | + | |08:28 |
− | | Watch the video available at the link shown below | + | | Watch the video available at the link shown below. |
|- | |- | ||
− | + | | 08:32 | |
− | | 08 | + | | It summarizes the Spoken Tutorial project. |
− | + | ||
− | | It | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | + | |08:35 | |
− | |08 | + | ||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 | + | |
|- | |- | ||
− | + | |08:40 | |
− | |08 | + | ||The spoken tutorial project Team: |
− | + | ||
− | ||The spoken tutorial project Team | + | |
|- | |- | ||
− | + | |08:42 | |
− | |08 | + | ||Conducts workshops using spoken tutorials. |
− | + | ||
− | ||Conducts workshops using spoken tutorials | + | |
− | + | ||
|- | |- | ||
− | + | |08:45 | |
− | |08 | + | ||Gives certificates to those who pass an online test. |
− | + | ||
− | ||Gives certificates to those who pass an online test | + | |
− | + | ||
|- | |- | ||
− | + | |08:49 | |
− | |08 | + | ||For more details, please write to contact@spoken-tutorial.org. |
− | + | ||
− | ||For more details, please write to contact@spoken-tutorial.org | + | |
− | + | ||
|- | |- | ||
− | + | |08:55 | |
− | |08 | + | |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 | + | |
− | + | ||
− | + | ||
|- | |- | ||
− | + | | 09:00 | |
− | | 09 | + | |
− | + | ||
| It is supported by the National Mission on Eduction through ICT, MHRD, Government of India. | | It is supported by the National Mission on Eduction through ICT, MHRD, Government of India. | ||
|- | |- | ||
− | + | | 09:07 | |
− | | 09 | + | |More information on this mission is available at the link shown below. |
− | + | ||
− | |More information on this mission is available at the link shown below | + | |
|- | |- | ||
− | + | | 09:13 | |
− | | 09 | + | |This is Ashwini Patil, signing off. |
− | + | ||
− | |This is Ashwini Patil signing off. | + | |
|- | |- | ||
− | + | |09:15 | |
− | |09 | + | |
− | + | ||
| Thank you for joining. | | Thank you for joining. |
Latest revision as of 11:16, 10 March 2017
Time | Narration |
00:01 | Dear Friends, Welcome to the Spoken Tutorial on Solving ODEs using Euler Methods. |
00:09 | At the end of this tutorial, you will learn how to: |
00:12 | Solve ODEs using Euler and Modified Euler methods in Scilab |
00:18 | Develop Scilab code to solve ODEs. |
00:22 | To record this tutorial, I am using |
00:25 | Ubuntu 12.04 as the operating system |
00:28 | and Scilab 5.3.3 version. |
00:32 | To practice this tutorial, a learner |
00:34 | should have basic knowledge of Scilab |
00:37 | and should know how to solve ODEs. |
00:40 | To learn Scilab, please refer to the relevant tutorials available on the Spoken Tutorial website. |
00:48 | In Euler method, we get an accurately approximate solution of the ODE. |
00:55 | It is used to solve initial value problems where initial values of the differential equation are given. |
01:03 | It can be used to solve continuous functions. |
01:08 | Let us solve an example using Euler method. |
01:12 | We are given an initial value problem - |
01:15 | y dash is equal to minus two t minus y. |
01:20 | The initial value of y is given as minus one(-1) |
01:25 | and the step length is given as zero point one(0.1). |
01:29 | We have to find the value of y at time t equal to zero point five. |
01:36 | Let us look at the code for Euler method. |
01:39 | Open Euler underscore o d e dot sci on Scilab editor. |
01:47 | We define the function Euler underscore o d e with arguments f, t init, y init, h and N |
01:58 | 'where: f denotes the function to be solved, |
02:01 | t init is the initial value of time t, |
02:05 | y init is the initial value of y, |
02:09 | h is the step length and n is the number of iterations. |
02:14 | Then we initialize the values of t and y to vectors of zeros. |
02:21 | We place the initial values of t and y in t of one and y of one respectively. |
02:29 | Then we iterate from one to N to find the value of y. |
02:33 | Here we apply Euler method to find the value of y. |
02:39 | Finally we end the function. |
02:42 | Save and execute the file Euler underscore o d e dot sci. |
02:49 | Switch to Scilab console to solve the example problem. |
02:54 | We define the function by typing |
02:56 | d e f f open parenthesis open single quote open square bracket y dot close square bracket equal to f of t comma y close single quote comma open single quote y dot equal to open parenthesis minus two asterisk t close parenthesis minus y close single quote close parenthesis |
03:26 | Press Enter. |
03:28 | Then type: t init is equal to zero. |
03:31 | Press Enter. |
03:33 | Type: y init is equal to minus one. |
03:38 | Press Enter . |
03:40 | Type: step length h is equal to zero point one. |
03:44 | Press Enter. |
03:46 | The step length is zero point one and we have to find the value of y at zero point five. |
03:53 | So, the number of iterations should be five. |
03:59 | At each iteration, the value of t will be increased by zero point one. |
04:05 | So type capital N is equal to five (N=5) |
04:09 | and press Enter. |
04:11 | To call the function, type: |
04:14 | open square bracket t comma y close square bracket equal to Euler underscore o d e open parenthesis f comma t init comma y init comma h comma capital N close parenthesis |
04:33 | Press Enter. |
04:35 | The value of y at t equal to zero point five is shown. |
04:41 | Now let us look at Modified Euler method. |
04:45 | It is a second order method and is a stable two step method. |
04:51 | We find the average of the function at the beginning and end of time step. |
04:56 | Let us solve this example using Modified Euler method. |
05:02 | We are given a function y dash is equal to t plus y plus t y. |
05:08 | The initial value of y is one |
05:12 | and the step length is zero point zero one. |
05:16 | We have to find the value of y at time t equal to zero point one using Modified Euler's method. |
05:25 | Let us look at the code for Modified Euler method on Scilab Editor. |
05:31 | We define the function with arguments f, t init, y init, h and n |
05:39 | where: f is the function to be solved, |
05:42 | t init is the intial time value, |
05:45 | y init is the inital value of y, |
05:49 | h is the step length and |
05:51 | N is the number of iterations. |
05:54 | Then we initialize the arrays for y and t. |
05:58 | We place the initial values of t and y in t of one and y of one respectively. |
06:07 | We implement Modified Euler Method here. |
06:11 | Here we find the average value of y at the beginning and end of time step. |
06:17 | Save and execute the file Modi Euler underscore o d e dot sci. |
06:23 | Switch to Scilab console. |
06:26 | Clear the screen by typing c l c. |
06:30 | Press Enter. |
06:32 | Define the function by typing d e f f open parenthesis open single quote open square bracket y dot close square bracket equal to f of t comma y close single quote comma open single quote y dot equal to t plus y plus t asterisk y close single quote close parenthesis |
07:01 | Press Enter. |
07:03 | Then type: t init equal to zero, press Enter. |
07:08 | Type: y init equal to one and press Enter. |
07:12 | Then type: h equal to zero point zero one press Enter. |
07:19 | Type: capital N equal to ten |
07:22 | since the number of iterations should be ten to time t equal to zero point one with step length of zero point zero one. |
07:34 | Press Enter. |
07:36 | Then call the function Modi Euler underscore o d e by typing: |
07:41 | open square bracket t comma y close square bracket equal to Modi Euler underscore o d e open parenthesis f comma t init comma y init comma h comma capital N close parenthesis |
08:03 | Press Enter. |
08:05 | The value of y at t equal to zero point one is shown. |
08:10 | Let us summarize this tutorial. |
08:14 | In this tutorial we have learnt to develop Scilab code for Euler and modified Euler methods. |
08:21 | We have also learnt to solve ODEs using these methods in Scilab. |
08:28 | Watch the video available at the link shown below. |
08:32 | It summarizes the Spoken Tutorial project. |
08:35 | If you do not have good bandwidth, you can download and watch it. |
08:40 | The spoken tutorial project Team: |
08:42 | Conducts workshops using spoken tutorials. |
08:45 | Gives certificates to those who pass an online test. |
08:49 | For more details, please write to contact@spoken-tutorial.org. |
08:55 | Spoken Tutorial Project is a part of the Talk to a Teacher project. |
09:00 | It is supported by the National Mission on Eduction through ICT, MHRD, Government of India. |
09:07 | More information on this mission is available at the link shown below. |
09:13 | This is Ashwini Patil, signing off. |
09:15 | Thank you for joining. |