## Mathematics Practicals I - Scilab

### Solutions to Exercise 1

-->a=4
a =
4.
-->b=5
b =
5.
-->a+b
ans =
9.
-->a*b
ans =
20.
-->a-b
ans =
- 1.
-->a/b
ans =
0.8
-->a\b
ans =
1.25
-->a^b
ans =
1024.
-->b^a
ans =
625.
-->a^b^a
ans =
Inf

#### Solution to Problem 2

-->a=4
a =
4.
-->b=6
b =
6.
-->sqrt(a)
ans =
2.
-->sqrt(a*b)
ans =
4.8989795
-->a^(5/2)+b^(2/5)
ans =
34.047673
-->a^a^(1/4)
ans =
7.1029933
-->a^(1/4)
ans =
1.4142136

-->a=5
a =
5.
-->log10(a)
ans =
0.69897
-->log(a)
ans =
1.6094379
-->%e^a
ans =
148.41316
-->%e^a^2
ans =
7.200D+10

-->x=30
x =
30.
-->sin(x)
ans =
- 0.9880316
-->sind(x)
ans =
0.5
-->cos(x)
ans =
0.1542514
-->cosd(x)
ans =
0.8660254

#### Solution to problem 5

-->a=20
a =
20.
-->b=30
b =
30.
-->sin(a+b)
ans =
- 0.2623749
-->sin(a)*cos(b)+cos(a)*sin(b)
ans =
- 0.2623749
-->sin(a)^2+cos(a)^2
ans =
1.
-->cos(2*a)
ans =
- 0.6669381
-->2*cos(a)^2-1
ans =
- 0.6669381
-->1-2*sin(a)^2
ans =
- 0.6669381
-->cos(%pi/2)+%i*sin(%pi/2)
ans =
6.123D-17 + i
-->%e^(%i*%pi/2)
ans =
6.123D-17 + i

### Solutions to Exercise 2

-->A=rand(4,5)
-->A' or -->A.'

#### Solution to problem 2

--P=[1 4 6; 6 8 10;2 1 8]
-->Q=[11 9 12;15 1 5;2 7 6]
-->P+Q
-->3*P+4*Q
-->5*P^2+7*Q^2 or -->5*P*P+7*Q*Q
-->P.*Q

#### Solution to problem 3

-->A=[1 1/2;1/3 1/4;1/5 1/6]
-->B=[5 -2]
-->C=[4 4/5 10/7;1 5 6]
-->A*C

#### Solution to problem 4

-->A=int(rand(4,4)*36)
-->A^2 or -->A*A
-->max(A)
-->min(A)
-->trace(A)
-->spec(A)
-->A(3,:)

#### Solution to problem 5

-->A=[1 2 -1 -4;2 3 -1 -11;-2 0 -3 22]
-->rref(A)
-->clc;
-->A=[1 2 3;4 5 6;1 2 3]
-->rref(A)
-->spec(A)
-->clc;
-->B=[1 2 3; 7 5 6;0 8 7]
-->rref(B)
-->inv(B)*det(B)
-->inv(B)
-->spec(B)

#### Solution to problem 6

-->A=[5 2 1;6 7 8;5 2 1]
-->rref(A)
-->tril(A)
-->triu(A)

### Solutions to Exercise 3

#### Solution to problem 1

System is consistent and has unique solution X=
0.0612229
0.4699286
0.8556435

#### Solution to problem 2

System is consistent and has unique solution X=
0.
2.3333333
- 0.6666667

#### Solution to problem 3

System is consistent and has unique solution X=
27.333333
12.666667
- 18.333333

#### Solution to problem 4

System is consistent and has unique solution X=
3.1666667
- 2.8333333

#### Solution to problem 5

System is consistent and has unique solution X=
- 5.3348165
- 0.1368187
2.160178