the application of scilab
TRANSCRIPT
-
1
Scilab
The Application of Scilab
2554
-
Scilab
The Application of Scilab
1. 5133562323 2. 5133576123
2301499 SENIOR PROJECT
--------------------------------------------
( . )
-------------------------------------------- ( )
-------------------------------------------- ( )
-------------------------------------------- ( )
-
Scilab
Scilab
Scilab
Scilab
-
Abstract Scilab is a software program used for mathematical calculations such as addition, subtraction,
multiplication, and division, which is based on preliminary calculations, i.e. determine the limit of a
function, determine differentiation, find the integral, drawing the graph, find the specific Eigenvectors and
Eigenvalues and find value of statistics. The Scilab application with matrix, calculus and statistics It can
be calculated at the command directly, to calculate the value you are looking for. And use the theory to
help, the Scilab can help to determining some stage for easily and quickly, such as drawing graph, find the
eigenvectors. We write to explain how to use Scilab basic and applied calculus, matrices, and statistics in
detail can be understood by yourself.
-
Scilab
-
1 Scilab
1.1 1 1.2 1 1.3 1 1.4 2 1.5 2 1.6 2 1.7 3 1.8 5 1.9 5 1.10 5 1.11 6 1.12 6 1.13 6 1.14 7 1.15 7 1.16 7 1.17 7 1.18 ... 8 1.19 ... 8
-
1
2 Scilab 2.1 Scilab 9 2.2 Scilab 11 2.3 12 2.4 12 2.5 12 2.6 14 2.7 14 2.8 15
2.9 b
a
dxxf )( 15
2.10 )(xfdx
d )(xfdx
dn
n
15
2.11 16
2.12
n
i
ix1
16
2.13 17 2.14 17 2.15 f(x) = 0 17 2.16 17 2.17 rnC rnP 17 3 Scilab 3.1 2 18 3.2 19 3.3 histogram 20 3.4 21 3.5 (bar graph) 22 3.6 22 3.7 23 3.8 23
-
2
4 Scilab 4.1 Scilab 24 4.2 26 4.3 Scilab 27 4.4 Window Scilab 28 4.5 29 5 Scilab 5.1 35 5.2 Scilab 37 5.3 Scilab 38 5.4 40 6 Scilab 6.1 6.1.1 44 6.1.2 48 6.1.3 54 6.2 6.2.1 57 6.2.2 57 6.2.3 A A 59 6.3 6.3.1 60 6.3.2 61 6.3.3 61 6.3.4 62 6.3.5 63 6.3.6 63 6.3.7 64 6.3.8 65 6.3.9 65 6.3.10 66 6.3.11 67
-
3
7 7.1 68 7.2 68 7.3 68 69 2301399 Project Proposal 70 73
-
1
1 Scilab
Scilab Scilab Scilab 1.1 1.2
1.3
-
2
1.4 1.5 1.6 p(x) = x2 + 2x - 3 Scilab p = [ 1 2 -3 ] q(x) = x2 + 5x + 6 Scilab q = [ 1 5 6 ]
p + q ans = 2. 7. 3. p(x) + q(x) = 2x2 + 7x + 3
roots(p) p(x) = 0 1 , -3
-
3
1.7 1.7.1 f(x) = 2x + 3 [ -5, 5 ] f(x) = 2x + 3 g(x) = x2 4 [-5, 5] 1.7.2
53 156 58 165 55 162 60 170 62 165 68 173
-
4
1.7.3
1 15 2 35 3 40 4 10
1.7.4 r = 4cos2 1.7.5 3 f(x, y) = cos(x2)sin(y) [0, 2 ] x [0, 2 ]
-
5
1.7.6 1.8 Scilab
1.9 Scilab
1.10 Scilab
-
6
1.11 1.12 1.13 1.13.1 1.13.2
-
7
1.14 1.14.1 1.14.2 1.15 1.16 1.17
-
8
1.18 ...
1.19 ...
-
9
2 Scilab
2.1 Scilab 1. 2. icon Start
All Programs
-
10
scilab-4.1.2
scilab-4.1.2 logo Scilab logo Scilab version Scilab
-
11
2.2 Scilab Scilab 1. 45.25 + 17.5
-->45.25+17.5 ans =
62.75 2.
5
47
-->47/5 ans =
9.4 3. 15 32 -->15*32 ans =
480. 4. 43 e4 -->4^3 ans =
64. -->%e^4 ans =
54.59815 5. log(2), ln(2), sin(
6
), 3 , 5!
-->log10(2) ans =
0.30103 -->log(2) ans =
0.6931472 -->sin(%pi/6) ans =
0.5 -->sqrt(3) ans =
1.7320508 -->factorial(5) ans =
120. 6. -->x=4 x =
4.
-
12
7. b
a
dxxf )(
4
1
2 )4( dxx
-->syms x -->y=x^2+4; -->integ(y,x,1,4)
ans = 33
2.3 f(x) = x2 - 3x - 7 [-8, 8] -->x=-8:0.1:8; -->f=x^2-3*x-7; -->plot(x,f)
2.4
3212
219
155
123
-->x=[3 12;5 15;9 21;12 32] x =
3. 12. 5. 15. 9. 21. 12. 32.
2.5
A =
35
24 B = 2 51 3
-->A=[4 -2;-5 3] A =
4. - 2. - 5. 3.
-->B=[2 5;1 3] B = 2. 5. 1. 3.
-
13
A+B, 4A, AB, A2, A-1, AT, det(A) -->A=[4 -2;-5 3] A =
4. - 2. - 5. 3.
-->B=[2 5;1 3] B = 2. 5. 1. 3.
-->A+B ans =
6. 3. - 4. 6.
-->4*A ans =
16. - 8. - 20. 12.
-->A^2 ans =
26. - 14. - 35. 19.
-->A*B ans =
6. 14. - 7. - 16.
-->A^(-1) ans =
1.5 1. 2.5 2.
-->det(A) ans =
2. -->A' ans =
4. - 5. - 2. 3.
-
14
2.6
x =
15
8
7
5
3
2
-->x=[2;3;5;7;8;15] x =
2. 3. 5. 7. 8. 15.
2.7
u =
4
3 v =
2
1
-->u=[-3;4]
ans = - 3. 4.
-->v=[1;2];
ans = 1. 2.
u + v, 4u, vu , u -->u=[-3;4]
ans = - 3. 4.
-->v=[1;2]
ans = 1. 2.
-->u+v ans =
- 2. 6.
-->4*u ans =
- 12. 16.
u dot v
-
15
-->u'*v ans = 5.
-->norm(u) ans =
5. 2.8
10
1i
i ,
10
1
2
i
i ,
10
1
2 54i
ii
-->i=1:10; -->sum(i)
ans = 55.
-->i=1:10; -->sum(i^2)
ans = 385.
-->i=1:10; -->y=i^2-4*i-5; -->sum(y)
ans = 115.
2.9 b
a
dxxf )(
1
0
2dxx
3
3
2dxx
-->y=integrate('x^2','x',0,1) y =
0.3333333 -->y=integrate('x^2','x',-3,3) y =
18.
2.10 )(xfdx
d )(xfdx
dn
n
)(xfdx
d f(x) = x2 x = 1
-->syms x -->f=x^2; -->y=diff(f,x,1)
y = 2*x
-->x=1; -->2*x
ans = 2.
-
16
2.11 -->sin(30) ans =
- 0.9880316
-->sin(30*%pi/180) ans = 0.5
-->atan(1) ans = 0.7853982
2.12
n
i
ix1
x =
9
6
3
2
y =
19
14
15
12
204
1
i
ix , 604
1
i
iy , 13024
1
i
ix , 92624
1
i
iy , 3244
1
i
i
i yx
-->x=[2;3;6;9] x =
2. 3. 6. 9.
-->y=[12;15;14;19] y = 12. 15. 14. 19.
-->sum(x) ans = 20.
-->sum(y) ans = 60.
-->sum(x^2) ans = 130.
-->sum(y^2) ans = 926.
-->x.*y ans = 24. 45. 84. 171.
-->sum(x.*y) ans = 324.
-
17
2.13 x = 1, 2, 3, 4 f(x) = 2x + 4 -->x=[1:4]; -->f=2*x+4
f = 6. 8. 10. 12
-->x=[1:0.5:4]; -->f=2*x+4
f = 6. 7. 8. 9. 10. 11. 12.
2.14 ( 3 + 4i ) + ( 5 - 9i ) -->z=3+4*%i; -->w=5-9*%i; -->z+w
ans = 8. - 5.i
2.15 f(x) = 0 x2 2 = 0 -->x=poly(0,'x'); -->y=x^2-2; -->z=roots(y)
z = 1.4142136 - 1.4142136
2.16 2x + 3y = 8 x + y = 3 -->A=[2,3;1,1]; -->b=[8;3]; -->x=inv(A)*b
x = 1. 2.
2.17 rnC rnP
rnC = )!(!
!
rnr
n
10
)!25(!2
!52
5
C
-->factorial(5)/(factorial(2)*factorial(5-2)) ans =
10.
)!(
!
rn
nPr
n
20
)!25(
!52
5
P
-->factorial(5)/factorial(5-2) ans =
20.
-
18
3 Scilab
3.1 f(x) = 2x + 3 [0, 10] plot(x,y) -->x=0:0.1:10; -->y=2*x+3; -->plot(x,y)
plot(x,y) y = f(x) f(x) = 2x + 3 [ 0, 10 ] plot2d(x,y) -->x=0:0.1:10; -->y=2*x+3; -->plot2d(x,y)
plot2d(x,y) y = f(x)
-
19
2 -->x=0:0.1:10; -->a=2*x+1; -->b=3*x+1; -->plot(x,a,x,b) 2 -->x=0:0.1:10; -->y=0:0.1:15; -->b=3*x+1; -->c=y-1; -->plot(x,b,y,c) 3.2 -->x=[15;35;40;10]; -->plot2d2(x)
plot2d2(x) x plot2d2(x,[f(x)]) y = f(x)
No. X 1 15 2 35 3 40 4 10
-
20
f(x) = x2 + 1 x = 0, 0.5, 1.0, 1.5,, 10 -->x=0:0.5:10; -->plot2d2(x,[x^2+1]) 3.3 histogram 1, 4, 1, 1, 2, 2, 2, 3, 2 3 -->data=[1 4 1 1 2 2 2 3 2 3]; -->histplot(4,data,normalization=%f)
histplot(n,data,normalization=%f) x n
-
21
3.4 -->x=[15 35 40 10]; -->pie(x)
pie(x) x pie(x,explode) x explode = [d d d ] d = 0 d = 1 d = 1 -->x=[15 35 40 10]; -->explode=[1 0 0 0]; -->pie(x,explode)
No. X 1 15 2 35 3 40 4 10
-
22
3.5 (bar graph) -->score=[1 2 3 4]; -->fre=[15 35 40 10]; -->bar(score,fre)
bar(x,y) x y y -->z=[10 20 35 18]; -->bar(z) 3.6 r = 2cos(2t) -->t=0:0.1:2*%pi; -->r=2*cos(2*t); -->polarplot(t,r)
polarplot(t,r) plot
score frequency 1 15 2 35 3 40 4 10
-
23
3.7 -->x=[53 58 55 60 62 68]; -->y=[156 165 162 170 165 173]; -->plot(x,y,'*')
plot(x,y,'*') plot (xi, yi) plot '' plot * 3.8 2 x(t) = 80t y(t) = -16t2 + 80t 50 t -->t=0:0.05:5; -->x=80*t; -->y=-16*t^2+80*t; -->plot2d(x,y)
x y 53 156 58 165 55 162 60 170 62 165 68 173
-
24
4 Scilab
4.1 Scilab Scilab ( ) , [ ]
-->x=[1 2 3] x = 1. 2. 3.
= ;
, ;
-->x=[1 2;3 4] x = 1. 2. 3. 4.
-
25
Scilab -->x=2 x = 2.
1 x
-->x=[1 2 3] x = 1. 2. 3.
x 1 3
-->x=[1,2,3] x = 1. 2. 3.
x 1 3 ,
-->x=[1;2;3] x = 1. 2. 3.
x 3 1 ;
-->x=[1 2;3 4] x = 1. 2. 3. 4.
x 2 2 ;
-->x=4:2:10 x = 4. 6. 8. 10.
x = a : d : b x x = [a, a+d, a+2d, . . . b ]
-->x=[4:2:10] x = 4. 6. 8. 10.
x = a : d : b x x = [a, a+d, a+2d, . . . b ]
-
26
4.2 Scilab + -->x=[1 2];y=[3 4];
-->x+y ans = 4. 6.
- -->p=[2 3 4];q=[1 1 3]; -->p-q ans = 1. 2. 1.
* -->a=3.5;b=5; -->a*b ans = 17.5
.* -->x=[2 3 -4];y=[2 2 4]; -->x.*y ans = 4. 6. - 16.
/ a / b =
b
a -->a=23;b=4; -->a/b ans = 5.75
\ a \ b = b a-1
-->a=23;b=4; -->a\b ans = 0.1739130
. / -->x=[2 3 4];y=[5 10 20]; -->x./y ans = 0.4 0.3 0.2
^ -->x=3;y=4; -->x^y ans = 81.
. ^ -->x=[2 3 4];y=[6 5 2]; -->x.^y ans = 64. 243. 16. -->x.^2 ans = 4. 9. 16.
-
27
4.3 Scilab Scilab %pi pi = 3.1415926 %i i = 1 %e e e = 2.7182818 %inf (infinity) %nan ( Not A
Number) %eps Scilab
%eps Scilab 0 ans
%t %T (Boolean constant) (True) %f %F (False) %s %z %io Scilab
-
28
4.4 Window Scilab 1. x = [1 2 3] Scilab 4.1.2 2. Graphic Window f(x) = x + 2 x = [1, 4]
-->x=[1:4]; -->f=x+2 f = 3. 4. 5. 6. -->plot(f,x)
-
29
4.5 abs(x) x a + bi real(a+bi) imag(a+bi)
-->[real(3+4*%i) imag(3+4*%i)] ans = 3. 4.
ceil(x) x -->ceil(2.4) ans = 3.
conj(a+bi) conjugate a + bi -->conj(3+4*%i) ans = 3. - 4.i
exp(x) ex -->exp(1) ans = 2.7182818
fix(x) x 0 -->[fix(2.5) fix(-2.99) fix(2.99)] ans = 2. - 2. 2.
floor(x) x -->floor(3.99) ans = 3.
log(x) ln(x) e -->log(2) ans = 0.6931472
log10(x) log(x) 10 -->log10(2) ans = 0.30103
modulo(x,y) x y -->modulo(12,5) ans = 2.
-
30
norm(u) u u=[3;4]; -->norm(u) ans = 5.
rat(x) -->[num,den]=rat(1.5) den = 2. num = 3. num den
round(x) x -->round(2.499) ans = 2.
sign(x) +1 x > 0 -1 x < 0 -->sign(-10) ans = - 1.
sqrt(x) x -->sqrt(2) ans = 1.4142136
sin(x), cos(x) tan(x), cot(x) sec(x), cosec(x)
-->[sin(%pi/6) cos(%pi/4) tan(%pi/3)] ans = 0.5 0.7071068 1.7320508 -->x=sin(%pi/6);y=cos(%pi/4);z=tan(%pi/3); -->[1/x 1/y 1/z] ans = 2. 1.4142136 0.5773503
-
31
asin(x), acos(x) atan(x)
-->[asin(%pi/6) acos(%pi/4) atan(%pi/3)] ans = 0.5510696 0.6674572 0.8084488
sinh(x), cosh(x) tanh(x)
-->[sinh(0) cosh(0) tanh(0)] ans = 0. 1. 0.
asinh(x), acosh(x) atanh(x)
-->[asinh(2) acosh(2) atanh(0.5)] ans = 1.4436355 1.3169579 0.5493061
zeros(n) zeros(m,n) zeros(size(A))
n n m n A -->zeros(2,3) -->zeros(2) ans = ans = 0. 0. 0. 0. 0. 0. 0.
ones(m,n) ones(size(A))
m n 1 1 A -->ones(2,3) ans = 1. 1. 1. 1. 1. 1.
eye(n,n) eye(m,n)
n n m n 1 0 -->eye(2,3) ans = 1. 0. 0. 0. 1. 0. -->eye(2,2) ans = 1. 0. 0. 1.
-
32
A A -->A=[1 2;3 4] A = 1. 2. 3. 4.
det(A)
A -->det(A) ans = - 2.
inv(A)
A -->inv(A) ans = - 2. 1. 1.5 - 0.5
trace(A)
A -->trace(A) ans = 5.
diag(A)
A -->diag(A) ans = 1. 4.
rank(A) A -->rank(A) ans = 2.
diag(A) A -->B=[1 2 3 4]; -->diag(B) ans = 1. 0. 0. 0. 0. 2. 0. 0. 0. 0. 3. 0. 0. 0. 0. 4.
tril(A) -->C=[1 2 3; 4 5 6; 7 8 9]; -->tril(C) ans = 1. 0. 0. 4. 5. 0. 7. 8. 9.
-
33
triu(A) -->D=[1 2 3; 4 5 6; 7 8 9]; -->triu(D) ans = 1. 2. 3. 0. 5. 6. 0. 0. 9.
-->x=[2 4 6 5 7 2 3 5 7]
x = 2. 4. 6. 5. 7. 2. 3. 5. 7.
min(x) (minimum) x -->min(x) ans = 2.
max(x) (maximum) x -->max(x) ans = 7.
mean(x) (mean) x ( ) -->mean(x) ans = 4.5555556
median(x) (median) x -->median(x) ans = 5.
stdev(x) (standard deviation) x -->stdev(x) ans = 1.9436506
sum(x) x -->sum(x) ans = 41.
cumsum(x) (cumulative sum) x -->cumsum(x) ans = 2. 6. 12. 17. 24. 26. 29. 34. 41.
-
34
prod(x) x -->prod(x) ans = 352800.
cumprod(x) (cumulative product) x -->cumprod(x) ans = 2. 8. 48. 240. 1680. 3360. 10080. 50400. 352800.
sort(x) x histplot(n,x) (histogrsm) x n
variance(x) (variance) x
-->variance(x) ans = 3.7777778
geomean(x) (geometric mean) x -->geomean(x) ans = 4.1342055
harmean(x) (harmonic mean) x -->harmean(x) ans = 3.6950147
nfreq(x) (frequency) x -->nfreq(x) ans = 2. 2. 4. 1. 6. 1. 5. 2. 7. 2. 3. 1.
-
35
5 Scilab
Command Window Window 1 Window 2 Window
5.1
1. function y = f(x); 2. y = x.^2; y f(x) x.^2 x 3. f save File\Save f f.sci File\exec f.sci
1
2
-
36
f -->x=[1;2;3] x = 1. 2. 3. -->[x f(x)] ans = 1. 1. 2. 4. 3. 9.
)!(!
!
rnr
n
r
n
nCr (n, r)
-
37
2 b)-a 1,- b+(a = b) h(a, 22
2 h
5.2 Scilab -->score=[1 2 3 4]; -->freq=[15 35 40 10]; -->bar(score,freq)
pro_bargraph
pro_bargraph
-
38
pro_plotsincos
run pro_plotsincos
5.3 Scilab //
//Remark of program //Program name
input = input('') x=input(' input value x = ...') -->input value x = ...-->
disp disp(''), disp() -->disp('display text') display text -->disp(10^0.5) 3.1622777
-
39
printf printf(' ') %f %10.2f 10 2 %c %10.4e 10 4 %g -->printf('Text %10.2f',10^0.5) Text 3.16 -->printf('Text %20.8f',10^0.5) Text 3.16227766 -->printf('Text %g',10^0.5) Text 3.16228
if c1 1 end
c1 1 c1 end if x
-
40
for x = a : b : c 1 end \n
x x a c x b for x=1:0.5:2.25 printf('\n value of x %10.2f',x) end run value of x 1.00 value of x 1.50 value of x 2.00
while c1 1 end
c1 1 c1 x=1; while x
-
41
1 a, b, c
Scilab 1 input
run -->exec('C:\Program Files\scilab-4.1.2\Area');disp('exec done'); a = a 3 enter b = 4 c = 5 Area = 6
-
42
2 A
-->exec('C:\Program Files\scilab-4.1.2\Pro2');disp('exec done'); a11= -->1 a12= -->2 a21= -->3 a22= -->4 A = 1. 2. 3. 4. A inverse= ans = - 2. 1. 1.5 - 0.5 Adjoint of A= ans = 4. - 2. - 3. 1. exec done
3 3 (
1a , 1b ), ( 2a , 2b ), ( 3a , 3b )
)det()2
1(
1313
1212
bbaa
bbaa
-->exec('C:\Program Files\scilab-4.1.2\Pro3');disp('exec done'); x0= -->0 y0= -->0 x1= -->0 y1= -->4 x2= -->6 y2= -->0 area = 12. exec done
-
43
4 ( ox , 0y ) ax + by + c = 0
-->exec('C:\Program Files\scilab-4.1.2\Pro4');disp('exec done'); a= -->3 b= -->4 c= -->10 x0= -->2 y0= -->5 d = 7.2 exec done
5
643)( 23 xxxxf , 10 x )('
)(1
n
nnn
xf
xfxx
run -->exec('C:\Program Files\scilab-4.1.2\Pro5');disp('exec done'); root = -4.26697461340156 exec done
-
44
6 Scilab
Scilab 6.1 6.1.1 6.1.1.1 f : D R D R a D 1. c f(x) = c x D cxf
ax
)(lim
2. f(x) = x x D axfax
)(lim
f g D R D R Lxfax
)(lim Mxgax
)(lim
L M 1. MLxgxfxgxf
axaxax
)(lim)(lim))()((lim
2. LMxgxfxgxfaxaxax
))(lim))((lim()()(lim
3. M
L
xg
xf
xg
xf
ax
ax
ax
)(lim
)(lim
)(
)(lim M 0
4. Lxfxfaxax
)(lim)(lim
5. nnax
n
axLxfxf
)(lim)(lim n n L
Scilab : limit(expr,x,val) ; expr , x , val
-
45
)12(lim 21
xxx
)12(lim 2
1
xx
x = 41211lim2limlim
11
2
1
xxxxx
-->syms x -->limit(x^2+2*x+1,x,1)
-->limit(x^2+2*x+1,x,1) ans = 4 4lim 3
2
x
x
248424lim 33
2
x
x
-->syms x -->limit(sqrt(x^3-4),x,2)
-->limit(sqrt(x^3-4),x,2) ans = 2
x
x
x
164lim
0
x
x
x
164lim
0 =
0
44lim
0
x (IF.
0
0 )
= x
x
x
x
x
164
164164lim
0
= )164(
)16(16lim
0 xx
x
x
= )164(
lim0 xx
x
x
= )164(
1lim
0 xx
= )0164(
1
= 8
1
-
46
-->syms x -->limit((4-sqrt(16+x))/x,x,0)
-->limit((4-sqrt(16+x))/x,x,0) ans = -1/8
xx
1lim
0
xx
1lim
0 =
0
1lim
0x =
-->syms x
-->limit(1/x,x,0) -->limit(1/x,x,0) ans = und 6.1.1.2 1. 0sinlim
x
ax
2. 1coslim
xax
3. axax
sinsinlim
4. axax
coscoslim
5. 1sinlim0
x
x
x
6. 0cos1lim0
x
x
x
-
47
)(2
2sinlim
x
x
x
)(2
2sinlim
x
x
x =
)(2
2sinlim
x
(IF. 0
0 )
= )(2
)22sin(lim
x
x
x
=
22
)22sin(lim
x
x
x
= 1 -->syms x
-->limit((sin(2*x))/(2*(x-%pi)),x,%pi) -->limit((sin(2*x))/(2*(x-%pi)),x,%pi) ans = 1
30
sintanlim
x
xx
x
0x 33
sincos
sin
sintan
x
xx
x
x
xx
xx
xx
cos
)cos1)((sin3
xx
xx
cos
)2
sin2)((sin
3
2
)cos
2()
2
2sin
)(sin
)(4
1( 2
xx
x
x
x
2
1)
1
2)(1)(1)(
4
1(
sintanlim 2
30
x
xx
x
-->syms x -->limit((tan(x)-sin(x))/x^3,x,0)
-->limit((tan(x)-sin(x))/x^3,x,0) ans =
-
48
6.1.2 6.1.2.1 u = f(x) v = g(x) x c r
1. 0dx
dc
2. 1dx
dx
3. 1 rr
rxdx
dx
4. dx
duccu
dx
d)(
5. dx
dv
dx
duvu
dx
d )(
6. dx
duv
dx
dvuuv
dx
d)(
7. 2
)(v
dx
dvu
dx
duv
v
u
dx
d
v 0
8. dx
duru
dx
du rr
1
Scilab : diff(expr,x,n) ; expr , x , n 4)( 2 xxxf )(' xf
42 xx = 21
2 4 xx
)4()4(2
1)(' 22
1
2
xxdx
dxxxf
42
12
2
xx
x
-->syms x -->fx=sqrt(x^2-x+4); -->diff(fx,x)
-->syms x -->fx=sqrt(x^2-x+4); -->diff(fx,x) ans = (2*x-1)/(2*sqrt(x^2-x+4))
-
49
f(x) = (1 + 2x3)(x - 4)5 )(' xf
2543 6)4()4(5)21()(' xxxxxf 4 3 5 25( 4) (2 1) 6( 4)x x x x -->syms x
-->diff((1+2*x^3)*(x-4)^5,x,1) -->syms x -->diff((1+2*x^3)*(x-4)^5,x,1) ans = 5*(x-4)^4*(2*x^3+1)+6*(x-4)^5*x^2 6.1.2.2 )(' xf f x )(' xf
f x )('' xf 2y 2
2
dx
yd
n n f )()( xf n )(ny
n
n
dx
yd
f(x) = (x3 + 1)4 )('' xf )1(''f )3()1(4)(' 233 xxxf 332 )1(12 xx xxxxxxf 24)1(3)1(312)('' 332232 xxxx 24)1()1(108 33234 3 3 4 3 224 ( 1) 108 ( 1)x x x x 6248)24()4(108)1('' f
-->syms x -->diff((x^3+1)^4,x,1)
ans = 12*x^2*(x^3+1)^3 -->diff((x^3+1)^4,x,2) ans = 24*x*(x^3+1)^3+108*x^4*(x^3+1)^2 -->x=1;
-->24*x*(x^3+1)^3+108*x^4*(x^3+1)^2 ans = 624.
-
50
6.1.2.3 u x
1. dx
duuu
dx
dcossin
2. dx
duuu
dx
dsincos
3. dx
duuu
dx
d 2sectan
4. dx
duuecu
dx
d 2coscot
5. dx
duuuu
dx
dtansecsec
6. dx
duuecuecu
dx
dcotcoscos
f(x) = xcosx 3sin5x )5)(5(cos3cos)sin()(' xxxxxf
xxxx 5cos15cossin 15cos5 sin cosx x x x -->syms x
-->diff(x*cos(x)-3*sin(5*x),x,1) -->syms x -->diff(x*cos(x)-3*sin(5*x),x,1) ans = -15*cos(5*x)-x*sin(x)+cos(x)
xx
xxf
cossin
2tan)(
2
2
)cos(sin
)sin(cos2tan))2(sec2)(cos(sin)('
xx
xxxxxxxf
2
2
2sec 2 (cos sin ) tan 2
sin cos (sin cos )
x x x x
x x x x
-->syms x -->diff(tan(2*x)/(sin(x)+cos(x)),x,1)
-->syms x -->diff(tan(2*x)/(sin(x)+cos(x)),x,1) ans = 2*sec(2*x)^2/(sin(x)+cos(x))-(cos(x)-sin(x))*tan(2*x)/(sin(x)+cos(x))^2
-
51
dx
dy )12(sec 23 xy
'y = )4)(12tan()12sec()12(sec3 2222 xxxx
= )12tan()12(sec12 223 xxx 2
4 2
12 sin(2 1)
cos (2 1)
x x
x
-->syms x -->diff(1/(cos(2*x^2+1))^3,x,1)
-->syms x -->diff(1/(cos(2*x^2+1))^3,x,1) ans = 12*x*sin(2*x^2+1)/cos(2*x^2+1)^4
dx
dy )1tancos( xy
))(sec1tan2
1)(1tansin()(' 2 x
xxxf
2sec sin( tan 1)
2 tan 1
x x
x
-->syms x -->diff(cos(sqrt(tan(x)+1)),x,1)
-->syms x -->diff(cos(sqrt(tan(x)+1)),x,1) ans = -sec(x)^2*sin(sqrt(tan(x)+1))/(2*sqrt(tan(x)+1)) u x
1. dx
du
uu
dx
d
21
1arcsin
2. dx
du
uu
dx
d
21
1arccos
3. dx
du
uu
dx
d21
1arctan
4. dx
du
uuarc
dx
d21
1cot
5. dx
du
uuuarc
dx
d
1
1sec
2
6. dx
du
uuecu
dx
d
1
1arccos
2
-
52
dx
dy )12arcsin(2 xxy
)12arcsin(2))12(1
1(2'
2
2
xxx
xy 2
2
22 arcsin(2 1)
1 (2 1)
xx x
x
-->syms x -->diff(x^2*asin(2*x+1),x,1)
-->syms x -->diff(x^2*asin(2*x+1),x,1) ans = 2*x*asin(2*x+1)+2*x^2/sqrt(1-(2*x+1)^2) 6.1.2.4 8543),( 224 yxyxyxf )2,1(xf )2,1(yf
)8543(),( 224
yxyx
xyxf x
xyx 812 23 40)1(8)2()1(12)2,1( 23 xf
)8543(),( 224
yxyx
yyxf y
56 4 yx 175)2()1(6)2,1( 4 yf Scilab )2,1(xf -->syms x y
-->diff(3*x^4*y^2-4*x^2+5*y-8,x) ans = 12*x^3*y^2-8*x -->x=1;y=2;
--> 12*x^3*y^2-8*x ans = 40.
-
53
)2,1(yf -->syms x y
-->diff(3*x^4*y^2-4*x^2+5*y-8,y) ans = 6*x^4*y+5 -->x=1;y=2;
--> 6*x^4*y+5 ans = 17. 6.1.2.5 2442 4),,( zxxyzyxzyx )2,0,1( 234 442),,( zxyzxyzyxx xzyxzyxy 44),,( 32
zxxyzyxz 424),,( ),,(),,(),,(),,( zyxzyxzyxzyx zyx 234 442 zxyzxy + xzyx 44 32 + zxxy 424
kji 4816)2,0,1( -->syms x y z
-->diff(x^2*y^4+4*x*y*z+x^4*z^2,x,1) ans = 4*x^3*z^2+4*y*z+2*x*y^4 -->diff(x^2*y^4+4*x*y*z+x^4*z^2,y,1) ans = 4*x*z+4*x^2*y^3 -->diff(x^2*y^4+4*x*y*z+x^4*z^2,z,1) ans = 2*x^4*z+4*x*y -->x=1;y=0;z=2;
-->[4*x^3*z^2+4*y*z+2*x*y^4,4*x*z+4*x^2*y^3,2*x^4*z+4*x*y] ans = 16. 8. 4.
-
54
6.1.3 6.1.3.1
D
dAxy 2 D ,1[ ,0[]3 ]1
1
0
3
1
22 dxdyxydAxyD
3
4
34
4
2
1
0
3
1
0
2
3
1
1
0
22
y
y
x
x
y
dyy
dyx
y
Scilab -->syms x y
-->integ(integ(x*y^2,x,1,3),y,0,1) -->syms x y -->integ(integ(x*y^2,x,1,3),y,0,1) ans = 4/3
-
55
6.1.3.2 1. yzxzyxf 23),,( 2 ,1[D ,2[]2 ,2[]3 ]3 f D
dydzdxyzxfdVD
2
1
3
2
3
1
2 )23( ( y, z x )
43
)]1(8)1(5[)]2(8)8(5[
]85[
)815(
)]23(8)49(3[
]83[
)86(
))19()13(3(
]3[
2
1
3
2
1
2
2
1
2
2
1
3
2
22
2
1
3
2
2
2
1
3
2
2
2
1
3
2
3
1
22
x
x
z
z
y
y
xx
dxx
dxx
dxzzx
dzdxzx
dzdxzx
dzdxyzyx
Scilab -->syms x y z
-->integ(integ(integ(3*x^2*z+2*y,y,1,3),z,2,3),x,1,2) -->syms x y z -->integ(integ(integ(3*x^2*z+2*y,y,1,3),z,2,3),x,1,2) ans = 43
-
56
2.
S
xyzdV48 S 2
22x
z
z = 0, y = x y = 0
2
0 0
22
0
2
4848
x
x
S
xyzdzdydxxyzdV
32
)2(8
3)2(4)2(12
]8
3412[
)32448(
)4
24(12
)2
2(12
][)2
2(12
)2
2(24
][24
864
2
0
864
2
0
753
2
0
423
2
0
22
3
2
0
0
222
2
0 0
22
2
0 0
22
0
2
2
x
x
xy
y
x
x xz
z
xxx
dxxxx
dxx
xx
dxx
x
dxyx
x
dydxx
xy
dydxzxy
Scilab -->syms x y z
-->integ(integ(integ(48*x*y*z,z,0,2-((x^2)/2)),y,0,x),x,0,2) -->integ(integ(integ(48*x*y*z,z,0,2-((x^2)/2)),y,0,x),x,0,2) ans = 32
-
57
6.2 6.2.1
64
53A
86
74B
1410
127BA
7652
6142*BA
5.12
5.231A
2)det( A -->A=[3 5;4 6]
A = 3. 5. 4. 6.
-->B=[4 7;6 8] B = 4. 7. 6. 8.
-->A+B ans = 7. 12. 10. 14.
-->A*B ans = 42. 61. 52. 76.
-->A^(-1) ans = - 3. 2.5 2. - 1.5
-->det(A) ans = - 2.
6.2.2
31
04A A
31
04IA
0)det( IA
4,3
0127
00)3)(4(
2
4,3
3
01
01
331
034
01
01 ~
00
01
-
58
000
00
21
21
xx
xx
01 x
Rtx 2
1
00
2
1t
t
t
x
x
3
t
0 Rt
1
0
4
11
00
431
044
11
00 ~
00
11
000
0
21
21
xx
xx
21 xx
Rtx 2
1
1
2
1t
t
t
x
x
4
t
t Rt
2
12
1
-->A=[4 0;1 3] A =
4. 0. 1. 3.
-->poly(A,"x") ans = 12 - 7x + x2
-->spec(A) ans = 3. 4.
-->[V,D]=spec(A) D = 3. 0 0 4. V = 0 0.7071068 1. 0.7071068
31
04A x2 7x + 12 = 0
-
59
3, 4 (0, 1) (0.7071068, 0.7071068) 6.2.3 A A
987
654
321
A Guassian rank A
987
654
321
A = 13
12
7
4
1260
630
321
RR
RR
= 3
1260
210
3212
R
= 23 6000
210
321
RR
= 21 2
000
210
101 RR
rank A = 2 -->A=[1 2 3;4 5 6;7 8 9] A =
1. 2. 3. 4. 5. 6. 7. 8. 9.
-->rank(A) ans = 2.
-->rref(A) ans = 1. 0. - 1. 0. 1. 2. 0. 0. 0.
-
60
6.3 6.3.1 , , , x = 2, 3, 5, 7, 8, 15 x 6
= 67.66
1587532
= 62
75
=
68.46
)67.615()67.68()67.67()67.65()67.63()67.62( 222222
= 67.21)68.4( 2 x 2 x 15 -->xmean=mean(x) xmean =
6.6666667 -->xmedian=median(x) xmedian =
6. -->xlength=length(x) xlength =
6. -->xstdev=stdev(x) xstdev =
4.6761808 -->xvariance=variance(x) xvariance =
21.866667 -->xmax=max(x) xmax =
15. -->xmin=min(x) xmin =
2. xmean = x xmedian = x xstdev = () x xvariance = () x xlength = x xmax = x xmin = x
-
61
6.3.2 ( geomean ) N
NxxxMG ..... 21 2, 4, 8 8,4,2 321 xxx 3N
1 2
3
3
. . ...
. . (2)(4)(8)
. . 64
. . 4
NNGM x x x
GM
GM
GM
Scilab -->x=[2 4 8]; -->gm=geomean(x)
gm = 4.
6.3.3 ( harmean )
Nxxx
NMH
1...
11..
21
30, 40, 50 50,40,30 321 xxx 3N
1 2
. .1 1 1
...
3. .
1 1 1
30 40 50
3. . 38.30
47
600
N
NH M
x x x
H M
H M
Scilab -->x=[30 40 50]; -->hm=harmean(x)
hm = 38.297872
-
62
6.3.4
mean N
xxxx
N
xx N
...321
14, 16, 14, 17, 16, 14, 18, 17 1 14,x 2 16,x 3 14,x 4 17,x 5 16,x 6 14,x 7 18,x 8 17x 8N
75.158
126
8
1718141617141614
N
xx
Scilab -->x=[14 , 16 , 14 , 17 , 16 , 14 , 18 , 17]; -->y=mean(x)
y = 15.75
meanf
n
xfxfxfxf
N
xfx NN
ii
...332211
40 (f) x f*x 11 20
21 30
31 40
41 50
51 - 60
7
6
8
15
4
15.5
25.5
35.5
45.5
55.5
108.5
153
284
682.5
222
405
1
Nfi
i 14505
1
i
ii xf
25.3640
1450
N
xfx
ii
Scilab -->x=[15.5 25.5 35.5 45.5 55.5]; -->y=[7 6 8 15 4]; -->m=meanf(x,y)
m = 36.25
-
63
6.3.5 () ( 0.01 )
4.3 126 4.5 121 5.9 116 5.6 118 6.1 114 5.2 118 3.8 132 2.1 141 7.5 108
1. b bxay 2. a ( Y) bxay Scilab -->x=[4.3 4.5 5.9 5.6 6.1 5.2 3.8 2.1 7.5]; -->y=[126 121 116 118 114 118 132 141 108]; -->regress(x,y)
ans = 153.17549 - 6.3239875
Scilab 1. b = - 6.3239875 2. a = 153.17549 6.3.6
r
x
pnxbpnrBrXP0
),;(),;()(
80% 10 5
8.0100
80p , 2.0q , 10n
10 5
9936.00064.01)8.0,10;(1)5(1)5(4
0
x
xbXPXP
-
64
Scilab -->[P,Q]=cdfbin("PQ",5,10,0.8,0.2) Q =
0.9936306 P = 0.0063694
6.3.7
r
x
xprP0
);();(
5 10 10x , 5
0181.09682.09863.0)5;()5;(!10
5)5;10(
9
0
10
0
105
xx
xpxpe
p
Scilab -->[P,Q]=cdfpoi("PQ",10,5) Q =
0.0136953 P = 0.9863047
-->[P,Q]=cdfpoi("PQ",9,5) Q = 0.0318281 P = 0.9681719
-->0.9863047-0.9681719 ans = 0.0181328
-
65
6.3.8 2)(
2
1
2
2
1),;(
x
exn x , ...14159.3 ...71828.2e
3 0.5 2.3 X X )25.0,3;(xn
)5.0
33.2()3.2(
XPXP
0808.0
)4.1(
ZP
Scilab -->[P,Q]=cdfnor("PQ",2.3,3,0.5) Q =
0.9192433 P = 0.0807567
6.3.9
T 212
)1(
)2
(
)2
1(
)(
v
v
t
vv
v
th
df
t 5v a 90.0)( atP
a 90.0)( atP
90.0)( ataP 90.0)( 05.005.0 tttP 5v 05.0 015.205.0 t 015.2a Scilab -->[T]=cdft("T",5,0.95,0.05) T =
2.0150484
-
66
6.3.10
F 2
2
121
122
2
121
21
11
)1)(2
()2
(
))(2
(
vv
vv
fv
vvv
fv
vvv
0f
h(f) = 0 f F 91 v 52 v . )77.40( FP . k 05.0)( kFP 77.4)5,9(,05.0 21 vvf 95.0)77.40( FP 77.4k Scilab -->[P,Q]=cdff("PQ",4.77,9,5) Q =
0.0500515 P = 0.9499485
-->[F]=cdff("F",9,5,0.95,0.05) F = 4.7724656
-
67
6.3.11 )( 2 v
21
2
2 )2
(2
1xv
vex
v
x > 0
f(x) = 0 x X 5v a b 05.0)( aXP 90.0)( bXaP a 05.0)0( aXP 2 95.0 5v 145.1295.0 05.0)145.10( XP a = 1.145 2 95.0 5v 070.11205.0 95.005.01)070.110( XP )145.10()070.110()070.11145.1( XPXPXP
05.095.0 90.0 b = 11.070 Scilab -->[X]=cdfchi("X",5,0.05,0.95) X =
1.1454762 -->[X]=cdfchi("X",5,0.95,0.05) X =
11.070498
-
68
7
Scilab
Scilab
7.1
- Scilab
-
-
7.2
Scilab
7.3
Scilab
http://home.npru.ac.th/piya/webscilab/index.php
-
69
1. , ,
, 2544.
2. , Mathcad Mathematica Mathlab
Maple, , , 2546.
3. , Instat,
, , 2551.
4. , ,
, Calculus I, , , 2548.
5. http://home.npru.ac.th/piya/webscilab/download.php
-
70
. 2301399 Project Proposal
() : Scilab
() : The Application of Scilab
:
: 1. 5133562323
2. 5133576123
:
Mathcad, Mathematica, Matlab Maple
Scilab
:
Scilab ,
:
Scilab
-
71
:
Scilab
Scilab
Scilab
: 2554 2555
.. .. .. .. .. .. .. ..
Scilab
Scilab
:
Scilab
-
72
Scilab
Hardware
2 GB
Flash drive
CD
Software
Microsoft Windows XP Professional
Scilab
Symbolic toolbox
Microsoft Offices 2007
:
, ,
, 2544.
, Matlab, ,
, 2546
, Instat,
, , 2546
, , ,
Calculus I, , , 2548.
http://home.npru.ac.th/piya/webscilab/download.php
-
73
.
Mathlab Scilab = 3.141592654 pi %pi i = 1 i %i
x sqrt(x) sqrt(x) e = 2.7182818, xe exp(x) exp(x) n! factorial(n) factorial(n) f(x) f.m file f = 10 log(x) log10(x) e log10(x) log(x) sin(x) sin(x) sin(x) cos(x) cos(x) cos(x) tan(x) tan(x) tan(x) sec(x) sec(x) 1/cos(x) cosec(x) csc(x) 1/sin(x) cot(x) cot(x) 1/tan(x) arcsin(x) asin(x) asin(x) arcos(x) acos(x) acos(x) arctan(x) atan(x) atan(x) arcsec(x) asec(x) acos(1/x) arccosec(x) acsc(x) asin(1/x) arccot(x) acot(x) atan(1/x) abs(x) abs(x) z real(z) real(z) z imag(z) imag(z) z conj(z) conj(z) det(A) det(A) det(A) 1A inv(A), A^-1 inv(A)
-
74
Mathlab Scilab A DV , = eig(A) spec(A) A DV , = eig(A) [V,D]=spec(A) A norm(u) norm(u) u dot v dot(u, v) u*v sum, symsum sum prod prod limit limit diff diff intg integ taylor taylor laplace laplace ilaplace ilaplace gamma(x) gamma(x) bessej, bessely besselj, bessely legendre legendre XY plot, ezplot plot, plot2d polar,ezpolor polarplot 3 surf, ezsurf plot3d contour contour, ezsurf contour expand expand factor factor solve, root, fzero solve, root solve, linsolve rref