Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
labScilab_English_Part1.doc
Скачиваний:
28
Добавлен:
07.02.2016
Размер:
2.38 Mб
Скачать

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

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]