summaryrefslogtreecommitdiff
path: root/tests/unit_tests/test000_TrigonIdentity/scilabcode/mainfunction.sci
blob: b19fc009d3e651a9f2dbb624cb9db1a09564ac86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
//SCI2C: DEFAULT_PRECISION= DOUBLE

function mainfunction()

// ------------------------------
// --- Simple Scalar Addition ---
// ------------------------------
a = 1;
b = 2;
c = 0;
c = a + b;
disp(c);

// ------------------------------
// --- Trigonometric Identity ---
// ------------------------------
x = (1:3)' * (4:9);
y = (sin(x).^2) + (cos(x).^2);
disp(x);
disp(y-ones(3,6));

// -------------------------------
// --- Computation of Distance ---
// -------------------------------
// generate a vector w 
w = cos(sin(cos(x*3)*2).* x+ones(3,6).*cos(x-sin(y*2))); 
distxw = sqrt(x.^2 + w.^2);
disp(distxw);
endfunction