Scilab/C4/Solving-Non-linear-Equations/English
Title of script: Solving Nonlinear Equations using Numerical Methods
Author: Shamika
Keywords: Nonlinear equation, root, zero
|
|
---|---|
Slide 1 | Dear Friends,
Welcome to the spoken tutorial on “Solving Nonlinear Equations using Numerical Methods” |
Slide 2,3 -Objectives | At the end of this tutorial, you will learn how to:
The methods we will be studying are
We will also develop Scilab code to solve nonlinear equations. |
Slide 4-System Requirements | To record this tutorial, I am using
|
Slide 5- Prerequisites | Before practising this tutorial, a learner should have
For Scilab, please refer to the Scilab tutorials available on the Spoken Tutorial website. |
Slide 6 | For a given function f, we have to find the value of x for which f of x is equal to zero.
This solution x is called root of equation or zero of function f. This process is called root finding or zero finding. |
Slide 7 | We begin by studying Bisection Method.
|
Slide 8 | Let us solve this function using Bisection method.
Given 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 |
Open Bisection.sci on Scilab Editor |
Open Bisection dot sci on Scilab editor. Let us look at the code for Bisection method. We define the function Bisection with input arguments a b f and tol. |
Highlight as per narration |
Here
|
Click on Execute and select Save and Execute | Let us solve the problem using this code.
|
Switch to Scilab console
a=-5 Press enter b=-3 Press enter |
Switch to Scilab console
Press Enter.
Press Enter. |
deff('[y]=f(x)','y=(2*(sin(x))-((%e^x)/4)-1') Press enter |
Define the function using deff function.
We type 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 |
Press Enter. |
To know more about deff function, type help deff
Press Enter. |
Tol=10^-5 Press enter Bisection(a,b,f,Tol) Press enter |
Let tol be equal to 10 to the power of minus five.
Press Enter.
Bisection open paranthesis a comma b comma f comma tol close paranthesis Press Enter. |
The root of the function is shown on the console. | |
Slide 12 | Let us study Secant's method.
|
Slide 13 | Let us solve this example using Secant method.
The function is f equal to x square minus six.
|
Open Secant.sci on Scilab Editor | Before we solve the problem, let us look at the code for Secant method.
|
Highlight as per narration | We define the function secant with input arguments a, b and f.
|
Highlight as per narration | We find the difference between the value at the current point and the previous point.
|
Highlight as per narration | Finally we end the function. |
Click on Execute and select Save and Execute | Let me save and execute the code. |
Switch to Scilab console
Type on Scilab console
Press enter |
Switch to Scilab console.
Press Enter. |
a=2
Press enter
Press enter |
Let me define the initial guesses for this example. Type
a equal to 2 Press Enter.
b equal to 3 Press Enter. |
deff('[y]=g(x)','y=(x^2)-6')
Press enter |
We define the function using deff function.
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 Press Enter. |
Secant(a,b,g)
Press enter |
We call the function by typing
Secant open paranthesis a comma b comma g close paranthesis. Press Enter.
|
Slide 14 | Let us summarize this tutorial.
In this tutorial we have learnt to:
|
Slide 15- Assignment | Solve this problem on your own using the two methods we learnt today. |
Show Slide 16
Title: About the Spoken Tutorial Project
|
* Watch the video available at the following link
|
Show Slide 17
Title: Spoken Tutorial Workshops The Spoken Tutorial Project Team
|
The Spoken Tutorial Project Team
|
Show Slide 18
Title: Acknowledgement
|
* Spoken Tutorial Project is a part of the Talk to a Teacher project
|
On previous slide | This is Ashwini Patil signing off. Thanks for joining. |