**Narration**
1
00:00:01 --> 00:00:09
Dear Friends, Welcome to the spoken tutorial on ** “Solving Nonlinear Equations using Numerical Methods” **
2
00:00:10 --> 00:00:12
At the end of this tutorial, you will learn how to:
3
00:00:13 --> 00:00:17
Solve **nonlinear equations** using numerical methods
4
00:00:18 --> 00:00:19
The methods we will be studying are
5
00:00:20 --> 00:00:21
**Bisection method and **
6
00:00:22 --> 00:00:22
**Secant method**
7
00:00:23 --> 00:00:29
We will also develop **Scilab** code to solve **nonlinear equations.**
8
00:00:30 --> 00:00:31
To record this tutorial, I am using
9
00:00:32 --> 00:00:35
**Ubuntu 12.04 **as the operating system and
10
00:00:36 --> 00:00:39
**Scilab 5.3.3** version
11
00:00:40 --> 00:00:42
Before practising this tutorial, a learner should have
12
00:00:43 --> 00:00:45
basic knowledge of **Scilab** and
13
00:00:46 --> 00:00:47
**nonlinear equations**
14
00:00:48 --> 00:00:54
For **Scilab**, please refer to the **Scilab** tutorials available on the **Spoken Tutorial** website.
15
00:00:55 --> 00:01:03
For a given **function f**, we have to find the value of **x** for which **f of x** is equal to zero.
16
00:01:04 --> 00:01:10
This solution **x** is called **root of equation ** or ** zero of function f.**
17
00:01:11 --> 00:01:15
This process is called ** root finding** or **zero finding.**
18
00:01:16 --> 00:01:19
We begin by studying **Bisection Method. **
19
00:01:20 --> 00:01:24
In **bisection method** we calculate the **initial bracket** of the **root.**
20
00:01:25 --> 00:01:30
Then we iterate through the **bracket** and halve its length.
21
00:01:31 --> 00:01:35
We repeat this process until we find the solution of the equation.
22
00:01:36 --> 00:01:40
Let us solve this function using **Bisection method.**
23
00:01:41 --> 00:01:41
Given
24
00:01:42 --> 00:01:53
**function f equal to two sin x minus e to the power of x divided by four minus one in the interval minus five and minus three**
25
00:01:54 --> 00:01:59
**Open Bisection dot sci on Scilab editor. **
26
00:02:00 --> 00:02:02
Let us look at the code for **Bisection method.**
27
00:02:03 --> 00:02:09
We define the function **Bisection** with input arguments **a b f** and **Tol.**
28
00:02:10 --> 00:02:13
Here **a** is the lower limit of the **interval**
29
00:02:14 --> 00:02:15
**b** is the upper limit of the **interval**
30
00:02:16 --> 00:02:18
**f** is the function to be solved
31
00:02:19 --> 00:02:21
and **Tol** is the **tolerance level**
32
00:02:22 --> 00:02:27
We specify the maximum number of iterations to be equal to hundred.
33
00:02:28 --> 00:02:36
We find the midpoint of the interval and iterate till the value calculated is within the specified **tolerance range.**
34
00:02:37 --> 00:02:39
Let us solve the problem using this code.
35
00:02:40 --> 00:02:42
Save and execute the file.
36
00:02:43 --> 00:02:46
Switch to **Scilab console**
37
00:02:47 --> 00:02:49
Let us define the **interval.**
38
00:02:50 --> 00:02:51
Let **a** be equal to minus five.
39
00:02:52 --> 00:02:53
Press **Enter.**
40
00:02:54 --> 00:02:55
Let **b** be equal to minus three.
41
00:02:56 --> 00:02:57
Press **Enter. **
42
00:02:58 --> 00:03:00
Define the function using **deff function.**
43
00:03:01 --> 00:03:01
We type
44
00:03:02 --> 00:03:40
**deff open paranthesis open single quote open square bracket y close square bracket equal to f of x close single quote comma open single quote y equal to two asterisk sin of x minus open paranthesis open paranthesis percentage e to the power of x close paranthesis divided by four close paranthesis minus one close single quote close paranthesis**
45
00:03:41 --> 00:03:45
To know more about **deff function** type **help deff**
46
00:03:46 --> 00:03:47
Press **Enter.**
47
00:03:48 --> 00:03:52
Let **tol** be equal to 10 to the power of minus five.
48
00:03:53 --> 00:03:55
Press **Enter.**
49
00:03:56 --> 00:03:57
To solve the problem, type
50
00:03:58 --> 00:04:06
**Bisection open paranthesis a comma b comma f comma tol close paranthesis**
51
00:04:07 --> 00:04:08
Press **Enter.**
52
00:04:09 --> 00:04:13
The root of the function is shown on the console.
53
00:04:14 --> 00:04:16
Let us study **Secant method.**
54
00:04:17 --> 00:04:26
In **Secant method,** the derivative is approximated by finite difference using two successive iteration values.
55
00:04:27 --> 00:04:29
Let us solve this example using **Secant method. **
56
00:04:30 --> 00:04:35
The function is **f equal to x square minus six. **
57
00:04:36 --> 00:04:43
The two **starting guesses** are , **p zero** equal to two and **p one** equal to three.
58
00:04:44 --> 00:04:49
Before we solve the problem, let us look at the code for **Secant method. **
59
00:04:50 --> 00:04:53
Open **Secant dot sci** on **Scilab editor.**
60
00:04:54 --> 00:05:00
We define the function **secant** with input arguments **a, b and f.**
61
00:05:01 --> 00:05:03
**a** is first starting guess for the root
62
00:05:04 --> 00:05:06
**b** is the second starting guess and
63
00:05:07 --> 00:05:09
**f** is the function to be solved.
64
00:05:10 --> 00:05:14
We find the difference between the value at the current point and the previous point.
65
00:05:15 --> 00:05:20
We apply **Secant method ** and find the value of the root.
66
00:05:21 --> 00:05:23
Finally we end the function.
67
00:05:24 --> 00:05:26
Let me save and execute the code.
68
00:05:27 --> 00:05:29
Switch to **Scilab console.**
69
00:05:30 --> 00:05:31
Type **clc. **
70
00:05:32 --> 00:05:33
Press **Enter**
71
00:05:34 --> 00:05:37
Let me define the initial guesses for this example.
72
00:05:38 --> 00:05:39
Type **a** equal to 2
73
00:05:40 --> 00:05:41
Press **Enter. **
74
00:05:42 --> 00:05:43
Then type **b** equal to 3
75
00:05:44 --> 00:05:45
Press ** Enter.**
76
00:05:46 --> 00:05:48
We define the function using **deff function. **
77
00:05:49 --> 00:06:14
Type **deff open paranthesis open single quote open square bracket y close square bracket equal to g of x close single quote comma open single quote y equal to open paranthesis x to the power of two close paranthesis minus six close single quote close paranthesis **
78
00:06:15 --> 00:06:17
Press **Enter**
79
00:06:18 --> 00:06:19
We call the function by typing
80
00:06:20 --> 00:06:26
**Secant open paranthesis a comma b comma g close paranthesis.**
81
00:06:27 --> 00:06:29
Press **Enter**
82
00:06:30 --> 00:06:34
The value of the root is shown on the **console**
83
00:06:35 --> 00:06:37
Let us summarize this tutorial.
84
00:06:38 --> 00:06:40
In this tutorial we have learnt to:
85
00:06:41 --> 00:06:44
Develop **Scilab** code for different solving methods
86
00:06:45 --> 00:06:47
Find the roots of **nonlinear equation **
87
00:06:48 --> 00:06:54
Solve this problem on your own using the two methods we learnt today.
88
00:06:55 --> 00:06:57
Watch the video available at the link shown below
89
00:06:58 --> 00:07:00
It summarises the Spoken Tutorial project
90
00:07:01 --> 00:07:04
If you do not have good bandwidth, you can download and watch it
91
00:07:05 --> 00:07:06
The spoken tutorial project Team
92
00:07:07 --> 00:07:09
Conducts workshops using spoken tutorials
93
00:07:10 --> 00:07:13
Gives certificates to those who pass an online test
94
00:07:14 --> 00:07:20
For more details, please write to conatct@spoken-tutorial.org
95
00:07:21 --> 00:07:23
Spoken Tutorial Project is a part of the Talk to a Teacher project
96
00:07:24 --> 00:07:31
It is supported by the National Mission on Eduction through ICT, MHRD, Government of India.
97
00:07:32 --> 00:07:38
More information on this mission is available at http://spoken-tutorial.org/NMEICT-Intro
98
00:07:39 --> 00:07:40
This is Ashwini Patil signing off.
99
00:07:41 --> 00:07:46
Thank you for joining.