- •Міністерство освіти і науки, молоді та спорту україни
- •Laboratory Works of Computing and Programming
- •Contents
- •1.2 Base Concepts of Operating Systems
- •1.3 Linux (lubuntu) Operating System
- •1.4 Tasks for Independent Work
- •1.5 Test Questions
- •2 Laboratory work № 2 Word Processor libreoffice.Writer
- •2.1 What Word Processors Can Do
- •2.2 Tasks for Independent Work
- •2.3 Test Questions
- •3 Laboratory work № 3
- •Introduction to the calc spreadsheet
- •3.1 The Basic Opportunities of Spreadsheets
- •3.1.1 Calc’s Environment
- •3.1.2 Calculations in Calc. Creating and Coping Formulas
- •3.2 The Calc charting capability
- •3.3 Tasks for Independent Work
- •4.2 Main Rules of Works in Scilab System
- •Variables
- •Input of vectors (arrays)
- •Input of matrixes
- •Some operations with matrixes with use of the operator ":"
- •Input from keyboard
- •Operators. Expressions use familiar arithmetic operators and precedence rules.
- •Intrinsic scilab Functions
- •Examples of Expressions
- •4.3 Individual Tasks for Laboratory Work
- •4.4 The Tasks for Self-Examination
- •4.5 Test Questions
- •5 Laboratory work № 5
- •5.3.1The plot function
- •5.3.3 Preparing Graphs for Presentation
- •Interactive Plot Editing
- •5.3.4 3D Plotting
- •5.4 Individual Tasks
- •5.6 Test Questions
- •6 Laboratory work № 6 programming in Scilab
- •6.1 Programming in scilab
- •What Happens When You Call a Function
- •Clearing Functions from Memory
- •6.2 Tasks for laboratory work
- •6.3 Example of performance of the laboratory work
- •6.4 Test Questions
- •7 ReferencEs
Intrinsic scilab Functions
SCILAB provides a large number of standard elementary mathematical functions, including abs, sqrt, exp, and sin. Taking the square root or logarithm of a negative number is not an error; the appropriate complex result is produced automatically. SCILAB also provides many more advanced mathematical functions. For a list of the elementary mathematical functions, type >>help elfun
For a list of more advanced mathematical and matrix functions, type
>>help specfun and >>help elmat
Some of the functions, like sqrt and sin, are built in. Built-in functions are part of the SCILAB core so they are very efficient, but the computational details are not readily accessible. There are some differences between built-in functions and other functions. For example, for built-in functions, you cannot see the code. For other functions, you can see the code and even modify it if you want.
Several special functions provide values of useful constants.
|
%pi |
3.14159265... |
|
%eps |
Floating-point
relative precision,
|
|
%inf |
Infinity |
|
%nan |
Not-a-number |
|
%e |
Number e=2.7182818 |
Infinity is generated by dividing a nonzero value by zero, or by evaluating well defined mathematical expressions that overflow, i.e., exceed realmax. Not-a-number is generated by trying to evaluate expressions like 0/0 or Inf-Inf that do not have well defined mathematical values.
The function names are not reserved. It is possible to overwrite any of them with a new variable, such as eps = 1.e-6 and then use that value in subsequent calculations. The original function can be restored with clear eps.
Table 4.1 - SCILAB Functions
|
Function |
Description |
|
sin(x) |
sinus of x ; x in radians |
|
cos(x) |
cosinus of x ; x in radians |
|
tan(x) |
tangent of x ; x in radians |
|
sec(x) |
secant of x ; x in radians |
|
csc(x) |
cosecant of x; x in radians |
|
cot(x) |
cotangent of x ; x in radians |
|
asin(x) |
arc sinus of x |
|
sinh(x) |
hyperbolic sinus of x |
|
asinh(x) |
inverse hyperbolic sinus of x |
|
exp(x) |
exponential
of x
-
|
|
log(x) |
natural
logarithm of x
-
|
|
log10(x) |
base
10 logarithm of x
-
|
|
sqrt(x) |
square
root of x
-
|
|
power(x,a) |
x
to the power of a -
|
|
abs(x) |
absolute
value of x
-
|
|
round(x) |
round x towards nearest integer |
|
floor(x) |
round x towards minus infinity |
|
ceil(x) |
Round x towards infinity |
Examples of Expressions
Here are a few examples, and the resulting values:
-->rho = (1+sqrt(5))/2
rho = 1.6180
-->huge = exp(log(realmax))
huge = 1.7977e+308
-->toobig = pi*huge
toobig = Inf
4.3 Individual Tasks for Laboratory Work
For set function F (a, b, c) in table 4.2:
to set independently value c - a vector of arguments;
to save values of the data in a file;
to clear windows Сommand Window, Command History, Workspase, to load the data from a file, to calculate F(a,b,c), according to the set variant;
resulting values of a vector c and corresponding values of function F(a, b, c) display as vertically located table;
to repeat a conclusion of this table, setting various formats of the data;
to write down protocol of work in script-file. To comment used commands.
Table 4.2 – Variants of the tasks
|
№ |
F(a, b, c) |
a |
b |
|
1 |
|
2456 |
0.00078 |
|
2 |
|
0.02456 |
0.007823 |
|
3 |
|
0.2456 |
0.20078 |
|
4 |
|
0.02456 |
0.007823 |
|
5 |
|
0.12456 |
0.0078 |
|
6 |
|
0.02456 |
0.007823 |
|
7 |
|
0.2456 |
0.20078 |
|
8 |
|
0.02456 |
0.007823 |
|
9 |
|
0.12456 |
0.078 |
|
10 |
|
0.02456 |
0.007823 |
|
11 |
|
0.2456 |
0.20078 |
|
12 |
|
0.02456 |
0.007823 |
|
13 |
|
2456 |
0.00078 |
|
14 |
|
0.02456 |
0.007823 |
|
15 |
|
0.2456 |
0.20078 |
|
16 |
|
0.02456 |
0.007823 |
|
17 |
|
0.12456 |
0.0078 |
|
18 |
|
0.02456 |
0.007823 |
|
19 |
|
0.2556 |
0.50078 |
|
20 |
|
0.02456 |
0.007823 |
