https://script.spoken-tutorial.org/api.php?action=feedcontributions&user=Lavitha+Pereira&feedformat=atomScript | Spoken-Tutorial - User contributions [en]2024-03-29T14:03:34ZUser contributionsMediaWiki 1.23.17https://script.spoken-tutorial.org/index.php/BASHBASH2014-08-19T09:25:22Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output using 'command &>filename' <br />
#*Redirection of both standard error and output using 'command >/dev/null 2>&1'<br />
#*Explanation on /dev/null<br />
#*Appending redirected output using '>>' <br />
#'Here' document and 'Here' string <br />
#*Here document <br />
#*Illustration of Here document with 'wc -w' <br />
#*Here string <br />
#*Illustration of Here string with 'wc -w' <br />
#Using File Descriptors<br />
#*Introduction on fd <br />
#*Assign the file descriptor (fd) to file for output(exec fd > filename)<br />
#*Explained using an example of 'date' and 'echo'<br />
#*Closing the output fd(exec fd<&-)<br />
#*Explaination on error for the statements defiened after closing fd <br />
#*Assign the file descriptor (fd) to file for input(exec fd < filename) <br />
#*Closing the input file descriptor(exec fd<&-) <br />
#*Explaination on input fd using 'cat'<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Making shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Bash display dialog boxes <br />
#*A yes/no dialog box <br />
<br />
# More on interactive shell script(using dialog box) <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-08-11T07:04:43Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output using 'command &>filename' <br />
#*Redirection of both standard error and output using 'command >/dev/null 2>&1'<br />
#*Explanation on /dev/null<br />
#*Appending redirected output using '>>' <br />
#'Here' document and 'Here' string <br />
#*Here document <br />
#*Illustration of Here document with 'wc -w' <br />
#*Here string <br />
#*Illustration of Here string with 'wc -w' <br />
#Assigning File Descriptor(fd) to file <br />
#*Introduction on fd <br />
#*Assign the file descriptor (fd) to file for output(exec fd > filename)<br />
#*Explained using an example of 'date' and 'echo'<br />
#*Closing the output fd(exec fd<&-)<br />
#*Explaination on error for the statements defiened after closing fd <br />
#*Assign the file descriptor (fd) to file for input(exec fd < filename) <br />
#*Closing the input file descriptor(exec fd<&-) <br />
#*Explaination on input fd using 'cat' <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-07-22T04:53:34Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output using 'command &>filename' <br />
#*Redirection of both standard error and output using 'command >/dev/null 2>&1'<br />
#*Explanation on /dev/null<br />
#*Appending redirected output using '>>' <br />
#'Here' document and 'Here' string <br />
#*Here document <br />
#*Illustration of Here document with 'wc -w' <br />
#*Here string <br />
#*Illustration of Here string with 'wc -w' <br />
#Assigning File Descriptor <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-07-04T06:45:26Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output using 'command &>filename' <br />
#*Redirection of both standard error and output using 'command >/dev/null 2>&1'<br />
#*Explanation on /dev/null<br />
#*Appending redirected output using '>>' <br />
#*Here document <br />
#*Illustration of Here document with 'wc -w' <br />
#*Here string <br />
#*Illustration of Here string with 'wc -w' <br />
<br />
#Assigning File Descriptor <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-07-04T06:44:30Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output using command &>filename <br />
#*Redirection of both standard error and output using command >/dev/null 2>&1<br />
#*Explanation on /dev/null<br />
#*Appending redirected output using '>>' <br />
#*Here document <br />
#*Illustration of Here document with 'wc -w' <br />
#*Here string <br />
#*Illustration of Here string with 'wc -w' <br />
<br />
#Assigning File Descriptor <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-06-06T06:31:20Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in a function <br />
#*Source command <br />
#*Source command usage example<br />
#*Brief description on background function <br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
#Recursive function<br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
# Basics of Redirection (error handling) <br />
#*Input and Output in bash <br />
#*Redirection definition<br />
#*file descriptors(FD) <br />
#*Standard input <br />
#*Input redirection explained with an example of sorting <br />
#*Standard output <br />
#*Output redirection explained with an example of ls <br />
#*Standard error <br />
#*Error redirection explained with an example of rm<br />
#More on Redirection <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2014-06-05T04:52:14Z<p>Lavitha Pereira: /* Basic Level Introduction to Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans: %T(True) and %F(False)- they form the basis for the if statement.<br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
# '''Numerical methods- Iterative Methods'''<br />
#*Solve system of linear equations using iterative methods <br />
#*Develop Scilab code to solve linear equations<br />
# '''Numerical methods- Interpolation'''<br />
# '''Numerical methods- ODE- Euler methods'''<br />
# '''Numerical methods- ODE- Applications'''<br />
# ''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# '''Optimization of Non-linear Functions'''<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# '''Filter Design- Windowing Techniques'''<br />
# '''Filter Design- Window Based FIR Filter'''<br />
# '''Filter Design- IIR Digital Filter'''<br />
# '''Filter Design- Applying Digital Filter'''<br />
# '''Control systems'''<br />
#*Define a continuous time system: second and higher order<br />
#*Response plot for step input<br />
#*Response plot for sine input<br />
#*Bode plot<br />
#*Study numer and denom Scilab functions<br />
#*Plot poles and zeros of function<br />
# '''Discrete systems'''<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2014-06-05T04:51:07Z<p>Lavitha Pereira: /* Basic Level Introduction to Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans: %T and %F- they form the basis for the if statement.<br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
# '''Numerical methods- Iterative Methods'''<br />
#*Solve system of linear equations using iterative methods <br />
#*Develop Scilab code to solve linear equations<br />
# '''Numerical methods- Interpolation'''<br />
# '''Numerical methods- ODE- Euler methods'''<br />
# '''Numerical methods- ODE- Applications'''<br />
# ''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# '''Optimization of Non-linear Functions'''<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# '''Filter Design- Windowing Techniques'''<br />
# '''Filter Design- Window Based FIR Filter'''<br />
# '''Filter Design- IIR Digital Filter'''<br />
# '''Filter Design- Applying Digital Filter'''<br />
# '''Control systems'''<br />
#*Define a continuous time system: second and higher order<br />
#*Response plot for step input<br />
#*Response plot for sine input<br />
#*Bode plot<br />
#*Study numer and denom Scilab functions<br />
#*Plot poles and zeros of function<br />
# '''Discrete systems'''<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-28T04:56:18Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Source command usage example(Example used: Machine details) <br />
#*Recursive function meaning and uses<br />
#*Illustration of recursive function(Example used: Factorial of a number)<br />
#*Debugging of bash script(bash -x filename)<br />
#*Work flow of recursive function with the help of flowchart <br />
#*Brief description on background function<br />
#*Illustration of bg function<br />
#*Use of Jobs command to find job number and PID<br />
# Redirection (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-21T05:40:53Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the''' Spoken Tutorial''' team and '''FOSSEE team''', IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-21T05:39:56Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-21T05:38:32Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Bash: ''' <br />
Bash is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
'''Bash Scripting:'''<br />
In addition to the interactive mode, where the user types one command at a time, with immediate execution and feedback, Bash also has the ability to run an entire script of commands, known as a "Bash shell script". A script might contain just a very simple list of commands or even just a single command or it might contain functions, loops, conditional constructs. In effect, a Bash shell script is a computer program written in the Bash programming language.<br />
<br />
Shell scripts are commonly used for many system administration tasks, such as performing disk backups, evaluating system logs, and so on. They are also commonly used as installation scripts for complex programs. They are particularly suited to all of these because they allow complexity without requiring it.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-20T04:51:59Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays & functions<br />
#*Arrays & functions<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-20T04:51:17Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays in functions<br />
#*Arrays & function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-18T06:46:24Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays in functions<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions having return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-18T06:45:42Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays in functions<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return in a function<br />
#*Use of exit in a function<br />
#*Illustration of return and exit by an example<br />
#*Workflow of functions ahving return and exit <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-03-05T09:32:55Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions<br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#More on Functions <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Solving-Non-linear-Equations/EnglishScilab/C4/Solving-Non-linear-Equations/English2014-02-12T11:50:38Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Title of script''': '''Solving Nonlinear Equations using Numerical Methods'''<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: Nonlinear equation, root, zero'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
<br />
<br />
<br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the spoken tutorial on “'''Solving Nonlinear Equations using Numerical Methods'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2,3 -Objectives<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Solve '''nonlinear equations''' using numerical methods<br />
* The methods we will be studying are<br />
* '''Bisection method'''<br />
* and '''Secant method'''<br />
<br />
* We will also develop '''Scilab''' code to solve '''nonlinear equations '''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4-System Requirements<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
* '''Ubuntu 12.04''' as the operating system <br />
* and '''Scilab 5.3.3''' version <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Prerequisites<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before practising this tutorial, a learner should have <br />
<br />
* basic knowledge of '''Scilab '''and <br />
* '''nonlinear equations'''<br />
<br />
For Scilab, please refer to the '''Scilab''' tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For a given '''function f''' , we have to find the value of''' x''' for which '''f of x is equal to zero.''' <br />
<br />
This solution x is called '''root of equation or zero of function f'''<br />
<br />
This process is called '''root finding or zero finding'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We begin by studying '''Bisection Method'''.<br />
<br />
<br />
* In '''bisection method,''' we calculate the '''initial bracket''' of the '''root'''. <br />
* Then we iterate through the '''bracket''' and halve its length. <br />
* We repeat this proces until we find the solution of the equation.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this function using '''Bisection method'''<br />
<br />
<br />
Given <br />
<br />
'''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. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open '''Bisection.sci''' on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Open '''Bisection dot sci '''on '''Scilab editor'''<br />
* Let us look at the code for '''Bisection method'''<br />
* We define the function '''Bisection''' with input arguments '''a b f '''and '''tol'''<br />
* Here '''a''' is the lower limit of the interval<br />
* '''b '''is the upper limit of the interval<br />
* '''f''' is the function to be solved<br />
* and '''tol''' is the''' tolerance level'''<br />
* We specify the maximum number of iterations to be equal to hundred. <br />
* We find the '''midpoint of the interval '''and iterate till the value calculated is within the specified '''tolerance range'''. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve the problem using this code. <br />
<br />
<br />
'''Save and execute '''the file<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
<br />
<br />
On Scilab Console type, <br />
<br />
a=-5<br />
<br />
Press enter<br />
<br />
b=-3<br />
<br />
Press enter<br />
<br />
<br />
<nowiki>deff('[y]=f(x)','y=(2*(sin(x))-((%e^x)/4)-1')</nowiki><br />
<br />
Press enter<br />
<br />
<br />
Tol=10^-5<br />
<br />
Press enter<br />
<br />
Bisection(a,b,f,Tol)<br />
<br />
Press enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console'''<br />
<br />
<br />
Let us define the interval. <br />
<br />
<br />
Let '''a '''be equal to minus five <br />
<br />
Press enter<br />
<br />
<br />
Let '''b''' be equal to minus three. <br />
<br />
Press enter<br />
<br />
<br />
Define the function using '''deff function'''. <br />
<br />
We type <br />
<br />
'''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'''<br />
<br />
<br />
To know more about '''deff function''', type help '''deff'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
Let '''tol '''be equal to 10 to the power of minus five<br />
<br />
'''Press enter'''<br />
<br />
<br />
To solve the problem, type<br />
<br />
<br />
'''Bisection open paranthesis a comma b comma f comma tol close paranthesis'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
The root of the function is '''shown on the console'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 12<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us study '''Secant's method'''. <br />
<br />
<br />
In '''Secan't method, '''the derivative is approximated by finite <br />
<br />
difference using two successive '''iteration values.''' <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this example using '''Secant method'''<br />
<br />
The function is '''f equal to x square minus six'''. <br />
<br />
<br />
The two '''starting guesses''' are , '''p zero '''equal to two and '''p one '''equal to three. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Secant.sci on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before we solve the problem, let us look at the code for '''Secant meethod. '''<br />
<br />
<br />
Open '''Secant dot sci '''on '''Scilab editor'''<br />
<br />
<br />
We define the function '''secant '''with input arguments '''a, b '''and '''f'''<br />
<br />
<br />
'''a''' is first starting guess for the root<br />
<br />
<br />
'''b''' is the second starting guess and f is the function to be solved. <br />
<br />
<br />
We find the difference between the value at the current point and the previous point. <br />
<br />
<br />
We apply '''Secant's method '''and find the value of the root.<br />
<br />
<br />
Finally we end the function<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let me '''save and execute '''the code. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
<br />
Type on Scilab console<br />
<br />
<br />
clc<br />
<br />
Press enter<br />
<br />
<br />
a=2<br />
<br />
Press enter<br />
<br />
<br />
b=3<br />
<br />
Press enter<br />
<br />
<br />
<nowiki>deff('[y]=g(x)','y=(x^2)-6')</nowiki><br />
<br />
Press enter<br />
<br />
<br />
Secant(a,b,g)<br />
<br />
Press enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console'''<br />
<br />
<br />
Type '''clc'''<br />
<br />
Press '''enter'''<br />
<br />
<br />
Let me define the initial guesses for this example. Type<br />
<br />
'''a '''equal to 2<br />
<br />
Press '''enter'''<br />
<br />
<br />
Then type<br />
<br />
'''b '''equal to 3<br />
<br />
Press '''enter'''<br />
<br />
<br />
We define the function using '''deff function. '''<br />
<br />
Type <br />
<br />
'''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'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
We call the function by typing <br />
<br />
'''Secant open paranthesis a comma b comma g close paranthesis. '''<br />
<br />
'''Press enter'''<br />
<br />
<br />
The value of the root is shown on the '''console'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 14<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial<br />
<br />
In this tutorial we have learnt to:<br />
<br />
* Find the roots of '''nonlinear equation'''<br />
* Develop''' Scilab '''code for different solving methods<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 15- Assignment<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Solve this problem on your own using the two methods we learnt today. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 16'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Watch the video available at the following link <br />
* It summarises the Spoken Tutorial project <br />
* If you do not have good bandwidth, you can download and watch it <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 17'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 18'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''On previous slide'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Solving-Non-linear-Equations/EnglishScilab/C4/Solving-Non-linear-Equations/English2014-02-12T07:51:10Z<p>Lavitha Pereira: Created page with ''''Title of script''': '''Solving Nonlinear Equations using Numerical Methods''' '''Author: Shamika''' '''Keywords: Nonlinear equation, root, zero''' {| style="border-spacing…'</p>
<hr />
<div>'''Title of script''': '''Solving Nonlinear Equations using Numerical Methods'''<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: Nonlinear equation, root, zero'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
<br />
<br />
<br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the spoken tutorial on “'''Solving Nonlinear Equations using Numerical Methods'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2,3 -Objectives<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Solve '''nonlinear equations''' using numerical methods<br />
* The methods we will be studying are<br />
* Bisection method<br />
* and Secant method<br />
<br />
* We will also develop '''Scilab''' code to solve '''nonlinear equations '''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4-System Requirements<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
* '''Ubuntu 12.04''' as the operating system <br />
* and '''Scilab 5.3.3''' version <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Prerequisites<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before practising this tutorial, a learner should have <br />
<br />
* basic knowledge of '''Scilab '''and <br />
* '''nonlinear equations'''<br />
<br />
For Scilab, please refer to the '''Scilab''' tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For a given '''function f''' , we have to find the value of''' x''' for which '''f of x is equal to zero.''' <br />
<br />
This solution x is called '''root of equation or zero of function f'''<br />
<br />
This process is called '''root finding or zero finding'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We begin by studying '''Bisection Method'''.<br />
<br />
<br />
* In '''bisection method,''' we calculate the initial bracket of the '''root'''. <br />
* Then we iterate through the bracket and halve its length. <br />
* We repeat this proces until we find the solution of the equation.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this function using '''Bisection method'''<br />
<br />
<br />
Given <br />
<br />
'''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. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open '''Bisection.sci''' on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Open Bisection dot sci on Scilab editor<br />
* Let us look at the code for Bisection method<br />
* We define the function Bisection with input arguments a b f and tol<br />
* Here a is the lower limit of the interval<br />
* b is the upper limit of the interval<br />
* f is the function to be solved<br />
* and tol is th etolerance level<br />
* We specify the maximum number of iterations to be equal to hundred. <br />
* We find the midpoint of the interval and iterate till the value calculated is within the specified '''tolerance range'''. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve the problem using this code. <br />
<br />
<br />
Save and execute the file<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
<br />
<br />
On Scilab Console type, <br />
<br />
a=-5<br />
<br />
Press enter<br />
<br />
b=-3<br />
<br />
Press enter<br />
<br />
<br />
<nowiki>deff('[y]=f(x)','y=(2*(sin(x))-((%e^x)/4)-1')</nowiki><br />
<br />
Press enter<br />
<br />
<br />
Tol=10^-5<br />
<br />
Press enter<br />
<br />
Bisection(a,b,f,Tol)<br />
<br />
Press enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to Scilab console<br />
<br />
<br />
Let us define the interval. <br />
<br />
<br />
Let a be equal to minus five <br />
<br />
Press enter<br />
<br />
<br />
Let b be equal to minus three. <br />
<br />
Press enter<br />
<br />
<br />
Define the function using '''deff function'''. <br />
<br />
We type <br />
<br />
'''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'''<br />
<br />
<br />
To know more about '''deff function''', type help '''deff'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
Let '''tol '''be equal to '''10 to the power of minus five'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
To solve the problem, type<br />
<br />
<br />
'''Bisection open paranthesis a comma b comma f comma tol close paranthesis'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
The root of the function is '''shown on the console'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 12<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us study Secant's method. <br />
<br />
<br />
In '''Secan't method, '''the derivative is approximated by finite <br />
<br />
difference using two successive Pls use a simpler word. This word <br />
<br />
will pose a problem for our translators.''Reply to nancy (12/23/2013, 11:33): "..."''<br />
<br />
Changed. iteration values. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this example using '''Secant method'''<br />
<br />
The function is '''f equal to x square minus six'''. <br />
<br />
<br />
The two starting guesses are , '''p zero '''equal to two and '''p one '''equal to three. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Secant.sci on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before we solve the problem, let us look at the code for '''Secant meethod. '''<br />
<br />
<br />
Open Secant dot sci on Scilab editor<br />
<br />
<br />
We define the function secant with input arguments a, b and f<br />
<br />
<br />
a is first starting guess for the root<br />
<br />
<br />
b is the second starting guess and f is the function to be solved. <br />
<br />
<br />
We find the difference between the value at the current point and the previous point. <br />
<br />
<br />
We apply '''Secant's method '''and find the value of the root.<br />
<br />
<br />
Finally we end the function<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let me save and execute the code. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
<br />
Type on Scilab console<br />
<br />
<br />
clc<br />
<br />
Press enter<br />
<br />
<br />
a=2<br />
<br />
Press enter<br />
<br />
<br />
b=3<br />
<br />
Press enter<br />
<br />
<br />
<nowiki>deff('[y]=g(x)','y=(x^2)-6')</nowiki><br />
<br />
Press enter<br />
<br />
<br />
Secant(a,b,g)<br />
<br />
Press enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to Scilab console<br />
<br />
<br />
Type clc<br />
<br />
Press enter<br />
<br />
<br />
Let me define the initial guesses for this example. Type<br />
<br />
'''a '''equal to 2<br />
<br />
Press enter<br />
<br />
<br />
Then type<br />
<br />
'''b '''equal to 3<br />
<br />
Press enter<br />
<br />
<br />
We define the function using '''deff function. '''<br />
<br />
Type <br />
<br />
'''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'''<br />
<br />
'''Press enter'''<br />
<br />
<br />
We call the function by typing <br />
<br />
'''Secant open paranthesis a comma b comma g close paranthesis. '''<br />
<br />
'''Press enter'''<br />
<br />
<br />
The value of the root is shown on the console<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 14<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial<br />
<br />
In this tutorial we have learnt to:<br />
<br />
* Find the roots of '''nonlinear equation'''<br />
* Develop''' Scilab '''code for different solving methods<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 15- Assignment<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Solve this problem on your own using the two methods we learnt today. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 16'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Watch the video available at the following link <br />
* It summarises the Spoken Tutorial project <br />
* If you do not have good bandwidth, you can download and watch it <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 17'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 18'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''On previous slide'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2014-01-17T04:48:57Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String and File Attributes comparison in BASH<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Conditional Loops <br />
#*The for loop statement <br />
#*for loop with three expression syntax<br />
#*for loop with sequence/range syntax <br />
#*flow of for loop program<br />
#*The while loop statement<br />
#*flow of for loop program<br />
#More on Loops <br />
#*A loop within a loop<br />
#*Outer for loop <br />
#*Nested for loop<br />
#*Inner for loop<br />
#*Syntax of nested for loop<br />
#*Finding files in the directories using nested for loop<br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of functions in Bash <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Interpolation/EnglishScilab/C4/Interpolation/English2013-12-24T11:56:17Z<p>Lavitha Pereira: Created page with ''''Title of script''': '''Numerical Interpolation''' '''Author: Shamika''' '''Keywords: Interpolation, Lagrange method, Newton divided difference method''' {| style="border-s…'</p>
<hr />
<div>'''Title of script''': '''Numerical Interpolation'''<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: Interpolation, Lagrange method, Newton divided difference method'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “'''Numerical Interpolation'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Develop Scilab code for different Numerical Interpolation algorithms<br />
* Calculate new value of function from given data points<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 3-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
* '''Ubuntu 12.04''' as the operating system <br />
* and '''Scilab 5.3.3''' version <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To practise this tutorial, a learner should have <br />
<br />
* basic knowledge of '''Scilab '''<br />
* and should know '''Numerical Interpolation'''<br />
<br />
To learn '''Scilab''', please refer to the relevant tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Numerical Interpolation<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Numerical interpolation''' is a method of <br />
<br />
* constructing new '''data points''' <br />
* within the range of <br />
* a '''discrete set''' of known '''data points'''.<br />
<br />
We can solve '''interpolation''' problems using numerical methods.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6- Lagrange Interpolation<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In '''Lagrange interpolation''', we pass a '''polynomial '''of''' degree N – 1''' through '''N''' points. <br />
<br />
<br />
Then we find the unique '''N''' '''order polynomial y of x''' which '''interpolates''' the '''data''' samples.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We are given the natural '''logarithm''' values for nine, nine point five and eleven. <br />
<br />
<br />
We have to find the value ofIs this correct? Pls check.''Reply to nancy (10/06/2013, 16:20): "..."''<br />
<br />
Change made. natural logarithm of''' nine point two'''. <br />
<br />
<br />
Let us solve this problem using '''Lagrange interpolation method.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show Lagrange.sci code on Scilab editor<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for '''Lagrange interpolation.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
Lagrange(x0, x,f, n)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the function '''Lagrange''' with '''arguments x zero, x, f '''and''' n'''. <br />
<br />
'''X zero''' is the unknown '''interpolation point.'''<br />
<br />
'''x''' is the '''vector '''containing the '''data points.'''<br />
<br />
'''f''' is the '''vector '''containing the values of the '''function '''at correspoding '''data points.'''<br />
<br />
And '''n '''is the '''order '''of the '''interpolating polynomial'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
m <nowiki>=</nowiki> n + 1<nowiki>;</nowiki><br />
<br />
N <nowiki>=</nowiki> ones(1,m)<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We use '''n''' to initialize '''m''' and '''vector N.''' <br />
<br />
The order of the '''interpolating polynomail '''determines the number of '''nodes '''created. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
for j <nowiki>=</nowiki> 1:m<br />
<br />
for k <nowiki>=</nowiki> 1:m<br />
<br />
if (k<nowiki><></nowiki>j) then<br />
<br />
N(j) <nowiki>=</nowiki> N(j)<nowiki>*</nowiki>(x0 - x(k))<br />
<br />
D(j) <nowiki>=</nowiki> D(j)<nowiki>*</nowiki>(x(j) - x(k))<br />
<br />
end<br />
<br />
end<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we apply '''Lagrange''' '''interpolation''' '''formula''' to find the value of the '''numerator''' and '''denominator.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
L(j) <nowiki>=</nowiki> N(j)/D(j)<nowiki>;</nowiki><br />
<br />
<br />
y <nowiki>=</nowiki> y + L(j)<nowiki>*</nowiki>f(j)<nowiki>;</nowiki><br />
<br />
end<br />
<br />
disp(L','L')<br />
<br />
disp(f,'f(x)')<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we divide the '''numerator''' and '''denominator''' to get the value of '''L'''. <br />
<br />
<br />
We use '''L''' to find the value of the function '''y''' at the given data point. Finally we display the value of '''L''' and''' f of x.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us save and execute the file. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab''' '''console''' to solve the example problem.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>x=[9.0,9.5,11.0]</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us define the '''data points vector'''.<br />
<br />
On the console type, <br />
<br />
'''x equal to open square bracket nine point zero comma nine point five comma eleven point zero close square bracket.'''<br />
<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>f=[2.1972,2.2513,2.3979]</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type <br />
<br />
'''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'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
x0=9.2<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type <br />
<br />
'''x zero equal to nine point two'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
n=2<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us use a '''quadratic polynomial interpolating polynomial. '''<br />
<br />
Type''' n equal to two'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
y = Lagrange(x0, x,f, n)<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To call the '''function, '''type<br />
<br />
'''y equal to Lagrange open paranthesis x zero comma x comma f comma n close paranthesis '''<br />
<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The value of the function '''y''' at '''x''' '''equal to nine point two''' is displayed. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at '''Newton's Divided Difference Method'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8- Newton's Divided Difference Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In this method, '''divided differences recursive method '''is used. <br />
<br />
<br />
It uses lesser number of '''computation '''than '''Lagrange method'''. <br />
<br />
<br />
In spite of this, the same '''interpolating polynomial '''as in '''Lagrange method''' is generated.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Example<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this example using '''divided difference method'''. <br />
<br />
<br />
We are given the '''data points''' and the corresponding values of the '''function''' at those '''data points'''. <br />
<br />
<br />
We have to find the value of the '''function''' at '''x equal to three'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab editor<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for '''Newton Divided difference method'''. <br />
<br />
<br />
Open the file '''Newton underscore divided dot sci''' on '''Scilab Editor.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
Newton_Divided(x,f,x0)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the '''function Newton underscore Divided''' with '''arguments x, f '''and''' x zero'''. <br />
<br />
<br />
'''X''' is a '''vector''' containing the '''data points''', '''f''' is the corresponding '''function''' '''value''' and''' x zero''' is the unknown '''interpolation point'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
n <nowiki>=</nowiki> length(x)<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We find the length of '''vector''' and then equate it to''' n.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
a(1) <nowiki>=</nowiki> f(1)<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The first value of '''vector''' is equated to '''a of one.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
for k <nowiki>=</nowiki> 1 : n - 1<br />
<br />
D(k, 1) <nowiki>=</nowiki> (f(k+1) - f(k))/(x(k+1) - x(k))<nowiki>;</nowiki><br />
<br />
end<br />
<br />
for j <nowiki>=</nowiki> 2:n-1<br />
<br />
for k <nowiki>=</nowiki> 1:n-j<br />
<br />
D(k, j) <nowiki>=</nowiki> (D(k+1, j-1) - D(k, j-1))/(x(k+j) - x(k))<br />
<br />
end<br />
<br />
end<br />
<br />
disp(D, 'The Divided Difference Table')<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we apply '''divided difference algorithm''' and compute the '''divided difference table'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
Df(1) <nowiki>=</nowiki> 1<nowiki>;</nowiki><br />
<br />
c(1) <nowiki>=</nowiki> a(1)<nowiki>;</nowiki><br />
<br />
<br />
for j <nowiki>=</nowiki> 2 : n<br />
<br />
Df(j)<nowiki>=</nowiki>(x0 - x(j-1)).*Df(j-1)<nowiki>;</nowiki><br />
<br />
c(j) <nowiki>=</nowiki> a(j).*Df(j)<nowiki>;</nowiki><br />
<br />
end<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we find the '''coefficient list''' of the '''Newton polynomial''' <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
IP <nowiki>=</nowiki> sum(c)<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We sum the '''coefficient list '''to find the value of the '''function''' at given '''data point.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file '''Newton underscore divided dot sci. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type clc<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Clear the screen by typing '''c l c'''.<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>x=[2,2.5,3.25,4]</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us enter the '''data points vector'''<br />
<br />
Type <br />
<br />
'''x equal to open square bracket two comma two point five comma three point two five comma four close square bracket'''<br />
<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>f=[0.5,0.4,0.3077,0.25]</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type values of the '''function'''<br />
<br />
Type '''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'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
x0=3<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''x zero equal to three'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
IP = Newton_Divided(x,f,x0)<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then call the '''function '''by typing<br />
<br />
'''i p equal to Newton underscore divided open paranthesis x comma f comma x zero close paranthesis'''<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The value of '''y''' '''at x equal to three '''is shown.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Summary<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial. <br />
<br />
<br />
In this tutorial we have learnt to develop '''Scilab '''code for '''interpolation methods. '''<br />
<br />
<br />
We have also learnt to find the value of a '''function '''at new '''data point. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 10- Assignment<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Solve this problem on your own using Lagrange method and Newton's divided difference method.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 11'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * About the Spoken Tutorial Project<br/> <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/ http://spoken-tutorial.org]/What_is_a_Spoken_Tutorial <br/> <br />
<br />
* It summarises the Spoken Tutorial project<br/> <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 12'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 13'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/ODE-Euler-methods/EnglishScilab/C4/ODE-Euler-methods/English2013-12-24T11:56:06Z<p>Lavitha Pereira: Created page with ''''Title of script''': '''Solving ODEs using Euler Methods''' '''Author: Shamika''' '''Keywords: ODEs, Euler method, modified Euler method, video tutorial''' {| style="border…'</p>
<hr />
<div>'''Title of script''': '''Solving ODEs using Euler Methods'''<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: ODEs, Euler method, modified Euler method, video tutorial'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! Visual Cue<br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “'''Solving ODEs using Euler Methods'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Solve '''ODEs '''using''' Euler '''and''' Modified Euler methods '''in '''Scilab'''<br />
* Develop '''Scilab''' code to solve '''ODEs'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 3-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
'''Ubuntu 12.04''' as the operating system <br />
<br />
and '''Scilab 5.3.3''' version <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To practise this tutorial, a learner <br />
<br />
* should have basic knowledge of '''Scilab '''<br />
* and should know how to solve''' ODEs.'''<br />
<br />
To learn '''Scilab''', please refer to the relevant tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Euler Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In '''Euler''' '''method''', we get an accurately approximate solution of the '''ODE'''. <br />
<br />
<br />
It is used to solve initial value problems where initial values of the '''differential equation''' are given. <br />
<br />
<br />
It can be used to solve '''continuous functions'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve an example using '''Euler method.'''<br />
<br />
<br />
We are given an initial value problem <br />
<br />
'''y dash is equal to minus two t minus y'''. <br />
<br />
<br />
The initial value of '''y '''is given as '''minus one '''and the '''step length '''is given as '''zero point one'''. <br />
<br />
<br />
We have to find the value of '''y '''at time '''t''' '''equal to zero point five'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Euler_ode.sci on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for '''Euler method'''. <br />
<br />
<br />
Open '''Euler underscore o d e dot sci''' on '''Scilab editor'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
Euler_ode(f, tinit, yinit, h, N)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the function '''Euler underscore o d e '''with '''arguments f, t init, y init, h '''and''' n''' <br />
<br />
where<br />
<br />
* '''F '''denotes the function to be solved, <br />
* '''t init''' is the initial value of time '''t''', <br />
* '''y init '''is the initial value of '''y''', <br />
* '''h''' is the '''step length''', and '''n''' is the number of '''iterations'''. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
t <nowiki>=</nowiki> zeros(N+1, 1)<br />
<br />
<br />
y <nowiki>=</nowiki> zeros(N+1,1)<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we initialize the values of '''t '''and '''y to vectors of zeros. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
t(1) <nowiki>=</nowiki> tinit<br />
<br />
<br />
y(1) <nowiki>=</nowiki> yinit<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We place the initial values of '''t '''and''' y''' in''' t of one''' and '''y of one''' respectively. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
for j <nowiki>=</nowiki> 1:N<br />
<br />
t(j+1) <nowiki>=</nowiki> t(j) + h<br />
<br />
y(j + 1) <nowiki>=</nowiki> y(j) + h<nowiki>*</nowiki>f(t(j), y(j))<br />
<br />
end<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we '''iterate''' from '''one to N''' to find the value of''' y'''. <br />
<br />
<br />
Here we apply '''Euler method''' to find the value of''' y'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
endfunction<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Finally we end the '''function'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file''' Euler underscore o d e dot sci'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console''' the solve the example problem.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>deff('[ydot]=f(t,y)','ydot=(-2*t)-y')</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the function by typing <br />
<br />
'''d e f f open paranthesis 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 paranthesis minus two asterisk t close paranthesis minus y close single quote close paranthesis'''<br />
<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
tinit=0<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type '''t init is equal to zero'''. <br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
yinit=-1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''y init is equal to minus one'''. <br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
h=0.1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''step length h is equal to zero point one'''. <br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
N=5<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''step length '''is '''zero point one''', and we have to find the value of '''y '''at '''zero point five.''' <br />
<br />
<br />
So, the number of '''iterations''' should be '''five'''. <br />
<br />
At each '''iteration, '''the value of '''t '''will be increased by '''zero point one'''. <br />
<br />
<br />
So type '''capital n is equal to five'''.<br />
<br />
<br />
And press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>[t, y] = Euler_ode(f, tinit, yinit, h, N)</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To '''call''' the '''function,''' type<br />
<br />
<br />
'''open square bracket t comma y close square bracket equal to Euler underscore o d e open paranthesis f comma t init comma y init comma h comma capital n close paranthesis '''<br />
<br />
<br />
Press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The value of''' y''' '''at t equal to zero point five''' is shown. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7- Modified Euler Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Now let us look at '''modified''' '''Euler method'''. <br />
<br />
<br />
It is a '''second order method '''and is a '''stable two step method'''. <br />
<br />
<br />
We find the '''average '''of the '''function '''at the beginning and end of '''time step'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this example using '''modified Euler method'''. <br />
<br />
<br />
We are given a '''function y dash is equal to t plus y plus t y'''. <br />
<br />
The initial value of '''y '''is '''one '''and the '''step length '''is '''zero point zero one'''. <br />
<br />
<br />
We have to find the value of '''y '''at '''time t equal to zero point one '''using '''Modified Euler's method. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open ModiEuler_ode.sci on Scilab Editor<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for '''Modified Euler method '''on '''Scilab Editor'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
ModiEuler_ode(f, tinit, yinit, h, N)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the '''function''' with '''arguments f, t init, y init, h '''and''' n '''<br />
<br />
where<br />
<br />
* '''F''' is the '''function''' to be solved, <br />
* '''t init''' is the intial '''time''' value, <br />
* '''y init''' is the inital value of '''y''', <br />
* '''h''' is the '''step length''' and <br />
* '''n''' is the number of '''iterations'''. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
t <nowiki>=</nowiki> zeros(N+1,1)<br />
<br />
y <nowiki>=</nowiki> zeros(N+1,1)<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we initialize the '''arrays''' for '''y''' and '''t.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
t(1) <nowiki>=</nowiki> tinit<br />
<br />
y(1) <nowiki>=</nowiki> yinit<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We place the initial values of''' t''' and''' y '''in''' t of one''' and''' y of one''' respectively. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
for j <nowiki>=</nowiki> 1:N<br />
<br />
t(j+1) <nowiki>=</nowiki> t(j) + h<br />
<br />
y(j+1) <nowiki>=</nowiki> y(j) + h<nowiki>*</nowiki>f(t(j), y(j))<br />
<br />
y(j+1) <nowiki>=</nowiki> y(j) + h<nowiki>*</nowiki>(f(t(j),y(j)) + f(t(j + 1),y(j)+h<nowiki>*</nowiki>f(t(j),y(j))))/2<nowiki>;</nowiki> <br />
<br />
end<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We implement '''Modified Euler Method''' here. <br />
<br />
<br />
Here we find the average value of '''y''' at the beginning and end of '''time step'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file '''Modi Euler underscore o d e dot sci'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type clc<br />
<br />
Press enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Clear the screen by typing '''c l c'''.<br />
<br />
Press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>deff('[ydot]=f(t,y)','ydot=t+y+t*y')</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Define the '''function''' by typing<br />
<br />
'''d e f f open paranthesis 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 paranthesis '''<br />
<br />
<br />
Press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
tinit=0<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type''' t init equal to zero'''<br />
<br />
and press '''Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
yinit=1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''y init equal to one'''<br />
<br />
and press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
h=0.01<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type '''h equal to zero point zero one'''<br />
<br />
and press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
N=10<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''capital N equal to ten'''. <br />
<br />
<br />
Since the number of '''iterations '''should be '''ten to time t equal to zero point one '''with '''step length '''of '''zero point zero one. '''<br />
<br />
<br />
Press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type on console<br />
<br />
<nowiki>[t, y] = ModiEuler_ode(f, tinit, yinit, h, N)</nowiki><br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then call the '''function modi euler underscore o d e''' by typing<br />
<br />
'''open square bracket t comma y close square bracket equal to modi euler underscore o d e open paranthesis f comma t init comma y init comma h comma capital n close paranthesis'''<br />
<br />
Press '''Enter.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The value of '''y '''at''' t equal to zero point one''' is shown.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial. <br />
<br />
<br />
In this tutorial we have learnt to develop Scilab code for '''Euler '''and '''modified Euler methods'''. <br />
<br />
<br />
We have also learnt to solve '''ODEs '''using these methods in '''Scilab.. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 10'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * About the Spoken Tutorial Project<br/> <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/ http://spoken-tutorial.org]/What_is_a_Spoken_Tutorial <br/> <br />
<br />
* It summarises the Spoken Tutorial project<br/> <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 11'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 12'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-][http://spoken-tutorial.org/NMEICT-Intro tutorial.org/][http://spoken-tutorial.org/NMEICT-Intro NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/ODE-Applications/EnglishScilab/C4/ODE-Applications/English2013-12-24T11:54:56Z<p>Lavitha Pereira: Created page with ''''Title of script''': '''Solving ODEs using Scilab ode Function''' '''Author: Shamika''' '''Keywords: ODEs''' {| style="border-spacing:0;" ! <center>Visual Cue</center> ! <c…'</p>
<hr />
<div>'''Title of script''': '''Solving ODEs using Scilab ode Function'''<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: ODEs'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “'''Solving ODEs using Scilab ode Function'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* '''Use Scilab ode function'''<br />
* Solve typical examples of '''ODEs '''and<br />
* Plot the solution<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 3 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The typical examples we will be solving are:<br />
<br />
* Motion of '''simple pendulum'''<br />
* '''Van der Pol equation'''<br />
* '''Lorenz system'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
* '''Ubuntu 12.04''' as the operating system <br />
* and '''Scilab 5.3.3''' version <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To practise this tutorial, a learner <br />
<br />
* should have basic knowledge of '''Scilab '''<br />
* and should know how to solve''' ODEs.'''<br />
<br />
To learn '''Scilab''', please refer to the relevant tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6- ode Function<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''ode function''' is an '''ordinary differential equation solver.'''<br />
<br />
<br />
The syntax is '''y equal to ode within paranthesis y zero, t zero, t and f'''<br />
<br />
<br />
Here''' '''<br />
<br />
* '''y zero''' is the initial conditon of the '''ODEs'''<br />
<br />
* '''t zero '''is the '''initial time'''<br />
* '''t''' is the '''time range'''<br />
* and '''f''' is the '''function'''<br />
<br />
<br />
<br />
|-<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7- Motion of Simple pendulum<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Consider the motion of simple pendulum. <br />
<br />
<br />
Let '''theta t '''be the angle made by the '''penndulum''' with the '''vertical''' at time '''t.'''<br />
<br />
<br />
We are given the initial conditions <br />
<br />
* '''theta zero '''is equal to''' pi by four '''and <br />
* '''theta dash of zero '''is equal to '''zero'''. <br />
<br />
<br />
<br />
|-<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8- Motion of Simple pendulum<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then the position of the '''pendulum''' is described by <br />
<br />
'''theta double dash t minus g by l into sin of theta t equal to zero'''. <br />
<br />
<br />
Here <br />
<br />
* '''g equal to 9.8 m per second square''' is the '''acceleration due to gravity '''and <br />
* '''l equal to zero point five meter''' is the '''length '''of the '''pendulum.'''<br />
<br />
<br />
<br />
|-<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Motion of Simple pendulum<br />
| style="background-color:transparent;border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| For the given initial conditions, we have to solve the '''ODE''' within the '''time range zero less than equal to t less than equal to five'''. <br />
<br />
<br />
We also have to '''plot''' the solution. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Pendulum.sci on Scilab Editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for solving this problem. <br />
<br />
<br />
Open '''pendulum dot sci''' on''' Scilab editor.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
y0<nowiki>=</nowiki><nowiki>[</nowiki>%pi/4 0]'<nowiki>;</nowiki><br />
<br />
t0<nowiki>=</nowiki>0<nowiki>;</nowiki><br />
<br />
t<nowiki>=</nowiki>0:1:5<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The first line of the code defines the initial conditions of the '''ODE'''. <br />
<br />
<br />
Then we define the intial time value. And we provide the '''time range'''. <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
function '''dy'''<nowiki>=</nowiki>Pendulum('''t''', '''y''')<br />
<br />
'''dy'''(1) <nowiki>=</nowiki> '''y'''(2)<nowiki>;</nowiki><br />
<br />
'''dy'''(2) <nowiki>=</nowiki> (9.8/0.5)<nowiki>*</nowiki>sin('''y'''(1))<nowiki>;</nowiki><br />
<br />
endfunction<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Next, we convert the given equation to a system of '''first order ODEs'''. <br />
<br />
<br />
We substitute the values of '''g''' and '''l'''. <br />
<br />
<br />
Here we take '''y '''to be the given '''variable theta''' and '''y dash''' to be '''theta dash'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
y<nowiki>=</nowiki>ode(y0,t0,t,Pendulum)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we call the '''ode function''' with '''arguments y zero, t zero, t '''and the '''function Pendulum'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
plot(t,y(1,:),'-*',t,y(2,:),'-')<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The solution to the '''equation''' will be a '''matrix''' with two '''rows'''. <br />
<br />
<br />
The first '''row''' will contain the values of '''y''' in the given '''time range.'''<br />
<br />
<br />
The second '''row''' will contain the values of '''y dash '''within the '''time range'''.<br />
<br />
<br />
Hence we plot both the '''rows''' with respect to '''time'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file '''Pendulum dot sci'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show plot<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The plot shows how the values of '''y''' and '''y dash''' vary with '''time'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab console'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type y<br />
<br />
Press Enter<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| If you want to see the values of '''y''', type '''y''' on the '''console '''and press '''Enter'''.<br />
<br />
<br />
The values of '''y '''and '''y dash '''are displayed. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 10- Van der Pol Equation<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve '''Van der Pol equation''' using the '''ode function'''. <br />
<br />
<br />
We are given the '''equation '''<br />
<br />
'''v double dash of t plus epsilon into v of t square minus one into v dash of t plus v of t equal to zero'''. <br />
<br />
<br />
The initial '''conditions''' are '''v of two equal to one '''and '''v dash of two equal to zero'''. <br />
<br />
<br />
Assume '''epsilon is equal to zero point eight nine seven'''. <br />
<br />
<br />
We have to find the solution within the '''time range two less than t less than ten '''and then '''plot '''the solution.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Vanderpol.sci on scilab editor<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code for '''Van der Pol equation'''. <br />
<br />
<br />
Switch to '''Scilab editor '''and open '''van der pol dot sci'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
y0<nowiki>=</nowiki><nowiki>[</nowiki>1 0]'<nowiki>;</nowiki><br />
<br />
t0<nowiki>=</nowiki>0<nowiki>;</nowiki><br />
<br />
t<nowiki>=</nowiki>2:1:10<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the initial conditions of the '''ODEs''' and '''time''' and then define the '''time range'''. <br />
<br />
<br />
Since the '''inital time value '''is given as''' two''', we start the '''time range '''at''' two. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
function '''dy'''<nowiki>=</nowiki>Vanderpol('''t''', '''y''')<br />
<br />
'''dy'''(1) <nowiki>=</nowiki> '''y'''(2)<nowiki>;</nowiki><br />
<br />
'''dy'''(2) <nowiki>=</nowiki> -0.897<nowiki>*</nowiki>('''y'''(1).^2 - 1)<nowiki>*</nowiki>'''y'''(2) - '''y'''(1)<nowiki>;</nowiki><br />
<br />
endfunction<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we define the '''function van der pol '''and construct a system of '''first order ODEs'''. <br />
<br />
<br />
We substitute the value of '''epsilon '''with '''zero point eight nine seven'''. <br />
<br />
<br />
Here '''y '''refers to the '''voltage v'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
y<nowiki>=</nowiki>ode(y0,t0,t,Vanderpol)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we call '''ode function''' and solve the system of '''equations'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
plot(t,y(1,:),'-',t,y(2,:),'--')<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Finally we plot '''y '''and''' y dash versus t.''' <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file '''van der pol dot sci. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show plot<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''plot''' showing '''voltage versus time''' is shown. <br />
<br />
<br />
Let's move onto '''Lorenz system of equations.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 11, 12- Lorenz system<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''Lorenz system''' '''of''' '''equations''' is given by <br />
<br />
* '''x one dash equal to sigma into x two minus x one, '''<br />
* '''x two dash equal to one plus r minus x three into x one minus x two '''and''' '''<br />
* '''x three dash equal to x one into x two minus b into x three. '''<br />
<br />
The initial conditions are '''x one zero''' equal to '''minus ten, x two zero equal to ten '''and''' x three zero equal to twenty five'''. <br />
<br />
<br />
Let '''sigma '''be''' equal to ten, r '''be '''equal to twenty eight '''and''' b equal to eight by three. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Open Lorenz.sci on Scilab editor<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab editor''' and open '''Lorenz dot sci'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
x0<nowiki>=</nowiki><nowiki>[</nowiki>-10 10 25]'<nowiki>;</nowiki><br />
<br />
t0<nowiki>=</nowiki>0<nowiki>;</nowiki><br />
<br />
t<nowiki>=</nowiki>0:1:25<nowiki>;</nowiki><br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We start by defining the initial conditions of the''' ODEs'''. <br />
<br />
<br />
Since there are three different '''ODEs''', there are three initial conitions. <br />
<br />
<br />
Then we define the '''inital time''' condition and next the '''time range.''' <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
function '''dx'''<nowiki>=</nowiki>Lorenz('''t''', '''x''')<br />
<br />
sigma <nowiki>=</nowiki> 10<nowiki>;</nowiki><br />
<br />
r <nowiki>=</nowiki> 28<nowiki>;</nowiki><br />
<br />
b <nowiki>=</nowiki> 8/3<nowiki>;</nowiki><br />
<br />
'''dx'''(1) <nowiki>=</nowiki> sigma<nowiki>*</nowiki>('''x'''(2) - '''x'''(1) )<nowiki>;</nowiki><br />
<br />
'''dx'''(2) <nowiki>=</nowiki> ((1 + r) - '''x'''(3))<nowiki>*</nowiki>'''x'''(1) - '''x'''(2)<nowiki>;</nowiki><br />
<br />
'''dx'''(3) <nowiki>=</nowiki> '''x'''(1)<nowiki>*</nowiki>'''x'''(2) - b<nowiki>*</nowiki>'''x'''(3)<nowiki>;</nowiki><br />
<br />
endfunction<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the '''function Lorenz''' and then define the given constants '''sigma, r '''and''' b.''' Then we define the '''first order ODEs'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
x<nowiki>=</nowiki>ode(x0,t0,t,Lorenz)<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we call the '''ode function''' to solve the '''Lorenz system of equations'''. <br />
<br />
<br />
We equate the solution to '''x'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
plot(t,x(1,:),'**',t,x(2,:),'--', t,x(3,:),'..')<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we '''plot x one, x two '''and''' x three versus time. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Save and execute the file''' Lorenz dot sci. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show plot<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''plot''' of '''x one, x two''' and '''x three versus time''' is shown. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13- Summary<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial. <br />
<br />
<br />
In this tutorial we have learnt to develop '''Scilab code''' to solve an '''ODE''' using '''Scilab ode function'''. <br />
<br />
<br />
Then we have learnt to '''plot''' the solution. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 14'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * About the Spoken Tutorial Project<br/> <br />
<br />
* Watch the video available given at the link shown below <br/> <br />
<br />
* It summarises the Spoken Tutorial project<br/> <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 15'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 16'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil from IIT Bombay signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Linear-equations-Iterative-Methods/EnglishScilab/C4/Linear-equations-Iterative-Methods/English2013-12-18T05:02:21Z<p>Lavitha Pereira: Created page with ''''Title of script''': Solving System of Linear Equations using Iterative Methods '''Author: Shamika''' '''Keywords: System of linear equations, Iterative Methods''' {| styl…'</p>
<hr />
<div>'''Title of script''': Solving System of Linear Equations using Iterative Methods<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: System of linear equations, Iterative Methods'''<br />
<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “'''Solving System of Linear Equations using Iterative Methods'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to:<br />
<br />
* Solve system of linear equations using iterative methods<br />
* Develop Scilab code to solve linear equations<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 3-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using '''Ubuntu 12.04''' as the operating system with '''Scilab 5.3.3''' version<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before practising this tutorial, a learner should have basic knowledge of '''Scilab and Solving Linear Equations'''<br />
<br />
<br />
For Scilab, please refer to the relevant tutorials available on the '''Spoken Tutorial '''website.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Jacobi Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * The first iterative method we will be studying is '''Jacobi method.'''<br />
* Given a '''system of linear equations, with n equations and n unknowns'''<br />
* We rewrite the equations such tha'''t x of i k plus one is equal to b i minus summation of a i j x j k from j equal to one to n divided by a i i where i is from one to n'''<br />
* We assume values for each''' x of i'''<br />
* Then we substitute the values in the equations obtained in the previous step.<br />
* We continue the iteration until the solution converges.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us solve this example using '''Jacobi Method'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab and open JacobiIteration_final.sci<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us look at the code for '''Jacobi Method'''.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''format('e',20)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We use '''format''' method to specify the format of the displayed answers on the Scilab console.<br />
* Here '''e '''denotes the answer should be in '''scientific notation''' and '''twenty''' specifies the number of digits to be displayed.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''A=input("Enter the coeffiecient matrix of nxn: ")'''<br />
<br />
'''b=input("Enter the right-hand side matrix nx1: ")'''<br />
<br />
'''x0=input("Initial approximation nx1: ")'''<br />
<br />
'''MaxIter=input("Maximum no. of iterations: ")'''<br />
<br />
'''tol=input("Enter the convergence tolerance :")//stop if norm <nowiki>change in x < tol</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we use '''input''' function to get the values for the '''matrices coefficient matrix, right hand side matrix, initial values matrix, maximum number of iteration and convergence tolerance'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''<nowiki>[m, n] = size( A )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we use''' size '''function to check if '''A matrix is a square matrix.'''<br />
* If it isn't, we use '''error function''' to display an error<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''for i=1:1:m'''<br />
<br />
'''sum=0;'''<br />
<br />
'''for j=1:1:m'''<br />
<br />
'''sum=sum+abs(A(i,j));'''<br />
<br />
'''end'''<br />
<br />
'''<nowiki>if 2*abs(A(i,i))<sum then</nowiki>'''<br />
<br />
'''error("the matrix is not diagonally dominant")'''<br />
<br />
'''end'''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We then check if matrix A is '''diagonally dominant'''.<br />
* The first half calculates the sum of each row of the matrix.<br />
* Then it checks if the twice the product of the diagonal element is greater than the sum of the elements of that row.<br />
* If it isn't, an error is displayed using '''error function'''.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''<nowiki>function [ solution ] = JacobiIteration( A, b, x0, MaxIter, tol )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we define the function '''Jacobi Iteration''' with input arguments '''A, b , x zero, maximum iteration and tolerance level'''.<br />
* Here '''x zero''' is the '''initial values matrix'''.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''if ( length(x0) ~= n )'''<br />
<br />
'''error( "Sizes of input matrix and input vector do not match" )'''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We check if the size of A matrix and initial values matrix are compatible with each other.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''xk = x0'''<br />
<br />
'''for k = 1 : 1 : MaxIter'''<br />
<br />
'''for i = 1 : n'''<br />
<br />
'''xkp1( i ) = (b(i) - A(i, 1:i-1)*xk(1:i-1) - A(i, i+1:n)*xk(i+1:n)) / A(i,i) //Computes the jacobian updates'''<br />
<br />
'''end'''<br />
<br />
<br />
'''RelativeError = norm( xkp1 - xk, 'inf' ) / norm( xkp1, 'inf' )'''<br />
<br />
'''printf( "iter = %d, Relative Error = %g\n", k, RelativeError )'''<br />
<br />
'''xk = xkp1'''<br />
<br />
<br />
'''<nowiki>if ( RelativeError < tol )</nowiki>'''<br />
<br />
'''break'''<br />
<br />
'''end'''<br />
<br />
'''end'''<br />
<br />
<br />
'''solution = xkp1'''<br />
<br />
<br />
'''endfunction'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We calculate the value for''' x k p one''' and then check if the '''relative error is lesser than tolerance level.'''<br />
* If it is lesser than '''tolerance level''', we break the iteration and the solution is returned.<br />
* Finally we '''end the function'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us '''save and execute the function'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Switch to '''Scilab console'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Enter these values on Scilab console for each prompt<br />
<br />
Enter the coeffiecient matrix of nxn: '''<nowiki>[2 1;5 7]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us enter the values at each prompt.<br />
<br />
* The '''coefficient matrix A is '''<br />
* '''open square bracket two space one '''<br />
* '''semi colon '''<br />
* '''five space seven close square bracket'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type<br />
<br />
Enter the right-hand side matrix nx1: '''<nowiki>[11; 13]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we type<br />
* '''open square bracket eleven '''<br />
* '''semicolon '''<br />
* '''thirteen'''<br />
* '''press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type<br />
<br />
Initial approximation nx1: '''<nowiki>[1;1]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * The initial values matrix is <br />
* '''open square bracket one '''<br />
* '''semi colon '''<br />
* '''one close square bracket'''<br />
* '''press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type<br />
<br />
Maximum no. of iterations: '''25'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * The maximum number of iterations is''' twenty five'''<br />
* '''press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type<br />
<br />
Enter the convergence tolerance :'''0.00001'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let the convergence tolerance level be''' zero point zero zero zero zero one'''<br />
* '''press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type:<br />
<br />
'''JacobiIteration( A, b, x0, MaxIter, tol )'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We call the function by typing '''Jacobi Iteration open paranthesis A comma b comma x zero comma M a x I t e r comma t o l close paranthesis'''<br />
* '''Press Enter'''<br />
* The values for '''x one''' and '''x two''' are shown on the console. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7- Gauss Seidel Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us now study Gauss Seidel method. <br />
* Given a '''system of linear equations, with n equations and n unknows'''<br />
* We rewrite the equations for each unknown, '''by subtracting the other variables and their coefficients from the corresponding right hand side element.'''<br />
* Then we divide this '''by the coefficient a i i of the unknown variable for that variable'''.<br />
* This is done for every given equation.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8- Gauss Seidel<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * In '''Jacobi method''', for '''the computation of x of i k plus one, every element of x of i k is used except x of i k plus one'''<br />
* In '''Gauss Seidel method''', we '''over write the value of x of i k with x of i k plus one'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us solve this example using '''Gauss Seidel Method'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab editor and open GaussSeidel.sci<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us look at the code for '''Gauss Seidel Method'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''format('e',20)'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * The first line specifies the format of the displayed answer on the console using '''format function'''.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''A=input("Enter the coeffiecient matrix of nxn: ")'''<br />
<br />
'''b=input("Enter the right-hand side matrix nx1: ")'''<br />
<br />
'''x0=input("Initial approximation nx1: ")'''<br />
<br />
'''MaxIter=input("Maximum no. of iterations: ")'''<br />
<br />
'''tol=input("Enter the convergence <nowiki>tolerance :")//stop if norm change in x < tol</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we use '''input function''' to get the values of '''coefficient matrix, right hand side matrix, initial values of the variables matrix, maximum number of iteration and tolerance level'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''<nowiki>function [ solution ] = GaussSeidel( A, b, x0, MaxIter, tol )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we define the function '''Gauss Seidel '''with''' input arguments A comma b comma x zero comma Max Iterations '''and '''tolerance level''' and output argument solution<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''// Check that the matrix is square'''<br />
<br />
'''<nowiki>[m, n] = size( A )</nowiki>'''<br />
<br />
'''if ( m ~= n )'''<br />
<br />
'''error( "The input matrix is not square" )'''<br />
<br />
'''end'''<br />
<br />
<br />
'''// Check that the initial vector is of the same size'''<br />
<br />
'''if ( length(x0) ~= n )'''<br />
<br />
'''error( "Sizes of input matrix and input vector do not match" )'''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We check if '''matrix A is square''' and the sizes of '''initial vector and matrix A''' are compatible using''' size and length function'''.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
'''xk = x0'''<br />
<br />
'''xkp1 = zeros( xk )'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we start the iterations. We equate the '''initial values vector x zero to x k.'''<br />
* We create a '''matrix of zeros with the same size of x k and call it x k p one.'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight<br />
<br />
for k = 1 : 1 : MaxIter<br />
<br />
<br />
'''// Computes the Gauss-Seidel update'''<br />
<br />
'''for i = 1 : n'''<br />
<br />
'''xkp1( i ) = (b(i) - A(i, 1:i-1)*xkp1(1:i-1) - A(i,i+1:n)*xk(i+1:n)) / A(i,i)'''<br />
<br />
'''// x^{k+1}'''<br />
<br />
'''end'''<br />
<br />
'''// Applies the relaxation'''<br />
<br />
'''RelativeError = norm( xkp1 - xk, 'inf' ) / norm( xkp1, 'inf' )'''<br />
<br />
'''printf( "iter = %d, Relative Error = %g\n", k, RelativeError )'''<br />
<br />
'''xk = xkp1'''<br />
<br />
'''<nowiki>if ( RelativeError < tol )</nowiki>'''<br />
<br />
'''break'''<br />
<br />
'''end'''<br />
<br />
'''end'''<br />
<br />
<br />
'''solution = xkp1'''<br />
<br />
<br />
'''endfunction'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We solve for each equation to get the value of the unknown variable for that equation using '''x k p one'''.<br />
* At each iteration, the value of '''x k p one''' gets updated.<br />
* Also, we check if '''relative error is lesser than specified tolerance level'''.<br />
* If it is, we '''break the iteration'''.<br />
* Then '''equate x k p one to the variable solution'''.<br />
* Finally, we '''end the function'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us '''save and execute the function'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Switch to '''Scilab console'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type the following on Scilab console:<br />
<br />
For first prompt<br />
<br />
'''<nowiki>[2 1;5 7]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * For the first prompt we type '''matrix A.'''<br />
<br />
* Type <br />
* '''open square bracket two space one '''<br />
* '''semi colon '''<br />
* '''five space seven close square bracket'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Second prompt<br />
<br />
'''<nowiki>[11; 13]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * For the next prompt, type<br />
* '''left square bracket eleven'''<br />
* '''semi colon'''<br />
* '''thirteen right square bracket'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| For third prompt<br />
<br />
'''<nowiki>[1;1]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We provide the values of '''initial value vector '''by typing <br />
* '''open square bracket one '''<br />
* '''semicolon '''<br />
* '''one close square bracket'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| For fourth prompt<br />
<br />
'''25'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Then we specify the''' maximum number of iterations to be twenty five'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| For fifth prompt<br />
<br />
'''0.00001'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us define tolerance level to be''' zero point zero zero zero zero one'''<br />
* '''Press enter'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Then type:<br />
<br />
'''GaussSeidel( A, b, x0, MaxIter, tol )'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Finally we call the function by typing''' G a u s s S e i d e l open paranthesis A comma b comma x zero comma M a x I t e r comma t o l close paranthesis'''<br />
* '''Press enter'''<br />
* The values of '''x one and x two '''are displayed.<br />
* The number of iterations to solve the same problem are lesser than '''Jacobi method'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13- Solve<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Solve this problem on your own using '''Jacobi and Gauss Seidel '''methods<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 14- Summary<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In this tutorial, we have learnt to:<br />
<br />
* Develop '''Scilab code''' for solving system of linear equations<br />
* Find the value of the unknown variables of a system of linear equations<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 15'''<br />
<br />
'''Title: About the Spoken Tutorial Project'''<br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-][http://spoken-tutorial.org/What_is_a_Spoken_Tutorial tutorial.org/What_is_a_Spoken_Tutorial]<br />
<br />
* It summarises the Spoken Tutorial project<br />
<br />
* If you do not have good bandwidth, you can download and watch it<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * About the Spoken Tutorial Project<br />
<br />
* Watch the video available at the following link<br />
<br />
* It summarises the Spoken Tutorial project<br />
<br />
* If you do not have good bandwidth, you can download and watch it<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 16'''<br />
<br />
'''Title: Spoken Tutorial Workshops'''<br />
<br />
The Spoken Tutorial Project Team<br />
<br />
* Conducts workshops using spoken tutorials<br />
<br />
* Gives certificates for those who pass an online test<br />
<br />
* For more details, please write to contact@spoken-tutorial.org<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team<br />
<br />
* Conducts workshops using spoken tutorials<br />
<br />
* Gives certificates for those who pass an online test<br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 17'''<br />
<br />
'''Title: Acknowledgement'''<br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project<br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India<br />
<br />
* More information on this Mission is available at<br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro]<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India<br />
* More information on this Mission is available at<br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * This is Ashwini Patil signing off. Thank you for joining. <br />
<br />
<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Control-systems/EnglishScilab/C4/Control-systems/English2013-12-18T04:54:59Z<p>Lavitha Pereira: Created page with ''''Title of script''': Advanced Control Systems '''Author: Manas, Shamika''' '''Keywords: control, continuous time, response''' {| style="border-spacing:0;" ! <center>Visua…'</p>
<hr />
<div>'''Title of script''': Advanced Control Systems <br />
<br />
'''Author: Manas, Shamika'''<br />
<br />
'''Keywords: control, continuous time, response'''<br />
<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 1'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the spoken tutorial on “Advanced '''Control of Continuous Time systems'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 2,3-Learning Objective Slide'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
1.Define a continuous time system: second and higher order <br />
<br />
2.Plot response to step and sine inputs <br />
<br />
3.Do a Bode plot<br />
<br />
4.Study numer and denom Scilab functions<br />
<br />
5. Plot poles and zeros of a system<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 4-System Requirement slide'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using '''Ubuntu 12.04''' as the operating system with '''Scilab 5.3.3''' version <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Prerequisite slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before practising this tutorial, a learner should have basic knowledge of '''Scilab and control systems. '''<br />
<br />
<br />
For scilab, please refer to the Scilab tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 6'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In this tutorial, I will describe how to define '''second-order linear system'''.<br />
<br />
<br />
So, first we have to define '''complex domain variable s'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the Scilab Console Window and type:<br />
<br />
'''s <nowiki>=</nowiki> poly(0, ’s’)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us switch to the '''Scilab Console''' Window.<br />
<br />
Here type: <br />
<br />
<br />
'''s equal to poly open paranthesis zero comma open single quote s close single quote close paranthesis'''<br />
<br />
<br />
and press '''Enter'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Display the output polynomial <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The output is '''s'''.<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| On the console window type:<br />
<br />
s <nowiki>=</nowiki> %s <br />
<br />
and press '''Enter'''.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| There is another way to define ''''s'''' as '''continuous time complex variable'''<br />
<br />
On the '''Console '''window type: <br />
<br />
'''s equal to percentage s'''<br />
<br />
and press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 7'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us study the''' syslin Scilab command'''<br />
<br />
Use the '''Scilab''' function ’'''syslin'''’ to define the continuous time system <br />
<br />
<br />
'''G of s is equal to 2 over 9 plus 2 s plus s square'''<br />
<br />
<br />
Use '''csim''' with '''step''' option to obtain the '''step response''' and then '''plot the step response. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the Scilab Console Window and type:<br />
<br />
sysG <nowiki>=</nowiki> syslin(’c’,2/(sˆ2+2*s+9))<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us switch to the '''Scilab Console''' Window.<br />
<br />
Here type: <br />
<br />
<br />
'''sys capital G equal to syslin open paranthesis open single quote c close single quote comma two divided by open paranthesis s square plus two asterik s plus nine close paranthesis close paranthesis '''<br />
<br />
<br />
'''Here c is used as we are defining a continuous time system'''<br />
<br />
<br />
'''Press Enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Display the output generated<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The output is linear second order system represented by <br />
<br />
'''2 over 9 plus 2 s plus s square'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type:<br />
<br />
t=0:0.1:10;<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type<br />
<br />
'''t equal to zero colon zero point one colon ten semi colon'''<br />
<br />
Press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Then type<br />
<br />
y1 <nowiki>=</nowiki> csim(’step’, t, sysG);<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type<br />
<br />
<br />
'''y one is equal to c sim open paranthesis open single quote step close single quote comma t comma sys capital G close the paranthesis semicolon'''<br />
<br />
<br />
Press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Then type<br />
<br />
plot(t, y1);<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type<br />
<br />
'''plot open paranthesis t comma y one close paranthesis semicolon'''<br />
<br />
<br />
Press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Display the output generated<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The output will display the '''step response''' of the given second order system.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 8'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us study the '''Second Order system response for sine input'''. <br />
<br />
'''Sine inputs '''can easily be given as inputs to a second order system to a continuous time system. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the Scilab Console Window and type this on your Scilab Console<br />
<br />
<br />
u2=sin(t);<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us switch to the '''Scilab Console''' Window.<br />
<br />
<br />
Type<br />
<br />
'''U two is equal to sine open paranthesis t close paranthesis semi colon'''<br />
<br />
<br />
Press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type y2 <nowiki>=</nowiki> csim(u2, t, sysG);<br />
<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Then type'''<br />
<br />
'''y two is equal to csim open paranthesis u two comma t comma sys capital G close the bracket semicolon'''<br />
<br />
<br />
'''Press Enter.'''<br />
<br />
<br />
Here we are using''' sysG, the continuous time second order system '''we had defined earlier.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type plot(t, <nowiki>[u2;</nowiki> y2])<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type<br />
<br />
'''plot open paranthesis t comma open square bracket u two semicolon y two close square bracket close paranthesis'''<br />
<br />
<br />
Make sure that you place a '''Semicolon between u2 and y2 because u2 and y2 are row vectors of the same size'''<br />
<br />
<br />
Press '''Enter'''.<br />
<br />
<br />
This plot shows the '''response of the system''' to a '''step input and sine input.''' It is called the '''response plot'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 9, 10'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Response Plot''' plots both the input and the output on the same graph.<br />
<br />
As expected,<br />
<br />
* the output is also a '''sine wave''', and<br />
* there is a '''phase lag between the input and output'''<br />
* '''amplitude''' is different for the input and the output as it is being passed through a transfer function. <br />
* This is a typical '''under-damped''' example<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 11'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us plot '''bode plot''' of 2 over 9 plus 2 s plus s square<br />
<br />
<br />
Please note command ''''f r e q' '''is a '''Scilab''' command for '''frequency response.'''<br />
<br />
Do not use '''f r e q''' as a '''variable''' !!<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the Scilab console and type<br />
<br />
fr <nowiki>=</nowiki> <nowiki>[0.01:0.1:10];</nowiki> // Hertz<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Open the '''Scilab''' '''Console''' and type<br />
<br />
<br />
'''f r is equal to open square bracket zero point zero one colon zero point one colon ten close square bracket semicolon. '''<br />
<br />
Press '''Enter.'''<br />
<br />
<br />
The '''frequency '''is in''' Hertz. '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type bode(sysG, fr) and press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type <br />
<br />
'''bode open paranthesis sys capital G comma fr close paranthesis'''<br />
<br />
and press '''Enter.'''<br />
<br />
<br />
The '''bode plot''' is shown<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 12'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us define another system<br />
<br />
We have an '''over-damped system p equal to s square plus nine s plus nine'''<br />
<br />
Let us plot '''step response''' for this system<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to the Scilab console and type<br />
<br />
p=s^2 +9*s+9<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to Scilab console<br />
<br />
Type this on your '''Scilab Console'''<br />
<br />
<br />
'''p is equal to s square plus nine asterik s plus nine'''<br />
<br />
<br />
and then press '''Enter'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type sys2 <nowiki>=</nowiki> syslin('c', 9/p)<br />
<br />
Press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then type this on your '''Scilab Console'''<br />
<br />
'''sys two is equal to syslin open paranthesis open single quote c close single quote comma nine divided by p close paranthesis'''<br />
<br />
<br />
and press '''Enter.'''<br />
<br />
<br />
Then type<br />
<br />
'''t equal to zero colon zero point one colon ten semi colon'''<br />
<br />
'''Press Enter.'''<br />
<br />
<br />
'''y is equal to c sim open paranthesis open single quote step close single quote comma t comma sys two close the paranthesis semicolon'''<br />
<br />
<br />
'''Press enter'''<br />
<br />
<br />
Then type''' plot open paranthesis t comma y close paranthesis. '''<br />
<br />
<br />
'''Press enter'''<br />
<br />
The '''response plot for over damped system''' is shown.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| roots(p)<br />
<br />
and press Enter.<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To find the '''roots of p '''type this on your on '''Scilab''' '''console'''.<br />
<br />
'''Roots of p'''<br />
<br />
and press '''Enter'''.<br />
<br />
<br />
These '''roots are the poles''' of the system '''sys two'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Display the output'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''roots or poles''' of the system are shown<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 13, 14'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Please plot '''Step response''' for this system <br />
<br />
<br />
along similar lines as for '''over damped system'''.<br />
<br />
<br />
'''G of s is equal to 2 over 9 plus 6 s plus s square''' which is a '''critically damped system'''<br />
<br />
<br />
Then '''G of s is equal to two over 9 plus s square''' which is an '''undamped system'''<br />
<br />
<br />
'''G of s is equal to 2 over 9 minus 6 s plus s square''' which is an '''unstable system'''<br />
<br />
<br />
Check '''response''' to '''sinusoidal inputs''' for all the cases and '''plot bode plot '''too.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Switch to the Scilab Console Window and type''' this on your '''Scilab Console'''<br />
<br />
<br />
--> '''sys3 <nowiki>=</nowiki> syslin(’c’,s+6,sˆ2+6*s+19)''' and press '''Enter'''<br />
<br />
<br />
Alternatively:<br />
<br />
Type this on your '''Console'''<br />
<br />
<br />
--> '''g <nowiki>=</nowiki> (s+6)/(sˆ2+6*s+19)''' and press '''Enter'''<br />
<br />
Then type this on your '''Scilab Console'''<br />
<br />
<br />
--> '''sys4 <nowiki>=</nowiki> syslin(’c’,g)''' and press '''Enter'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to Scilab console. <br />
<br />
<br />
For a general '''transfer function, the numerator and denominator '''can be specified separately. Let me show you how.<br />
<br />
<br />
Type this on your '''Scilab Console'''<br />
<br />
<br />
'''sys three is equal to syslin open paranthesis open single quote c close single quote comma s plus six comma s square plus six asterik s plus nineteen close paranthesis'''<br />
<br />
Press '''Enter'''<br />
<br />
<br />
Another way of defining a system is to type<br />
<br />
<br />
'''g is equal to open paranthesis s plus six close paranthesis divided by open paranthesis s square plus six asterik s plus nineteen close paranthesis'''<br />
<br />
<br />
'''Press enter'''<br />
<br />
<br />
Then type this on your '''Scilab Console'''<br />
<br />
<br />
'''sys four is equal to syslin open paranthesis open single quote c close single quote comma g close paranthesis'''<br />
<br />
<br />
Press '''enter'''<br />
<br />
<br />
Both ways, we get the same output <br />
<br />
'''six plus s over 19 plus six s plus s square'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 15,16'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The variable ’'''sys'''’ is of type ’'''rational'''’.<br />
<br />
<br />
Its '''numerator and denominator''' can be extracted by various ways.<br />
<br />
<br />
'''Sys of two , numer of sys '''or '''numer of g '''gives the '''numerator'''<br />
<br />
<br />
The '''denominator '''can be calculated using '''sys(3) or denom of sys functions'''. <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 17<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''poles and zeros''' of the system can be plotted using '''p l z r''' function.<br />
<br />
The syntax is '''p l z r of sys'''<br />
<br />
The plot shows '''x for poles''' and '''circles for zeros.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Switch to Scilab and '''type this on your '''Scilab Console'''<br />
<br />
<br />
--> '''sys3(2)''' and press '''Enter'''<br />
<br />
'''Type'''<br />
<br />
'''numer(sys3)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab '''console.<br />
<br />
<br />
Type this on your '''Scilab Console'''<br />
<br />
'''sys three open paranthesis two close paranthesis'''<br />
<br />
<br />
Press enter<br />
<br />
This gives the '''numerator''' of the rational function ’'''sys three'''’ that is '''6 + s'''<br />
<br />
<br />
Otherwise you can type<br />
<br />
'''numer open paranthesis sys three close paranthesis'''<br />
<br />
The '''numerator''' of '''sys three''' is shown<br />
<br />
<br />
To get the '''denominator '''type <br />
<br />
'''sys three open paranthesis three close paranthesis. Press enter'''<br />
<br />
<br />
The '''denominator '''of the function is shown.<br />
<br />
You can also type '''denom open paranthesis sys three close paranthesis. Press enter'''<br />
<br />
<br />
Then type '''p l z r open paranthesis sys three close paranthesis. Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Display output'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The '''output graph''' plots the '''poles and zeros'''.<br />
<br />
It shows '''cross and circle for poles and zeros''' of the system respectively<br />
<br />
It is plotted on the '''complex plane'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Slide 18'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In this tutorial we have learnt how to:<br />
<br />
* Define a system by its '''transfer''' function.<br />
* Plot '''step and sinusoidal responses'''.<br />
* Extract '''poles and zeros''' of a '''transfer''' function.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 19'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Watch the video available at the following link <br />
* It summarises the Spoken Tutorial project <br />
* If you do not have good bandwidth, you can download and watch it <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 20'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide '''<br />
<br />
'''Title: Acknowledgement''' 21<br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''On previous slide'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is Ashwini Patil signing off. Thank you for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Integration/EnglishScilab/C4/Integration/English2013-12-18T04:46:50Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Title of script''': Numerical Methods for Integration<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: Integration, Numerical Methods, integral'''<br />
<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “''' Composite Numerical Integration'''”''' '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2,3 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Develop '''Scilab''' code for different '''Composite Numerical Integration algorithms'''<br />
* Divide the''' integral''' into equal '''intervals'''<br />
* Apply the algorithm to each '''interval'''<br />
* Calculate the '''composite value of the integral''' <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * To record this tutorial, I am using '''Ubuntu 12.04''' as the operating system with '''Scilab 5.3.3''' version <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Before practising this tutorial, a learner should have basic knowledge of '''Scilab and Integration using Numerical Methods'''<br />
<br />
* For Scilab, please refer to the relevant tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 6- Numerical Integration<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Numerical Integration''' is the:<br />
* Study of how the numerical value of an '''integral '''can be found<br />
* It is used when exact mathematical integration is not available<br />
* It approximates a definite '''integral '''from values of the <br/> '''integrand '''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7,8- Composite Trapezoidal Rule-I<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Let us study Composite Trapezoidal Rule. This rule''' is<br />
<br />
* The extension of '''trapezoidal rule'''<br />
* We divide the interval '''a comma b '''into '''n''' equal intervals <br />
* Then,<br />
* '''h equal to b minus a divided by n''' is the common length of the intervals <br />
* Then '''composite trapezoidal rule '''is given by <br />
* '''The integral of the function F of x in the interval a to b is approximately equal to h multiplied by the sum of the values of the function at x zero to x n'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Example<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us solve an example using '''composite trapezoidal rule''':<br />
* Assume the number of intervals '''n''' is equal to ten.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab editor<br />
<br />
<br />
Highlight<br />
<br />
'''<nowiki>function [I1] </nowiki><nowiki>= Trap_composite(f, a, b, n)</nowiki>'''<br />
<br />
'''x = linspace(a, b, n+1)'''<br />
<br />
<br />
'''I1 = (h/2)*(2*sum(f(x)) - f(x(1)) - f(x(n+1)))'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us look at the code for C'''omposite Trapezoidal Rule '''on''' Scilab Editor'''<br />
* We first define the function with parameters''' f , a , b , n. f refers to the function we have to solve, a is the lower limit of the integral, b is the upper limit of the integral and n is the number of intervals. '''<br />
* '''linspace''' function is used to create ten equal intervals between zero and one<br />
* '''We find the value of the integral and store it in I one'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute on Scilab editor and choose Save and Execute the code<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Click on '''Execute''' on '''Scilab editor''' and choose '''Save and Execute''' the code<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab Console<br />
<br />
<br />
'''<nowiki>deff ('[y]=f(x)','y=1/(2*x+1)')</nowiki>'''<br />
<br />
<br />
'''Trap_composite(f, 0, 1, 10)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Define the example function by typing:<br />
* '''d e f f open paranthesis open single quote open square bracket y close square bracket is equal to f of x close quote comma open quote y is equal to one by open paranthesis two asterisk x plus one close paranthesis close quote close paranthesis'''<br />
* Press '''enter'''<br />
* Type <br />
* '''Trap underscore composite open paranthesis f comma zero comma one comma ten close paranthesis'''<br />
* Press '''enter'''<br />
* The answer is displayed on the console<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 10, 11- Composite Simpson's Rule<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Next we shall study '''Composite simpson's rule. In this rule''' we <br />
<br />
* decompose the interval''' a comma b''' into '''''n is greater than 1 '''''subintervals of equal length <br />
* Apply '''Simpson's rule''' to each interval<br />
* We get the value of the integral to be<br />
* '''h by three multiplied by the sum of f zero, four into f one , two into f two to f n'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 12- Example <br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us solve an example using '''Composite Simpson's rule'''<br />
* We are given a '''function one by one plus x cube d x in the interval one to two'''<br />
* Let the number of intervals be '''twenty'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab Editor and show the code for Simp_composite.sci<br />
<br />
<br />
Highlight<br />
<br />
'''function I = Simp_composite(f, a, b, n)'''<br />
<br />
<br />
'''for i = 1:(n/2)-1 '''<br />
<br />
'''x1(i) = x(2*i) '''<br />
<br />
'''end '''<br />
<br />
'''for j = 2:n/2 '''<br />
<br />
'''x2(i) = x(2*i-1) '''<br />
<br />
'''end'''<br />
<br />
<br />
'''I = (h/3)*(f(x(1)) + 2*sum(f(x1)) + 4*sum(f(x2)) + f(x(n)))'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us look at the code for '''Composite simpson's rule'''<br />
* '''We first define the function with parameters f , a , b , n. '''<br/> '''f refers to the function we have to solve, a is the lower limit of the integral, b is the upper limit of the integral and n is the number of intervals.'''<br />
* We find two sets of points<br />
* We find the value of the function with one set and multiply it with '''two'''<br />
* With the other set we find the value and multiply it with '''four'''<br />
* We sum these values and multiply it with '''h by three and store the final value in I'''<br />
* Let us execute the code<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and choose<br />
<br />
Save and execute the file<br />
<br />
Simp_composite.sci<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Save and execute the file<br />
* '''Simp underscore composite dot s c i'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab Console<br />
<br />
'''Type '''<br />
<br />
<br />
'''clc'''<br />
<br />
<br />
'''<nowiki>deff ('[y]=f(x)','y=1/(1+x^3)')</nowiki>'''<br />
<br />
<br />
'''Simp_composite( f, 1, 2 20)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let me clear the screen first.<br />
* Define the function given in the example by typing<br />
* '''d e f f open paranthesis open single quote open square bracket y close square bracket is equal to f of x close quote comma open quote y is equal to one divided by open paranthesis one plus x cube close paranthesis close quote close paranthesis'''<br />
* Press '''enter'''<br />
* '''Type Simp underscore composite open paranthesis f comma one comma two comma twenty close paranthesis'''<br />
* Press '''enter'''<br />
* The answer is displayed on the console<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13, 14- Composite Midpoint Rule<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us now look at '''Composite Midpoint Rule. It'''<br />
* Integrates polynomials of degree one or less<br />
* Divides the interval '''a comma b into n subintervals''' of equal width<br />
* Finds the '''midpoint '''of each interval indicated by '''x i '''<br />
* We find the sum of the values of the integral at each midpoint <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 15- Example<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this problem using '''Composite Midpoint Rule'''<br />
* '''We are given a function one minus x square d x in the interval zero to one point five'''<br />
* We assume '''n''' is equal to''' twenty'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab Editor<br />
<br />
<br />
Show the file mid_composite.sci<br />
<br />
<br />
Highlight <br />
<br />
<br />
'''function I = mid_composite(f, a, b, n)'''<br />
<br />
<br />
'''x = linspace(a + h/2, b - h/2, n) '''<br />
<br />
<br />
'''I = h*sum(f(x))'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let us look at the code for '''Composite Midpoint rule'''<br />
* '''We first define the function with parameters f , a , b , n. '''<br/> '''f refers to the function we have to solve, a is the lower limit of the integral, b is the upper limit of the integral and n is the number of intervals.'''<br />
* We find the '''midpoint '''of each interval<br />
* Find the value of '''integral''' at each '''midpoint''' and then find the sum and store it in I. <br />
* Let us now solve the example <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and choose<br />
<br />
Save and execute the file mid_composite.sci<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Save and execute the file '''mid underscore composite dot s c i '''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| On the Scilab Console type:<br />
<br />
<br />
'''clc'''<br />
<br />
<br />
'''<nowiki>deff ('[y]=f(x)','y=1-x^2')</nowiki>'''<br />
<br />
<br />
Type '''mid_composite(f, 0, 1.5, 20)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Let me clear the screen<br />
* We define the function given in the example by typing <br />
* '''d e f f open paranthesis open single quote open square bracket y close square bracket is equal to f of x close quote comma open quote y is equal to one minus x square close quote close paranthesis'''<br />
* Press '''enter'''<br />
* Then type <br/> '''mid underscore composite open paranthesis f comma zero comma one point five comma twenty close paranthesis'''<br />
* Press '''enter'''<br />
* The answer is displayed on the console<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 16- Summary<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial. In this tutorial we have learnt to:<br />
<br />
* Develop '''Scilab''' code for '''numerical integration'''<br />
* Find the value of an '''integral '''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 17'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Watch the video available at the following link <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 18'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 12'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * This is Ashwini Patil signing off. Thank you for joining. <br />
<br />
<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2013-12-18T04:44:05Z<p>Lavitha Pereira: /* Advanced Level Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans <br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
# '''Numerical methods- Iterative Methods'''<br />
#*Solve system of linear equations using iterative methods <br />
#*Develop Scilab code to solve linear equations<br />
# '''Numerical methods- Interpolation'''<br />
# '''Numerical methods- ODE- Euler methods'''<br />
# '''Numerical methods- ODE- Applications'''<br />
# ''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# '''Optimization of Non-linear Functions'''<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# '''Filter Design- Windowing Techniques'''<br />
# '''Filter Design- Window Based FIR Filter'''<br />
# '''Filter Design- IIR Digital Filter'''<br />
# '''Filter Design- Applying Digital Filter'''<br />
# '''Control systems'''<br />
#*Define a continuous time system: second and higher order<br />
#*Response plot for step input<br />
#*Response plot for sine input<br />
#*Bode plot<br />
#*Study numer and denom Scilab functions<br />
#*Plot poles and zeros of function<br />
# '''Discrete systems'''<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2013-12-18T04:42:37Z<p>Lavitha Pereira: /* Advanced Level Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans <br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
# '''Numerical methods- Iterative Methods'''<br />
#*Solve system of linear equations using iterative methods <br />
#*Develop Scilab code to solve linear equations<br />
# '''Numerical methods- Interpolation'''<br />
# '''Numerical methods- ODE- Euler methods'''<br />
# '''Numerical methods- ODE- Applications'''<br />
# ''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# '''Optimization of Non-linear Functions'''<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# '''Filter Design- Windowing Techniques'''<br />
# '''Filter Design- Window Based FIR Filter'''<br />
# '''Filter Design- IIR Digital Filter'''<br />
# '''Filter Design- Applying Digital Filter'''<br />
# '''Control systems'''<br />
# '''Discrete systems'''<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2013-12-17T04:46:03Z<p>Lavitha Pereira: /* Advanced Level Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans <br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
# '''Numerical methods- Iterative Methods'''<br />
# '''Numerical methods- Interpolation'''<br />
# '''Numerical methods- ODE- Euler methods'''<br />
# '''Numerical methods- ODE- Applications'''<br />
# ''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# '''Optimization of Non-linear Functions'''<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# '''Filter Design- Windowing Techniques'''<br />
# '''Filter Design- Window Based FIR Filter'''<br />
# '''Filter Design- IIR Digital Filter'''<br />
# '''Filter Design- Applying Digital Filter'''<br />
# '''Control systems'''<br />
# '''Discrete systems'''<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2013-12-17T04:43:45Z<p>Lavitha Pereira: /* Advanced Level Scilab */</p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans <br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# '''Numerical methods- Solving Non- linear Equation'''s<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
<br />
#'''Numerical methods- Iterative Methods'''<br />
#'''Numerical methods- Interpolation'''<br />
#'''Numerical methods- ODE- Euler methods'''<br />
#'''Numerical methods- ODE- Applications'''<br />
#''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# Optimization of Non-linear Functions<br />
#'''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# Filter Design- Windowing Techniques<br />
# Filter Design- Window Based FIR Filter<br />
# Filter Design- IIR Digital Filter<br />
# Filter Design- Applying Digital Filter<br />
# Control systems<br />
# Discrete systems<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/Scilab/C4/Linear-equations-Gaussian-Methods/EnglishScilab/C4/Linear-equations-Gaussian-Methods/English2013-12-17T04:31:40Z<p>Lavitha Pereira: </p>
<hr />
<div>'''Title of script''': Solving System of Linear Equations using Gauss Elimination and Gauss-Jordan Methods<br />
<br />
'''Author: Shamika'''<br />
<br />
'''Keywords: System of linear equations, Gaussian Methods'''<br />
<br />
<br />
{| style="border-spacing:0;"<br />
! <center>Visual Cue</center><br />
! <center>Narration</center><br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 1<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Dear Friends,<br />
<br />
Welcome to the Spoken Tutorial on “'''Solving System of Linear Equations using Gauss Elimination and Gauss-Jordan Methods'''”<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 2 -Learning Objective Slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| At the end of this tutorial, you will learn how to: <br />
<br />
* Solve system of linear equations using '''Scilab'''<br />
* Develop '''Scilab''' code to solve linear equations <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 3-System Requirement slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To record this tutorial, I am using <br />
<br />
'''Ubuntu 12.04''' as the operating system <br />
<br />
with '''Scilab 5.3.3''' version <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 4- Prerequisites slide<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| To practise this tutorial, a learner should have basic knowledge of '''Scilab '''<br />
<br />
<br />
and should know how to solve''' Linear Equations.'''<br />
<br />
<br />
To learn '''Scilab''', please refer to the relevant tutorials available on the '''Spoken Tutorial '''website. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 5- System of Linear Equations<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| A system of '''linear equations''' is a <br />
* Finite collection of<br />
* '''linear equations'''<br />
* of the same set of '''variables'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 7- Gaussian Elimination Method <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us study '''Gauss elimination method'''<br />
<br />
Given a system of equations<br />
<br />
* '''a x equal to b'''<br />
* with '''m '''equations and''' '''<br />
* '''n '''unknowns<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 8- Gaussian Elimination Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * We write the coefficients of the '''variables''' '''a one''' to''' a n''' <br />
* along with the '''constants b one''' to''' b n''' of the system of equations <br />
* in one '''matrix''' called the '''augmented matrix'''<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 9- Gaussian Elimination Method<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| How do we convert the '''augmented matrix '''to an '''upper triangular form''' '''matrix?'''<br />
<br />
<br />
We do so''' '''by performing row wise manipulation of the '''matrix'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 10- Example<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this system of equations using '''Gaussian elimination method'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab and open naivegaussianelimination.sci<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Before we solve the system, let us go through the code for '''Gaussian elimination method'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''format e comma twenty'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The first line of the code is '''format e comma twenty.'''<br />
<br />
<br />
This''' '''defines how many digits should be displayed in the answer. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Point to '''e '''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The letter '''e''' within single quotes denotes that the answer should be displayed in '''scientific notation '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Point to '''twenty'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The number '''twenty''' is the number of digits that should be displayed. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''funcprot'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The command '''funcprot''' is used to let '''Scilab '''know what to do when variables are redefined.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Point to '''zero'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The argument '''zero''' specifies that '''Scilab''' need not do anything if the variables are redefined.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| No visual clue. This is extra information that is being offered to the listener. <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Other arguments are used to issue warnings or errors if the variables are redefined.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''input'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Next we use the '''input''' function.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''input'''<br />
<br />
<br />
Poin to '''“ “'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| It will display a message to the user and get the values of '''A''' and '''B''' matrices. <br />
<br />
<br />
The message should be placed within '''double quotes'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The matrices that the user enters, will be stored in the variables '''A''' and '''B'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''A'''<br />
<br />
Highlight '''B'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Here '''A''' is the '''coefficient matrix''' and '''B''' is the right-hand-side matrix or the '''constants''' '''matrix'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''naivegaussianelimination'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we define the function '''naive gaussian elimination.'''<br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''A'''<br />
<br />
Highlight '''B'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| And we state that '''A''' and '''B''' are the arguments of the function '''naive gaussian elimination'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''x'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We store the output in variable '''x'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''size'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we find the size of matrices '''A''' and '''B''' using the '''size''' command.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight''' n and n one'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Since they are two dimensional matrices, we use '''n''' and '''n one''' to store the size of matrix '''A.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''m one '''and '''p'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly we can use '''m one '''and '''p''' for matrix '''b'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''if n ~= n1 '''<br />
<br />
'''error('gaussianelimination - Matrix A must be square');'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we have to determine if the matrices are compatible with each other and if '''A''' is a '''square matrix'''. <br />
<br />
<br />
If '''n''' and '''n one''' are not equal , then we display a message that '''Matrix A''' must be '''square'''. <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''elseif n ~= m1 '''<br />
<br />
'''error('gaussianelimination - incompatible dimension of A & b');'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| If '''n''' and '''m''' one are not equal, we display a message incompatible dimension of '''A''' and '''b.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''<nowiki>C=[A b];</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| If the matrices are compatible, we place matrices '''A''' and '''b''' in one matrix '''C'''. <br />
<br />
<br />
This matrix '''C''' is called '''augmented matrix'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''n=size(A,1); '''<br />
<br />
'''for k=1:n-1 '''<br />
<br />
'''for i=k+1:n '''<br />
<br />
'''factor=A(i,k)/A(k,k); '''<br />
<br />
'''for j=k+1:n '''<br />
<br />
'''A(i,j)=A(i,j)-factor*A(k,j); '''<br />
<br />
'''end '''<br />
<br />
'''b(i)=b(i)-factor*b(k); '''<br />
<br />
'''end '''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The next block of code performs '''forward elimination'''. <br />
<br />
This code converts the '''augmented matrix''' to '''upper triangular matrix''' form. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''x(n)=b(n)/A(n,n); '''<br />
<br />
'''for i=n-1:-1:1 '''<br />
<br />
'''sum=0; '''<br />
<br />
'''for j=i+1:n '''<br />
<br />
'''sum=sum+A(i,j)*x(j); '''<br />
<br />
'''end '''<br />
<br />
'''x(i)=(b(i)-sum)/A(i,i); '''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Finally we perform '''back substitution'''. <br />
* Once the '''upper triangular matrix''' is obtained, we take the last row and find the value of the variable in that row. <br />
* Then once one variable is solved, we take this variable to solve the other variables. <br />
* Thus the system of '''linear equations''' is solved.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us save and execute the file. <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show Scilab Console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Switch to '''Scilab''' console to solve the example. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show Scilab Console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| On the console, we have a prompt to enter the value of the '''coefficient matrix'''. <br />
<br />
<br />
So we enter the values of '''matrix A'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Type'''<br />
<br />
'''<nowiki>[3.41 1.23 -1.09;2.71 2.14 1.29;1.89 -1.91 -1.89]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Type '''square bracket three point four one space one point two three space minus one point zero nine '''<br />
<br />
'''semi colon '''<br />
<br />
'''two point seven one space two point one four space one point two nine semi colon '''<br />
<br />
'''one point eight nine space minus one point nine one space minus one point eight nine close square bracket.'''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Type'''<br />
<br />
'''<nowiki>[4.72;3.1;2.92]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The next prompt is for '''matrix b'''.<br />
<br />
<br />
So we type <br />
<br />
'''open square bracket four point seven two semi colon three point one semi colon two point nine one close square bracket.'''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Type'''<br />
<br />
'''naivegaussianelimination(A,b)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we call the function by typing <br />
<br />
'''naive gaussian elimination open paranthesis A comma b close paranthesis '''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show answer on Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The solution to the system of linear equations is shown on Scilab console. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Next we shall study the '''Gauss- Jordan''' '''method'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 11 – Gauss- Jordan Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| In '''Gauss – Jordan Method'''<br />
<br />
* The first step is to form the '''augmented matrix. '''<br />
* To do this place the coefficient '''matrix A''' and the right hand side '''matrix b''' together in one '''matrix'''.<br />
* Then we perform '''row operations t'''o convert '''matrix A '''to diagonal form. <br />
* In diagonal form, only the elements '''a i i '''are non-zero. Rest of the elements are zero.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 12- Gauss-Jordan Method<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we divide the '''diagonal element and corresponding element of right hand side element, by the diagonal element'''.<br />
<br />
<br />
We do this to get '''diagonal element''' equal to one.<br />
<br />
<br />
The resulting value of the elements of each row of the right hand side matrix gives the value of each variable.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 13- Example<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us solve this example using '''Gauss- Jordan Method'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Switch to Scilab console and open GaussJordan Elimination.sci<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us look at the code first. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''format'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The first line of the code uses '''format function''' to specify the format of the displayed answers. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
''''e''''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The parameter '''e''' specifies the answer should be in '''scientific notation'''.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight '''20'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| '''Twenty''' denotes that only '''twenty digits''' should be displayed.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''A=input("Enter the coeffiecient matrix : ") '''<br />
<br />
'''b=input("Enter the right-hand side matrix : ")'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we get the '''A''' and '''b matrix''' using the '''input function'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''<nowiki>function [x] = GaussJordanElimination( A, b )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We define the function '''Gauss Jordan Elimination''' with input arguments '''A '''and''' b''' and output argument''' x.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''<nowiki>[m, n] = size( A )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We get the size of '''matrix A''' and store it in '''m''' and '''n'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''<nowiki>[r, s] = size( b )</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Similarly we get the size of '''matrix b '''and store it in '''r''' and '''s'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''<nowiki>if ( m <> r ) then </nowiki>'''<br />
<br />
'''error("Error: matrix A and vector b are incompatible sizes") '''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| If the sizes of '''A '''and '''b''' are not compatible, we display an error on the console using '''error function'''. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Highlight '''<br />
<br />
'''for k = 1 : 1 : m '''<br />
<br />
'''<nowiki>indices = [ 1 : 1 : k-1, </nowiki>k+1 : 1 : m ] '''<br />
<br />
<br />
'''// For all rows below and above the pivot, subtract a multiple '''<br />
<br />
'''// of the pivoting row to get a zero '''<br />
<br />
'''for i = indices '''<br />
<br />
'''multiplier = C(i, k) / C(k,k) '''<br />
<br />
'''for j = k+1 : n '''<br />
<br />
'''C(i, j) = C(i, j) - multiplier * C(k, j) '''<br />
<br />
'''end '''<br />
<br />
'''end '''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we perform '''row operations''' to get diagonal form of the '''matrix'''.<br />
<br />
<br />
Here '''pivot''' refers to the first non-zero element of a column. <br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''x = zeros( m, s )'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we create a '''matrix''' of zeros called '''x''' with '''m''' rows and '''s''' columns.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''for i = 1 : 1 : m '''<br />
<br />
'''for j = 1 : 1 : s '''<br />
<br />
'''x(i, j) = C(i, m+j) / C(i, i) '''<br />
<br />
'''end '''<br />
<br />
'''end'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Once we have the diagonal form, <br />
<br />
* we divide the right hand side part of '''augmented matrix''' <br />
* by the corresponding '''diagonal element '''<br />
* to get the value of each variable.<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''x(i, j) = C(i, m+j) / C(i, i) '''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| We store the value of each variable in '''x.'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''return x'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we return the value of '''x.''' <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Highlight <br />
<br />
'''endfunction'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Finally we end the function.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Click on Execute and select Save and Execute<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Now let us save and execute the function.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type the following<br />
<br />
'''<nowiki>[0.7, 1725;0.4352,-5.433]</nowiki>'''<br />
<br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The prompt requires us to enter the value of '''matrix A'''. <br />
<br />
<br />
So we type<br />
<br />
'''open square bracket zero point seven comma one seven two five '''<br />
<br />
'''semi colon '''<br />
<br />
'''zero point four three five two comma minus five point four three three close square bracket.'''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type the following<br />
<br />
'''<nowiki>[1739;3.271]</nowiki>'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The next prompt is for '''vector b'''. <br />
<br />
<br />
So we type <br />
<br />
'''open squre bracket one seven three nine '''<br />
<br />
'''semi colon '''<br />
<br />
'''three point two seven one close square bracket'''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Type the following<br />
<br />
'''GaussJordanElimination(A,b)'''<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Then we call the function by typing <br />
<br />
'''Gauss Jordan Elimination open paranthesis A comma b close paranthesis'''<br />
<br />
'''Press enter'''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Show answers on Scilab console<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The values of '''x one''' and '''x two''' are shown on the console.<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| Slide 14- Summary<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| Let us summarize this tutorial.<br />
<br />
In this tutorial, we have learnt to: <br />
<br />
* Develop Scilab code for solving system of '''linear equations''' <br />
* Find the value of the unknown variables of a system of '''linear '''<br />
<br />
'''equations '''<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 16'''<br />
<br />
'''Title: About the Spoken Tutorial Project''' <br />
<br />
* Watch the video available at [http://spoken-tutorial.org/What_is_a_Spoken_Tutorial http://spoken-tutorial.org/What_is_a_Spoken_Tutorial] <br />
<br />
* It summarises the Spoken Tutorial project <br />
<br />
* If you do not have good bandwidth, you can download and watch it <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Watch the video available at the following link <br />
* It summarises the Spoken Tutorial project <br />
* If you do not have good bandwidth, you can download and watch it <br />
* <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 17'''<br />
<br />
'''Title: Spoken Tutorial Workshops''' <br />
<br />
The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact@spoken-tutorial.org <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| The Spoken Tutorial Project Team <br />
<br />
* Conducts workshops using spoken tutorials <br />
<br />
* Gives certificates for those who pass an online test <br />
<br />
* For more details, please write to contact at spoken hyphen tutorial dot org <br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| '''Show Slide 18'''<br />
<br />
'''Title: Acknowledgement''' <br />
<br />
* Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
<br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
<br />
* More information on this Mission is available at <br />
<br />
* [http://spoken-tutorial.org/NMEICT-Intro http://spoken-tutorial.org/NMEICT-][http://spoken-tutorial.org/NMEICT-Intro Intro] <br />
<br />
<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| * Spoken Tutorial Project is a part of the Talk to a Teacher project <br />
* It is supported by the National Mission on Education through ICT, MHRD, Government of India <br />
* More information on this Mission is available at <br />
* spoken hyphen tutorial dot org slash NMEICT hyphen Intro <br/> <br />
<br />
<br />
<br />
<br />
|-<br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:none;padding:0.097cm;"| <br />
| style="border-top:none;border-bottom:1pt solid #000000;border-left:1pt solid #000000;border-right:1pt solid #000000;padding:0.097cm;"| This is mandatory. This is Ashwini Patil signing off. Thanks for joining.<br />
<br />
|}</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-11-08T10:47:05Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison in BASH<br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# BASH comparison<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-11-08T10:44:09Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# BASH comparison<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-11-08T10:35:56Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operators in Bash shell<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# BASH comparison<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-24T05:36:03Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# BASH comparison<br />
#*String comparison <br />
#*String comparison using == operator <br />
#*String comparison using != operator <br />
#*Simple program of user id to demnostrate string comparison <br />
#*File attributes comparisons<br />
#*File attributes discussed are -f, -s, -w, -nt, -ot<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-24T05:17:21Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#Nested and multilevel if statement in BASH<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-24T05:13:45Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
#More on if loop in Bash Shell scripting<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T07:15:44Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example<br />
#*Returning value from a function <br />
#Advance topics in function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T07:12:17Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Use of return and exit in a function<br />
#*Illustration of return and exit status by an example <br />
#*Returning value from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T05:59:41Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function<br />
#*Arrays in function<br />
#*Usability of array by different function call<br />
#*Array example <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T05:34:32Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Demonstration of function(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T05:33:11Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#*Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Illustration of work flow with an example(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-10-23T05:32:25Z<p>Lavitha Pereira: /* BASH Shell Scripting: Intermediate */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Basics of Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Writing functions <br />
#Function defintion <br />
#*Calling functions <br />
#*Workflow of function<br />
#*Illustration of work flow with an example(Example used: Machine details program) <br />
#Local, global and passing Command line arguments in a function <br />
#*Local variable in a function<br />
#*Global variable in a function<br />
#*Scope of local and global variables<br />
#*Demonstration of local and global variable by an example(Example used: Displaying complete name)<br />
#*Passing command line arguments<br />
#*Demonstration of passing command line arguments by an example(Example used: Displaying simple message)<br />
#Arrays and returning values in a function <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-09-25T06:38:47Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq(equal to)<br />
#*-ne(not equal to)<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt(lesser than)<br />
#*-le(lesser than or equal to)<br />
#*-gt(greater than)<br />
#*-ge(greater than or equal to)<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-09-25T06:05:42Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*Logical AND syntax <br />
#*Logical AND workflow<br />
#*Logical OR <br />
#*Logical OR workflow<br />
#*Logical OR and AND with string comparison program<br />
#*Logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq<br />
#*-ne<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt<br />
#*-le<br />
#*-gt<br />
#*-ge<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-09-18T05:51:09Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*logical AND syntax <br />
#*logical AND workflow<br />
#*logical OR <br />
#*logical OR workflow<br />
#*logical OR and AND with string comparison program<br />
#*logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq<br />
#*-ne<br />
#*Demonstration of -eq and -ne with a word count program(Used: `wc -w`)<br />
#*-lt<br />
#*-le<br />
#*-gt<br />
#*-ge<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used: `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-09-18T05:50:19Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*logical AND syntax <br />
#*logical AND workflow<br />
#*logical OR <br />
#*logical OR workflow<br />
#*logical OR and AND with string comparison program<br />
#*logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
#*-eq<br />
#*-ne<br />
#*Demonstration of -eq and -ne with a word count program(Used `wc -w`)<br />
#*-lt<br />
#*-le<br />
#*-gt<br />
#*-ge<br />
#*Demonstration of -lt,-gt, -ge and -le with a word count program(Used `wc -c`)<br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-08-29T07:30:52Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*logical AND syntax <br />
#*logical AND workflow<br />
#*logical OR <br />
#*logical OR workflow<br />
#*logical OR and AND with string comparison program<br />
#*logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Case statement example<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/BASHBASH2013-08-29T07:28:56Z<p>Lavitha Pereira: /* BASH Shell Scripting: Basic */</p>
<hr />
<div>'''Bash''' is the shell, or command language interpreter, that will appear in the '''GNU operating system'''. <br />
Bash is an sh-compatible shell that incorporates useful features from the Korn shell (ksh) and C shell (csh). <br />
It offers functional improvements over sh for both programming and interactive use. <br />
<br />
In addition, most sh scripts can be run by Bash without modification.<br />
The improvements offered by Bash include: Command line editing, Unlimited size command history, Job Control, Shell Functions and Aliases, Indexed arrays of unlimited size, Integer arithmetic.<br />
<br />
In this tutorial we would mainly concentrate on how to use the wide variety of commands of Linux commands to handle files, directories, processes etc. These tutorials are created using '''Ubuntu version 12.04''' and above. Please see the associated text box of individual spoken tutorials on the website to decide the versions of Linux OS to which it is applicable. <br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The contributors who helped create the outline, transcribe, create the tutorials are - Nancy Varkey, Ashwini Patil, Lavitha Monisha Pereira, Sachin Patil - all from IIT Bombay. The effort has been moderated and coordinated by the Spoken Tutorial team and FOSSEE team, IIT Bombay.<br />
</blockquote><br />
<br />
<br />
<br />
__TOC__<br />
<br />
<br />
==BASH Shell Scripting: Basic==<br />
# Introduction to BASH Shell Scripting <br />
#*The bash shell <br />
#*Bash Shell Script<br />
# Basics of Shell Scripting <br />
#*System variables <br />
#*User defined variables<br />
#*Accepting user input via keyboard<br />
#Command Line arguments and quoting<br />
#*Command Line arguments <br />
#*Single quote<br />
#*Double quote<br />
#*Backslash<br />
#Globbing and export statements<br />
#*Globbing<br />
#*The export statement<br />
# Array Operations in BASH<br />
#*Declaring an Array and Assigning values<br />
#*Initializing an Array during declaration<br />
#*To find length of Bash Array and length of nth element<br />
#*To print whole Bash Array<br />
#*Shell script to illustrate the concepts<br />
# More on Arrays<br />
#*Extraction of Array elements<br />
#*Search and replace in an Array element<br />
#*To Add an element to an Array<br />
#*To remove an Element from an Array<br />
#*Shell script to illustrate the concepts<br />
# Conditional execution <br />
#*Test<br />
#*Syntax of test<br />
#*if...then<br />
#*Bash script example for if...then<br />
#*if...then...else...if<br />
#*if-else with a password program<br />
# More on If loops<br />
#*Nested if<br />
#*Nested if with flowgraph<br />
#*Nested If-else with Name and Password verification program<br />
#*Multilevel if-then-else<br />
#*Multilevel if-then-else with flowgraph<br />
#*Multilevel if-else with String comparison program<br />
# Logical Operations<br />
#*logical AND syntax <br />
#*logical AND workflow<br />
#*logical OR <br />
#*logical OR workflow<br />
#*logical OR and AND with string comparison program<br />
#*logical NOT syntax<br />
#*Demonstration of logical NOT with an example(Example used: Checks whether a file exists)<br />
# Bash comparison- Arithmetic comparison <br />
#*Arithmetic comparison <br />
# Bash comparison- String & File attributes<br />
#*String comparison <br />
#*File attributes comparisons<br />
# Loops <br />
#*The for loop statement <br />
#*The while loop statement<br />
#More on Loops <br />
#*Use of : to set infinite while loop <br />
#*The until loop statement <br />
#*The select loop statement <br />
#*Exit the select loop statement <br />
#*Using the break statement <br />
#*Using the continue statement <br />
# Case statement in BASH <br />
#*Importance of case statement<br />
#*Syntax of case(With both single and multiple options)<br />
#*Work-flow of case statement<br />
#*Creating menus using case<br />
#*Illustration of case statement with simple test for checking disk space<br />
<br />
==BASH Shell Scripting: Intermediate==<br />
# Functions <br />
#*Writing your first shell function <br />
#*Displaying functions <br />
#*Removing functions <br />
#*Defining functions <br />
#*Writing functions <br />
#*Calling functions <br />
#*Pass arguments into a function <br />
#*Local variable <br />
#*Returning from a function <br />
#*Source command <br />
#*Recursive function <br />
#*Putting functions in background<br />
# Redirections (error handling) <br />
#*Input and Output <br />
#*Standard input <br />
#*Standard output <br />
#*Standard error <br />
#*Redirection of both standard error and output <br />
#*Appending redirected output <br />
#*Empty file creation <br />
#*Here documents <br />
#*Here strings <br />
#*Assigns the file descriptor (fd) to file for output <br />
#*Assigns the file descriptor (fd) to file for input <br />
#*Closes the file descriptor (fd) <br />
# Pipes and filters <br />
#*Linking Commands <br />
#*Multiple commands <br />
#*Putting jobs in background <br />
#*Pipes <br />
#*How to use pipes to connect programs <br />
#*Input redirection in pipes <br />
#*Output redirection in pipes <br />
#*Why use pipes <br />
#*Filters<br />
==BASH Shell Scripting: Advance==<br />
# Signals, process and traps <br />
#*Signals <br />
#*What is a Process? <br />
#*How to view Processes <br />
#*Sending signal to Processes <br />
#*Terminating Processes <br />
#*Shell signal values <br />
#*The trap statement <br />
#*How to clear trap <br />
#*Include trap statements in a script <br />
#*Use the trap statement to catch signals and handle errors <br />
#*What is a Subshell? <br />
#*Compound command <br />
#*Exec command<br />
# Making you shell script interactive (using dialog box) <br />
#*Menu driven scripts <br />
#*Getting information about your system <br />
#*Bash display dialog boxes <br />
#*Dialog customisation with configuration file <br />
#*A yes/no dialog box <br />
#*An input dialog box <br />
#*A password box <br />
#*A menu box <br />
#*A progress bar (gauge box) <br />
#*The form dialog for input</div>Lavitha Pereirahttps://script.spoken-tutorial.org/index.php/ScilabScilab2013-08-22T05:52:26Z<p>Lavitha Pereira: </p>
<hr />
<div>{{Spoken Tutorial Banner}} <br />
<br />
Scilab (http://scilab.org, http://scilab.in, http://scilab.cn) is an open source scientific software package for numerical computations. It has an extremely reliable and efficiently coded numerical library. It is also a high productivity tool: Through its interpreted language, one can quickly develop the code required to solve problems. Typically, if it takes ten lines of C code for some calculation, Scilab would require only one for the same purpose. <br />
<br />
Scilab runs on all popular operating systems. Since 1994, it has been distributed freely along with the source code via the Internet. It is useful for students at school, college and <span class="plainlinks">[http://www.netlook.com.br/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">roupas da moda</span>] research level. It is also useful for researchers and professionals.<br />
<br />
IIT Bombay is leading the effort to popularise Scilab in India. This is part of the Free and Open source Software for Science and Engineering Education (FOSSEE) project, supported by the National Mission on Education through ICT of MHRD (http://spoken-tutorial.org/NMEICT-Intro).<br />
<br />
IIT Bombay is using Spoken Tutorials (http://spoken-tutorial.org) to create learning material for FOSS. This is the main page for the organisation of the scripts required for Scilab spoken tutorials. We invite the Scilab user community to participate in this activity.<br />
<br />
<br />
<br />
<blockquote style="background-color: lemonchiffon; border: solid thin grey;"><br />
The Spoken Tutorial Effort for Scilab is being contributed by Shalini Shrivastava, Rupak Rokade, Anuradha Amruthkar, Manas Ranjan Das, Mukul Kulkarni, Shamika Mohanan, Lavitha Pereira from IIT Bombay<br />
<br />
</blockquote><br />
__TOC__<br />
<br />
'''Note:''' Each numbered topic corresponds to a single spoken tutorial. Each bulleted point corresponds to a command or topic that must be covered <span class="plainlinks">[http://www.valleypistachio.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">organic nuts</span>] in the given spoken tutorial. <br />
<br />
<br />
=General Information=<br />
This topic will include all functionality in Scilab that <span class="plainlinks">[http://thebeginnerslens.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">iphone photography</span>] is not domain specific- functionality that is required across several domains. <br />
==Basic Level Introduction to Scilab==<br />
This level will include a set of tutorials that are required to be known in order to qualify as "Scilab Literate". The tutorials here will teach programming <span class="plainlinks">[http://www.bestpills4weightloss.com/ <span style="color:black;font-weight:normal; text-decoration:none!important; background:none!important; text-decoration:none;">weight loss pills</span>]<br />
fundamentals and the most commonly used Scilab functionality- Matrix operations and Plotting. <br />
# ''' Why Scilab'''<br />
# '''Installing''' <br />
#* Show where to download from and how to decide which version to choose <br />
#* Windows installation <br />
#* Linux installation (using package manager- show only Debian/Ubuntu as example (sudo apt-get install scilab) as well as generic binary)<br />
#* Mac<br />
#* Compilation from source can come as a part of a more advanced tutorial<br />
# '''Getting Started'''<br />
#* Expressions: Show mathematical expressions with numbers <br />
#* Variables<br />
#* Diary command<br />
#* Define symbolic constants.<br />
#* Basic functions <br />
#* suppressing output(;)<br />
#* help,clc<br />
#'''Vector Operations''' <br />
#* Define vector<br />
# '''Matrix Operations''' <br />
#* Square matrices <br />
#* det(Q), diag(Q)<br />
#* Matrix generation: zeros(3,4), ones(2,5), eye(4,4), diag([1 2 3]), rand(2,3).<br />
#* Ranges: 1:4, 2:2:8, linspace(1, 9, 5) (linspace is to be explained in Plotting 2D graphs tutorial) <br />
#* Elementary row operations<br />
#* Solving equations<br />
# '''Scripts and Functions''' <br />
#* Explain that one often repeats a set of commands- in which case it is helpful to save that set of commands for future or repeated use. The commands can be saved as scripts or functions. <br />
#* Change directory to the desktop. Open the scilab editor and type the commands (each on a new line)<br />
#* Save the above file to the desktop. Then open the same file using a regular text editor such as notepad to show that it is indeed a text file. Now load the file into scilab using the scilab editor's execute menu option. <br />
#* Change the value of a to 5 in the editor, save and close it. Now execute the script directly from the scilab interpreter using exec. <br />
#* Functions: Show the syntax of functions, explain the function keyword, input arguments and the structure of output arguments when there is more than one argument. <br />
#* Show the following function in the editor: . <br />
#* Inline functions. <br />
#* .sce versus .sci: These are just conventions.<br />
#''' Conditional Branching''' <br />
#* Explain booleans <br />
#* First explain 'if' and 'then' with the example<br />
#* Now explain the use of the 'else' keyword<br />
#* Now explain the use of the 'elseif' keyword<br />
#* Say that if there are several branches, it may be clearer to use the 'select' keyword.<br />
#* Give example for select<br />
#* Branching can be based on satisfaction of combination of multiple conditions as well <br />
#''' Iteration''' <br />
#* Explain syntax of 'for' statement- tell that the variable iterates over a list/vector/matrix <br />
#* Break condition.<br />
#* continue condition. <br />
#* while condition. <br />
#* break, continue condition with example in while loop.<br />
# ''' Plotting 2D graphs''' <br />
#* About linspace: linspace is a linearly spaced vector.<br />
#* Plot a simple graph: x=linspace(12,34,10), y=linspace(-.1,2,10), plot(x,y)<br />
#* plot2d <br />
#* Using clf() clear the graphic window. <br />
#* Configure the title for the plot<br />
#* Configure a legend <br />
#* Divide a graphic window into a matrix of sub-windows using subplot(mnp)<br />
#''' Xcos introduction'''<br />
<br />
==Advanced Level Scilab==<br />
# '''File Handling- Scilab File handling'''<br />
#* Writing to a file using write()<br />
#* Reading from a file using read()<br />
#* Opening an existing file using mopen()<br />
#* Closing an already opened file using mclose()<br />
# '''File Handling- User Defined Input and Output in Scilab'''<br />
#* Input Function<br />
#* mprintf()<br />
#* save() and load()<br />
#* Used to quit scilab midway through calculation and continue at later stage<br />
# '''Numerical methods- Integration'''<br />
#* Develop Scilab code for different Composite Numerical Integration algorithms<br />
#* Divide the integral into equal intervals<br />
#* Apply the algorithm to each interval<br />
#* Calculate the composite value of the integral <br />
# Numerical methods- Solving Non- linear Equations<br />
# '''Numerical methods- Gaussian Methods'''<br />
#* Explain Gauss Elimination method algorithm<br />
#* Explain code for Gauss Elimination method and solve an example using this code<br />
#* Explain Gauss Jordan method algorithm<br />
#* Explain code for Gauss Jordan method and solve an example using this code<br />
<br />
# Numerical methods- Iterative Methods<br />
# Numerical methods- Interpolation<br />
# Numerical methods- ODE- Euler methods<br />
# Numerical methods- ODE- Applications<br />
#''' Optimization Using Karmarkar Functions'''<br />
#* About Optimization<br />
#* Use of Scilab function Karmarkar in Optimization<br />
# Optimization of Non-linear Functions<br />
# '''Digital Signal Processing'''<br />
#* Plotting continuous and discrete sine wave.<br />
#* Plotting step function.<br />
#* Plotting ramp function.<br />
# Filter Design- Windowing Techniques<br />
# Filter Design- Window Based FIR Filter<br />
# Filter Design- IIR Digital Filter<br />
# Filter Design- Applying Digital Filter<br />
# Control systems<br />
# Discrete systems<br />
# '''Calling User Defined Functions in XCOS'''<br />
#* Write a squaring function<br />
#* Use of scifunc block in XCOS<br />
#* Use of MUX block<br />
#* Call functions having multiple inputs and output</div>Lavitha Pereira