Difference between revisions of "Scilab/C2/Getting-Started/English-timed"

From Script | Spoken-Tutorial
Jump to: navigation, search
Line 1: Line 1:
 
{| border=1
 
{| border=1
  
!Time
+
|'''Time'''
!Narration
+
|'''Narration'''
  
 
|-
 
|-
  
|00.02
+
|00:02
  
 
|Welcome to the spoken tutorial on Getting Started with Scilab.
 
|Welcome to the spoken tutorial on Getting Started with Scilab.
Line 12: Line 12:
 
|-
 
|-
  
|00.07
+
|00:07
  
 
| In this tutorial we are going to learn:  
 
| In this tutorial we are going to learn:  
Line 18: Line 18:
 
|-
 
|-
  
|00.09
+
|00:09
  
 
| The use Scilab as a calculator.
 
| The use Scilab as a calculator.
Line 24: Line 24:
 
|-
 
|-
  
|00.12
+
|00:12
  
 
| How to Store values in a variable.
 
| How to Store values in a variable.
Line 30: Line 30:
 
|-
 
|-
  
|00.15
+
|00:15
  
 
| How to Perform various mathematical operations using these variables.
 
| How to Perform various mathematical operations using these variables.
Line 36: Line 36:
 
|-
 
|-
  
|00.21
+
|00:21
  
 
| How to Create a file to store commands executed during the session in the current working directory.
 
| How to Create a file to store commands executed during the session in the current working directory.
Line 42: Line 42:
 
|-
 
|-
  
|00.29
+
|00:29
  
 
| How to define complex numbers.
 
| How to define complex numbers.
Line 48: Line 48:
 
|-
 
|-
  
|00.31
+
|00:31
  
 
| How to Perform exponential, logarithmic and trigonometric operations on numbers.
 
| How to Perform exponential, logarithmic and trigonometric operations on numbers.
Line 54: Line 54:
 
|-
 
|-
  
|00.38
+
|00:38
  
 
|The prerequisite for this tutorial are Scilab should be installed on your computer.
 
|The prerequisite for this tutorial are Scilab should be installed on your computer.
Line 60: Line 60:
 
|-
 
|-
  
|00.44
+
|00:44
  
 
| I am using Scilab 5.2.0 and Mac OS/X  for demonstration
 
| I am using Scilab 5.2.0 and Mac OS/X  for demonstration
Line 66: Line 66:
 
|-
 
|-
  
|00.51
+
|00:51
  
 
|Here is the Flow chart for the tutorial.
 
|Here is the Flow chart for the tutorial.
Line 72: Line 72:
 
|-
 
|-
  
|00.55
+
|00:55
  
 
|Click on the Scilab shortcut icon on your Desktop and Start Scilab.
 
|Click on the Scilab shortcut icon on your Desktop and Start Scilab.
Line 78: Line 78:
 
|-
 
|-
  
|01.01
+
|01:01
  
 
| This is the Scilab console window. Notice that the cursor is on the command prompt.
 
| This is the Scilab console window. Notice that the cursor is on the command prompt.
Line 84: Line 84:
 
|-
 
|-
  
|01.07
+
|01:07
  
 
| I suggest that you practice this tutorial in Scilab simultaneously while pausing the video at regular intervals of time.
 
| I suggest that you practice this tutorial in Scilab simultaneously while pausing the video at regular intervals of time.
Line 90: Line 90:
 
|-
 
|-
  
|01.16
+
|01:16
  
 
|Scilab can be used as a calculator.  
 
|Scilab can be used as a calculator.  
Line 96: Line 96:
 
|-
 
|-
  
|01.19
+
|01:19
  
 
|Let us see some of the basic operations that it can do.
 
|Let us see some of the basic operations that it can do.
Line 102: Line 102:
 
|-
 
|-
  
|01.25
+
|01:25
  
 
| Type 42 plus 4 multiplied by 4 minus 64 divided 4 and press enter.
 
| Type 42 plus 4 multiplied by 4 minus 64 divided 4 and press enter.
Line 108: Line 108:
 
|-
 
|-
  
|01.36
+
|01:36
  
 
| The output is 42, as expected.
 
| The output is 42, as expected.
Line 114: Line 114:
 
|-
 
|-
  
|01.39
+
|01:39
  
 
|Note that the answer 42 is stored in the default variable "a n s".
 
|Note that the answer 42 is stored in the default variable "a n s".
Line 120: Line 120:
 
|-
 
|-
  
|01.45
+
|01:45
  
 
|We can also create named variables: Type,  
 
|We can also create named variables: Type,  
Line 126: Line 126:
 
|-
 
|-
  
|01.49
+
|01:49
  
 
| a equals 12, b=21 , c=33 and press enter.
 
| a equals 12, b=21 , c=33 and press enter.
Line 132: Line 132:
 
|-
 
|-
  
|02.00
+
|02:00
  
 
| This stores the values 12, 21 and 33 in the variables a, b and c respectively.
 
| This stores the values 12, 21 and 33 in the variables a, b and c respectively.
Line 138: Line 138:
 
|-
 
|-
  
|02.08
+
|02:08
  
 
| I will clear the scilab console using the clc command here
 
| I will clear the scilab console using the clc command here
Line 144: Line 144:
 
|-
 
|-
  
|02.13
+
|02:13
  
 
|Now we will perform some mathematical operations using these variables.  
 
|Now we will perform some mathematical operations using these variables.  
Line 150: Line 150:
 
|-
 
|-
  
|02.19
+
|02:19
  
 
| For example,
 
| For example,
Line 156: Line 156:
 
|-
 
|-
  
|02.21
+
|02:21
  
 
| a+b+c gives the result 66  
 
| a+b+c gives the result 66  
Line 162: Line 162:
 
|-
 
|-
  
|02.27
+
|02:27
  
 
|also
 
|also
Line 168: Line 168:
 
|-
 
|-
  
|02.29
+
|02:29
  
 
| a times into bracket  
 
| a times into bracket  
Line 174: Line 174:
 
|-
 
|-
  
|02.35
+
|02:35
  
 
| b plus c  gives the result 648
 
| b plus c  gives the result 648
Line 180: Line 180:
 
|-
 
|-
  
|02.41
+
|02:41
  
 
|We can also assign the answer to another variable say 'd' by typing d = bracket a+b close the bracket multiplied by c gives the answer  
 
|We can also assign the answer to another variable say 'd' by typing d = bracket a+b close the bracket multiplied by c gives the answer  
Line 187: Line 187:
 
|-
 
|-
  
|02.58
+
|02:58
  
 
| d = 1089.
 
| d = 1089.
Line 193: Line 193:
 
|-
 
|-
  
|03.01
+
|03:01
  
 
|We can check the values in the variables by typing the names of the variables separated by commas on the command line as  
 
|We can check the values in the variables by typing the names of the variables separated by commas on the command line as  
Line 199: Line 199:
 
|-
 
|-
  
|03.09
+
|03:09
  
 
| a,b,c,d and press enter
 
| a,b,c,d and press enter
Line 205: Line 205:
 
|-
 
|-
  
|03.16
+
|03:16
  
 
| I will clear the console here using the clc command
 
| I will clear the console here using the clc command
Line 211: Line 211:
 
|-
 
|-
  
|03.21
+
|03:21
  
 
|To take the power, use the “raised to” symbol which is located on the number key 6 of your keyboard.
 
|To take the power, use the “raised to” symbol which is located on the number key 6 of your keyboard.
Line 217: Line 217:
 
|-
 
|-
  
|03.29
+
|03:29
  
 
|Press ' shift key' and number key 6 to used this symbol.
 
|Press ' shift key' and number key 6 to used this symbol.
Line 223: Line 223:
 
|-
 
|-
  
|03.34
+
|03:34
  
 
| for example, 7 square can be found by 7 raised to 2 and press Enter.
 
| for example, 7 square can be found by 7 raised to 2 and press Enter.
Line 229: Line 229:
 
|-
 
|-
  
|03.43
+
|03:43
  
 
|For finding the square root of a number, say, 17, we use : sqrt of 17
 
|For finding the square root of a number, say, 17, we use : sqrt of 17
Line 235: Line 235:
 
|-
 
|-
  
|03.55
+
|03:55
  
 
|This is same as 17 raised to the power of zero point five.  
 
|This is same as 17 raised to the power of zero point five.  
Line 241: Line 241:
 
|-
 
|-
  
|04.06
+
|04:06
  
 
|By convention, only the positive value comes as output.
 
|By convention, only the positive value comes as output.
Line 247: Line 247:
 
|-
 
|-
  
|04.10
+
|04:10
  
 
| More generally, to find 34 to the power of (2 by 5), type:
 
| More generally, to find 34 to the power of (2 by 5), type:
Line 253: Line 253:
 
|-
 
|-
  
|04.15
+
|04:15
  
 
|34 raised to bracket  2 divide by 5  close the bracket and press Enter.
 
|34 raised to bracket  2 divide by 5  close the bracket and press Enter.
Line 259: Line 259:
 
|-
 
|-
  
|04.25
+
|04:25
  
 
| Negative powers can also be used,
 
| Negative powers can also be used,
Line 265: Line 265:
 
|-
 
|-
  
|04.28
+
|04:28
  
 
| Clear the cansole using clc command
 
| Clear the cansole using clc command
Line 271: Line 271:
 
|-
 
|-
  
|04.33
+
|04:33
  
 
| So far, you  have seen how to do some simple calculations and how to create variables in Scilab.
 
| So far, you  have seen how to do some simple calculations and how to create variables in Scilab.
Line 277: Line 277:
 
|-
 
|-
  
|04.40
+
|04:40
  
 
| Now let us start with the new command.
 
| Now let us start with the new command.
Line 283: Line 283:
 
|-
 
|-
  
|04.43
+
|04:43
  
 
| This will helps remember command which were previously issued along with the outputs.
 
| This will helps remember command which were previously issued along with the outputs.
Line 289: Line 289:
 
|-
 
|-
  
|04.49
+
|04:49
  
 
| First type the command pwd and press Enter
 
| First type the command pwd and press Enter
Line 295: Line 295:
 
|-
 
|-
  
|04.55
+
|04:55
  
 
| This is the current working directory (on my computer).  
 
| This is the current working directory (on my computer).  
Line 301: Line 301:
 
|-
 
|-
  
|04.58
+
|04:58
  
 
|It might be different on your computer
 
|It might be different on your computer
Line 307: Line 307:
 
|-
 
|-
  
|05.01
+
|05:01
  
 
|The current working directory can be changed by clicking the changed current directory icon located on the toolbar of the scilab console window as you see.
 
|The current working directory can be changed by clicking the changed current directory icon located on the toolbar of the scilab console window as you see.
Line 313: Line 313:
 
|-
 
|-
  
|05.15
+
|05:15
  
 
|Now issue the diary command by typing:
 
|Now issue the diary command by typing:
Line 319: Line 319:
 
|-
 
|-
  
|05.20
+
|05:20
  
 
| diary bracket, open inverted commas,  myrecord.txt  close inverted commas, close the bracket and press enter'''
 
| diary bracket, open inverted commas,  myrecord.txt  close inverted commas, close the bracket and press enter'''
Line 325: Line 325:
 
|-
 
|-
  
|05.40
+
|05:40
  
 
|This command will create a file with the name "myrecord.txt" in the current working directory.  
 
|This command will create a file with the name "myrecord.txt" in the current working directory.  
Line 331: Line 331:
 
|-
 
|-
  
|05.48
+
|05:48
  
 
| A transcript of the Scilab session from now onwards will be saved in this file.  
 
| A transcript of the Scilab session from now onwards will be saved in this file.  
Line 337: Line 337:
 
|-
 
|-
  
|05.53
+
|05:53
  
 
| Its usefulness will be demonstrated at a later stage in this tutorial.
 
| Its usefulness will be demonstrated at a later stage in this tutorial.
Line 343: Line 343:
 
|-
 
|-
  
| 06.00
+
| 06:00
  
 
|Please pause the tutorial now and attempt exercise number one given with the video.  
 
|Please pause the tutorial now and attempt exercise number one given with the video.  
Line 349: Line 349:
 
|-
 
|-
  
|06.07
+
|06:07
  
 
|Now, let us see how Scilab handles complex numbers.  
 
|Now, let us see how Scilab handles complex numbers.  
Line 355: Line 355:
 
|-
 
|-
  
|06.13
+
|06:13
  
 
| The imaginary unit i is defined in Scilab as percent i:
 
| The imaginary unit i is defined in Scilab as percent i:
Line 361: Line 361:
 
|-
 
|-
  
|06.18
+
|06:18
  
 
| For example,Five point two multiplied percent i gives 5.2i
 
| For example,Five point two multiplied percent i gives 5.2i
Line 367: Line 367:
 
|-
 
|-
  
|06.29
+
|06:29
  
 
|also bracket  10 plus 5 into percent i whole multiply by 2 times percent i gives the result -10. + 20.i
 
|also bracket  10 plus 5 into percent i whole multiply by 2 times percent i gives the result -10. + 20.i
Line 373: Line 373:
 
|-
 
|-
  
|06.58
+
|06:58
  
 
| Now clear the console here,
 
| Now clear the console here,
Line 379: Line 379:
 
|-
 
|-
  
|07.04
+
|07:04
  
 
|Let us see some other predefined numerical constants available in Scilab.
 
|Let us see some other predefined numerical constants available in Scilab.
Line 385: Line 385:
 
|-
 
|-
  
|07.09
+
|07:09
  
 
| As with i, their names also start with the percent sign:
 
| As with i, their names also start with the percent sign:
Line 391: Line 391:
 
|-
 
|-
  
|07.13
+
|07:13
  
 
| For example, percent pi.
 
| For example, percent pi.
Line 397: Line 397:
 
|-
 
|-
  
|07.18
+
|07:18
  
 
| The value of pi is as expected.
 
| The value of pi is as expected.
Line 403: Line 403:
 
|-
 
|-
  
|07.21
+
|07:21
  
 
|Now, we will demonstrate the use of pi using a few built-in trigonometric functions as follows.  
 
|Now, we will demonstrate the use of pi using a few built-in trigonometric functions as follows.  
Line 409: Line 409:
 
|-
 
|-
  
|07.27
+
|07:27
  
 
| For the functions sin of percent pi by 2 the result is 1
 
| For the functions sin of percent pi by 2 the result is 1
Line 415: Line 415:
 
|-
 
|-
  
| 07.37
+
| 07:37
  
 
|''And for cos of percent pi by 2 the result is 6.123D-17.'''
 
|''And for cos of percent pi by 2 the result is 6.123D-17.'''
Line 421: Line 421:
 
|-
 
|-
  
|07.50
+
|07:50
  
 
|Please note that the angles are measured in radians and
 
|Please note that the angles are measured in radians and
Line 427: Line 427:
 
|-
 
|-
  
|07.54
+
|07:54
  
 
| Notice that the second answer is zero for all practical purposes.  
 
| Notice that the second answer is zero for all practical purposes.  
Line 433: Line 433:
 
|-
 
|-
  
|07.59
+
|07:59
  
 
| %eps is related to number known as "machine epsilon",
 
| %eps is related to number known as "machine epsilon",
Line 439: Line 439:
 
|-
 
|-
  
|08.03
+
|08:03
  
 
| It is the minimum digit resolution that Scilab can give.
 
| It is the minimum digit resolution that Scilab can give.
Line 445: Line 445:
 
|-
 
|-
  
|08.08
+
|08:08
  
 
|Type % eps on your console to find its value on your computer.
 
|Type % eps on your console to find its value on your computer.
Line 451: Line 451:
 
|-
 
|-
  
|08.19
+
|08:19
  
 
| On my computer it gives 2.220D-16  
 
| On my computer it gives 2.220D-16  
Line 457: Line 457:
 
|-
 
|-
  
|08.24
+
|08:24
  
 
| This shows the floating point precision used by Scilab .  
 
| This shows the floating point precision used by Scilab .  
Line 463: Line 463:
 
|-
 
|-
  
|08.28
+
|08:28
  
 
| This number is a notation for 2.22 times 10^(-16). Clear the console here.
 
| This number is a notation for 2.22 times 10^(-16). Clear the console here.
Line 469: Line 469:
 
|-
 
|-
  
|08.41
+
|08:41
  
 
|If one wants to write 0.000456, one can write it as 4.56d-4 or 4.56e-4.
 
|If one wants to write 0.000456, one can write it as 4.56d-4 or 4.56e-4.
Line 475: Line 475:
 
|-
 
|-
  
|09.06
+
|09:06
  
 
|While scilab variables and functions are case-sensitive, here we can use small d or capital D, or small e, or capital E.  
 
|While scilab variables and functions are case-sensitive, here we can use small d or capital D, or small e, or capital E.  
Line 481: Line 481:
 
|-
 
|-
  
|09.16
+
|09:16
  
 
|The base of the natural logarithm is another important predefined numerical constant:
 
|The base of the natural logarithm is another important predefined numerical constant:
Line 487: Line 487:
 
|-
 
|-
  
|09.22
+
|09:22
  
 
| percent e gives the result as expected.  
 
| percent e gives the result as expected.  
Line 493: Line 493:
 
|-
 
|-
  
|09.30
+
|09:30
  
 
|We can achieve the same result with the function "e x p''.
 
|We can achieve the same result with the function "e x p''.
Line 499: Line 499:
 
|-
 
|-
  
|09.35
+
|09:35
  
 
| For example: exp bracket (1)'' close the bracket and press Enter
 
| For example: exp bracket (1)'' close the bracket and press Enter
Line 505: Line 505:
 
|-
 
|-
  
|09.44
+
|09:44
  
 
| You can see both the answers are same
 
| You can see both the answers are same
Line 511: Line 511:
 
|-
 
|-
  
|09.47
+
|09:47
  
 
|Clear the console using the clc command here.
 
|Clear the console using the clc command here.
Line 517: Line 517:
 
|-
 
|-
  
|09.55
+
|09:55
  
 
|similarly,
 
|similarly,
Line 523: Line 523:
 
|-
 
|-
  
|09.56
+
|09:56
  
 
| %e square gives the following answer
 
| %e square gives the following answer
Line 529: Line 529:
 
|-
 
|-
  
|10.04
+
|10:04
  
 
|which can also be achieved by typing exp of 2 .  
 
|which can also be achieved by typing exp of 2 .  
Line 535: Line 535:
 
|-
 
|-
  
|10.18
+
|10:18
  
 
|The command log means the natural logarithm of a number, that is, to the base e.  
 
|The command log means the natural logarithm of a number, that is, to the base e.  
Line 541: Line 541:
 
|-
 
|-
  
|10.23
+
|10:23
  
 
| Use log 10 for taking the logarithm with respect to base 10.  
 
| Use log 10 for taking the logarithm with respect to base 10.  
Line 547: Line 547:
 
|-
 
|-
  
|10.29
+
|10:29
  
 
| For example, log10 bracket 1e minus 23 close bracket  and press enter this gives the expected answer -23.
 
| For example, log10 bracket 1e minus 23 close bracket  and press enter this gives the expected answer -23.
Line 553: Line 553:
 
|-
 
|-
  
|10.47
+
|10:47
  
 
| We get complex numbers when taking logarithm of negative.  
 
| We get complex numbers when taking logarithm of negative.  
Line 559: Line 559:
 
|-
 
|-
  
|10.51
+
|10:51
  
 
| For complex numbers you can check this for yourself type : log of -1 or log of %i on your scilab console.
 
| For complex numbers you can check this for yourself type : log of -1 or log of %i on your scilab console.
Line 566: Line 566:
 
|-
 
|-
  
|11.01
+
|11:01
  
 
|Now recall that we invoked a recording of all the typed commands into the file myrecord.txt through the diary command,  
 
|Now recall that we invoked a recording of all the typed commands into the file myrecord.txt through the diary command,  
Line 572: Line 572:
 
|-
 
|-
  
|11.09
+
|11:09
  
 
|Now, let's see how to close that file and view it.  
 
|Now, let's see how to close that file and view it.  
Line 579: Line 579:
 
|-
 
|-
  
|11.13
+
|11:13
  
 
| For closing the file, type,
 
| For closing the file, type,
Line 585: Line 585:
 
|-
 
|-
  
|11.16
+
|11:16
  
 
| diary of zero
 
| diary of zero
Line 591: Line 591:
 
|-
 
|-
  
|11.21
+
|11:21
  
 
| This command will close and save the file myrecord.txt.  
 
| This command will close and save the file myrecord.txt.  
Line 597: Line 597:
 
|-
 
|-
  
|11.26
+
|11:26
  
 
| Also recall that this file was created in current working directory, which in my case is desktop.  
 
| Also recall that this file was created in current working directory, which in my case is desktop.  
Line 603: Line 603:
 
|-
 
|-
  
|11.34
+
|11:34
  
 
|Let us open this file to do click on the a Open-a-file shortcut icon on your scilab console window toolbar.
 
|Let us open this file to do click on the a Open-a-file shortcut icon on your scilab console window toolbar.
Line 609: Line 609:
 
|-
 
|-
  
|11.46
+
|11:46
  
 
| I will change the file format to all file
 
| I will change the file format to all file
Line 615: Line 615:
 
|-
 
|-
  
|11.51
+
|11:51
  
 
|Select the file myrecord.txt and click on Open.
 
|Select the file myrecord.txt and click on Open.
Line 621: Line 621:
 
|-
 
|-
  
|11.59
+
|11:59
  
 
|Note that all transactions, both commands and the corresponding answers given by Scilab, have been saved into this file.
 
|Note that all transactions, both commands and the corresponding answers given by Scilab, have been saved into this file.
Line 627: Line 627:
 
|-
 
|-
  
|12.10
+
|12:10
  
 
|I will close this file.
 
|I will close this file.
Line 633: Line 633:
 
|-
 
|-
  
|12.15
+
|12:15
  
 
|Click yes.
 
|Click yes.
Line 639: Line 639:
 
|-
 
|-
  
|12.21
+
|12:21
  
 
|We know that, while a program is being developed, one experiments a lot with the code before arriving at suitable code.  
 
|We know that, while a program is being developed, one experiments a lot with the code before arriving at suitable code.  
Line 645: Line 645:
 
|-
 
|-
  
|12.29
+
|12:29
  
 
|Diary command helps to keep track of all the transactions.
 
|Diary command helps to keep track of all the transactions.
Line 651: Line 651:
 
|-
 
|-
  
|12.35
+
|12:35
  
 
| If you recall that, we had closed the file my record.txt using the command diary of zero.
 
| If you recall that, we had closed the file my record.txt using the command diary of zero.
Line 657: Line 657:
 
|-
 
|-
  
|12.42
+
|12:42
  
 
| Please , note that no transactions can be saved after executing this command.
 
| Please , note that no transactions can be saved after executing this command.
Line 663: Line 663:
 
|-
 
|-
  
|12.48
+
|12:48
  
 
|If we need to save the session once again, we need to issue the diary command again.  
 
|If we need to save the session once again, we need to issue the diary command again.  
Line 669: Line 669:
 
|-
 
|-
  
| 12.54
+
| 12:54
  
 
|If the file contains some useful information, then one should use the some other file name in the diary command.
 
|If the file contains some useful information, then one should use the some other file name in the diary command.
Line 675: Line 675:
 
|-
 
|-
  
| 13.03
+
| 13:03
  
 
| Because, use of same file name will overwrite the existing file.
 
| Because, use of same file name will overwrite the existing file.
Line 681: Line 681:
 
|-
 
|-
  
| 13.09
+
| 13:09
  
 
|Pause the video here and solve the second exercise given with the video.
 
|Pause the video here and solve the second exercise given with the video.
Line 687: Line 687:
 
|-
 
|-
  
| 13.15
+
| 13:15
  
 
|You may have noticed that the solution for the problem was not exactly zero.
 
|You may have noticed that the solution for the problem was not exactly zero.
Line 693: Line 693:
 
|-
 
|-
  
| 13.21
+
| 13:21
  
 
| For more information on how to deal with this, type “help clean”.
 
| For more information on how to deal with this, type “help clean”.
Line 699: Line 699:
 
|-
 
|-
  
|13.27
+
|13:27
  
 
|In general, if you need help about a particular command, then the 'help' or help with an argument command can be used.
 
|In general, if you need help about a particular command, then the 'help' or help with an argument command can be used.
Line 705: Line 705:
 
|-
 
|-
  
|13.37
+
|13:37
  
 
| For example, type “help chdir” on the scilab console and press enter.
 
| For example, type “help chdir” on the scilab console and press enter.
Line 711: Line 711:
 
|-
 
|-
  
|13.53
+
|13:53
  
 
| I will increase the size of the help browser.
 
| I will increase the size of the help browser.
Line 717: Line 717:
 
|-
 
|-
  
| 14.01
+
| 14:01
  
 
| Help chdir gives detailed information on how to change the current working directory.
 
| Help chdir gives detailed information on how to change the current working directory.
Line 723: Line 723:
 
|-
 
|-
  
| 14..10
+
| 14:10
  
 
| Another option is to click on the help browser icon on the toolbar of the scilab console window as you see.
 
| Another option is to click on the help browser icon on the toolbar of the scilab console window as you see.
Line 729: Line 729:
 
|-
 
|-
  
|14.20
+
|14:20
  
 
| Let me close the help browser and coming back to the slides.
 
| Let me close the help browser and coming back to the slides.
Line 735: Line 735:
 
|-
 
|-
  
|14.31
+
|14:31
  
 
| The up - down arrow keys can been used to see the previously executed commands.
 
| The up - down arrow keys can been used to see the previously executed commands.
Line 741: Line 741:
 
|-
 
|-
  
|14.36
+
|14:36
  
 
|While using the up - down arrows, you can stop at any command,and press Enter to execute it.
 
|While using the up - down arrows, you can stop at any command,and press Enter to execute it.
Line 747: Line 747:
 
|-
 
|-
  
|14.45
+
|14:45
  
 
| You can edit the commands, if necessary.
 
| You can edit the commands, if necessary.
Line 753: Line 753:
 
|-
 
|-
  
| 14.48
+
| 14:48
  
 
| In fact,  you are looking for a previous command you typed, which started with the letter 'e', then type e, and then use up arrow key.
 
| In fact,  you are looking for a previous command you typed, which started with the letter 'e', then type e, and then use up arrow key.
Line 759: Line 759:
 
|-
 
|-
  
|14.59
+
|14:59
  
 
|Use tab key to auto-complete the commad. It gives us all the available options to choose.  
 
|Use tab key to auto-complete the commad. It gives us all the available options to choose.  
Line 765: Line 765:
 
|-
 
|-
  
|15.07
+
|15:07
  
 
|In this tutorial we have learnt :
 
|In this tutorial we have learnt :
Line 771: Line 771:
 
|-
 
|-
  
|15.10
+
|15:10
  
 
|Use of Scilab as a calculator .
 
|Use of Scilab as a calculator .
Line 777: Line 777:
 
|-
 
|-
  
|15.12
+
|15:12
  
 
| Store the result in the default variable ans.  
 
| Store the result in the default variable ans.  
Line 783: Line 783:
 
|-
 
|-
  
|15.16
+
|15:16
  
 
| Assign values to the variable using the equality sign.
 
| Assign values to the variable using the equality sign.
Line 789: Line 789:
 
|-
 
|-
  
|15.20
+
|15:20
  
 
| Check values in variables by typing the name of the variable separated by commas on the console.
 
| Check values in variables by typing the name of the variable separated by commas on the console.
Line 795: Line 795:
 
|-
 
|-
  
|15.28
+
|15:28
  
 
| Check the current working directory using pwd command.
 
| Check the current working directory using pwd command.
Line 801: Line 801:
 
|-
 
|-
  
|15.34
+
|15:34
  
 
| Use diary command to save all commands typed on the console into a file.
 
| Use diary command to save all commands typed on the console into a file.
Line 807: Line 807:
 
|-
 
|-
  
|15.40
+
|15:40
  
 
| Define complex numbers, natural exponents and π using %i, %e and %pi respectively.  
 
| Define complex numbers, natural exponents and π using %i, %e and %pi respectively.  
Line 813: Line 813:
 
|-
 
|-
  
|15.49
+
|15:49
  
 
| Use help command for detailed information about any command.
 
| Use help command for detailed information about any command.
Line 819: Line 819:
 
|-
 
|-
  
|15.54
+
|15:54
  
 
|This brings us to the end of this spoken tutorial on Getting Started with Scilab.
 
|This brings us to the end of this spoken tutorial on Getting Started with Scilab.
Line 825: Line 825:
 
|-
 
|-
  
|15.59
+
|15:59
  
 
| There are many other functions in Scilab which will be covered in other spoken tutorials.
 
| There are many other functions in Scilab which will be covered in other spoken tutorials.
Line 831: Line 831:
 
|-
 
|-
  
|16.06
+
|16:06
  
 
| This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education(FOSSEE).  
 
| This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education(FOSSEE).  
Line 837: Line 837:
 
|-
 
|-
  
|16.14
+
|16:14
  
 
| More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in website  
 
| More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in website  
Line 843: Line 843:
 
|-
 
|-
  
|16.22
+
|16:22
  
 
|  Supported by the National Mission on Eduction through ICT, MHRD, Government of India.  
 
|  Supported by the National Mission on Eduction through ICT, MHRD, Government of India.  
Line 849: Line 849:
 
|-
 
|-
  
|16.29
+
|16:29
  
 
| More information on this please visit spoken hyphen tutorial dot org slash NMEICT hyphen intro
 
| More information on this please visit spoken hyphen tutorial dot org slash NMEICT hyphen intro
Line 855: Line 855:
 
|-
 
|-
  
|16.43
+
|16:43
  
 
|I hope you find this spoken tutorial useful for learning.
 
|I hope you find this spoken tutorial useful for learning.
Line 861: Line 861:
 
|-
 
|-
  
|16.47
+
|16:47
  
 
| Thank you.
 
| Thank you.
Line 867: Line 867:
 
|-
 
|-
  
|16.48
+
|16:48
  
 
| This is Anuradha Amrutkar from IIT Bombay signing off.
 
| This is Anuradha Amrutkar from IIT Bombay signing off.

Revision as of 16:19, 10 July 2014

Time Narration
00:02 Welcome to the spoken tutorial on Getting Started with Scilab.
00:07 In this tutorial we are going to learn:
00:09 The use Scilab as a calculator.
00:12 How to Store values in a variable.
00:15 How to Perform various mathematical operations using these variables.
00:21 How to Create a file to store commands executed during the session in the current working directory.
00:29 How to define complex numbers.
00:31 How to Perform exponential, logarithmic and trigonometric operations on numbers.
00:38 The prerequisite for this tutorial are Scilab should be installed on your computer.
00:44 I am using Scilab 5.2.0 and Mac OS/X for demonstration
00:51 Here is the Flow chart for the tutorial.
00:55 Click on the Scilab shortcut icon on your Desktop and Start Scilab.
01:01 This is the Scilab console window. Notice that the cursor is on the command prompt.
01:07 I suggest that you practice this tutorial in Scilab simultaneously while pausing the video at regular intervals of time.
01:16 Scilab can be used as a calculator.
01:19 Let us see some of the basic operations that it can do.
01:25 Type 42 plus 4 multiplied by 4 minus 64 divided 4 and press enter.
01:36 The output is 42, as expected.
01:39 Note that the answer 42 is stored in the default variable "a n s".
01:45 We can also create named variables: Type,
01:49 a equals 12, b=21 , c=33 and press enter.
02:00 This stores the values 12, 21 and 33 in the variables a, b and c respectively.
02:08 I will clear the scilab console using the clc command here
02:13 Now we will perform some mathematical operations using these variables.
02:19 For example,
02:21 a+b+c gives the result 66
02:27 also
02:29 a times into bracket
02:35 b plus c gives the result 648
02:41 We can also assign the answer to another variable say 'd' by typing d = bracket a+b close the bracket multiplied by c gives the answer


02:58 d = 1089.
03:01 We can check the values in the variables by typing the names of the variables separated by commas on the command line as
03:09 a,b,c,d and press enter
03:16 I will clear the console here using the clc command
03:21 To take the power, use the “raised to” symbol which is located on the number key 6 of your keyboard.
03:29 Press ' shift key' and number key 6 to used this symbol.
03:34 for example, 7 square can be found by 7 raised to 2 and press Enter.
03:43 For finding the square root of a number, say, 17, we use : sqrt of 17
03:55 This is same as 17 raised to the power of zero point five.
04:06 By convention, only the positive value comes as output.
04:10 More generally, to find 34 to the power of (2 by 5), type:
04:15 34 raised to bracket 2 divide by 5 close the bracket and press Enter.
04:25 Negative powers can also be used,
04:28 Clear the cansole using clc command
04:33 So far, you have seen how to do some simple calculations and how to create variables in Scilab.
04:40 Now let us start with the new command.
04:43 This will helps remember command which were previously issued along with the outputs.
04:49 First type the command pwd and press Enter
04:55 This is the current working directory (on my computer).
04:58 It might be different on your computer
05:01 The current working directory can be changed by clicking the changed current directory icon located on the toolbar of the scilab console window as you see.
05:15 Now issue the diary command by typing:
05:20 diary bracket, open inverted commas, myrecord.txt close inverted commas, close the bracket and press enter
05:40 This command will create a file with the name "myrecord.txt" in the current working directory.
05:48 A transcript of the Scilab session from now onwards will be saved in this file.
05:53 Its usefulness will be demonstrated at a later stage in this tutorial.
06:00 Please pause the tutorial now and attempt exercise number one given with the video.
06:07 Now, let us see how Scilab handles complex numbers.
06:13 The imaginary unit i is defined in Scilab as percent i:
06:18 For example,Five point two multiplied percent i gives 5.2i
06:29 also bracket 10 plus 5 into percent i whole multiply by 2 times percent i gives the result -10. + 20.i
06:58 Now clear the console here,
07:04 Let us see some other predefined numerical constants available in Scilab.
07:09 As with i, their names also start with the percent sign:
07:13 For example, percent pi.
07:18 The value of pi is as expected.
07:21 Now, we will demonstrate the use of pi using a few built-in trigonometric functions as follows.
07:27 For the functions sin of percent pi by 2 the result is 1
07:37 And for cos of percent pi by 2 the result is 6.123D-17.'
07:50 Please note that the angles are measured in radians and
07:54 Notice that the second answer is zero for all practical purposes.
07:59  %eps is related to number known as "machine epsilon",
08:03 It is the minimum digit resolution that Scilab can give.
08:08 Type % eps on your console to find its value on your computer.
08:19 On my computer it gives 2.220D-16
08:24 This shows the floating point precision used by Scilab .
08:28 This number is a notation for 2.22 times 10^(-16). Clear the console here.
08:41 If one wants to write 0.000456, one can write it as 4.56d-4 or 4.56e-4.
09:06 While scilab variables and functions are case-sensitive, here we can use small d or capital D, or small e, or capital E.
09:16 The base of the natural logarithm is another important predefined numerical constant:
09:22 percent e gives the result as expected.
09:30 We can achieve the same result with the function "e x p.
09:35 For example: exp bracket (1) close the bracket and press Enter
09:44 You can see both the answers are same
09:47 Clear the console using the clc command here.
09:55 similarly,
09:56  %e square gives the following answer
10:04 which can also be achieved by typing exp of 2 .
10:18 The command log means the natural logarithm of a number, that is, to the base e.
10:23 Use log 10 for taking the logarithm with respect to base 10.
10:29 For example, log10 bracket 1e minus 23 close bracket and press enter this gives the expected answer -23.
10:47 We get complex numbers when taking logarithm of negative.
10:51 For complex numbers you can check this for yourself type : log of -1 or log of %i on your scilab console.


11:01 Now recall that we invoked a recording of all the typed commands into the file myrecord.txt through the diary command,
11:09 Now, let's see how to close that file and view it.


11:13 For closing the file, type,
11:16 diary of zero
11:21 This command will close and save the file myrecord.txt.
11:26 Also recall that this file was created in current working directory, which in my case is desktop.
11:34 Let us open this file to do click on the a Open-a-file shortcut icon on your scilab console window toolbar.
11:46 I will change the file format to all file
11:51 Select the file myrecord.txt and click on Open.
11:59 Note that all transactions, both commands and the corresponding answers given by Scilab, have been saved into this file.
12:10 I will close this file.
12:15 Click yes.
12:21 We know that, while a program is being developed, one experiments a lot with the code before arriving at suitable code.
12:29 Diary command helps to keep track of all the transactions.
12:35 If you recall that, we had closed the file my record.txt using the command diary of zero.
12:42 Please , note that no transactions can be saved after executing this command.
12:48 If we need to save the session once again, we need to issue the diary command again.
12:54 If the file contains some useful information, then one should use the some other file name in the diary command.
13:03 Because, use of same file name will overwrite the existing file.
13:09 Pause the video here and solve the second exercise given with the video.
13:15 You may have noticed that the solution for the problem was not exactly zero.
13:21 For more information on how to deal with this, type “help clean”.
13:27 In general, if you need help about a particular command, then the 'help' or help with an argument command can be used.
13:37 For example, type “help chdir” on the scilab console and press enter.
13:53 I will increase the size of the help browser.
14:01 Help chdir gives detailed information on how to change the current working directory.
14:10 Another option is to click on the help browser icon on the toolbar of the scilab console window as you see.
14:20 Let me close the help browser and coming back to the slides.
14:31 The up - down arrow keys can been used to see the previously executed commands.
14:36 While using the up - down arrows, you can stop at any command,and press Enter to execute it.
14:45 You can edit the commands, if necessary.
14:48 In fact, you are looking for a previous command you typed, which started with the letter 'e', then type e, and then use up arrow key.
14:59 Use tab key to auto-complete the commad. It gives us all the available options to choose.
15:07 In this tutorial we have learnt :
15:10 Use of Scilab as a calculator .
15:12 Store the result in the default variable ans.
15:16 Assign values to the variable using the equality sign.
15:20 Check values in variables by typing the name of the variable separated by commas on the console.
15:28 Check the current working directory using pwd command.
15:34 Use diary command to save all commands typed on the console into a file.
15:40 Define complex numbers, natural exponents and π using %i, %e and %pi respectively.
15:49 Use help command for detailed information about any command.
15:54 This brings us to the end of this spoken tutorial on Getting Started with Scilab.
15:59 There are many other functions in Scilab which will be covered in other spoken tutorials.
16:06 This spoken tutorial has been created by the Free and Open Source Software in Science and Engineering Education(FOSSEE).
16:14 More information on the FOSSEE project could be obtained from http://fossee.in or http://scilab.in website
16:22 Supported by the National Mission on Eduction through ICT, MHRD, Government of India.
16:29 More information on this please visit spoken hyphen tutorial dot org slash NMEICT hyphen intro
16:43 I hope you find this spoken tutorial useful for learning.
16:47 Thank you.
16:48 This is Anuradha Amrutkar from IIT Bombay signing off.

Contributors and Content Editors

Gaurav, Jyotisolanki, Krupali, PoojaMoolya, Sandhya.np14, Sneha